Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion enrichments/trace/internal/elastic/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/elastic/opentelemetry-lib/enrichments/trace/config"
"go.opentelemetry.io/collector/pdata/pcommon"
semconv "go.opentelemetry.io/collector/semconv/v1.22.0"
semconv "go.opentelemetry.io/collector/semconv/v1.25.0"
)

// EnrichResource derives and adds Elastic specific resource attributes.
Expand Down
4 changes: 2 additions & 2 deletions enrichments/trace/internal/elastic/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ func (s *spanEnrichmentContext) Enrich(span ptrace.Span, cfg config.Config) {
s.httpStatusCode = v.Int()
case semconv.AttributeHTTPMethod,
semconv.AttributeHTTPRequestMethod,
semconv.AttributeHTTPURL,
semconv.AttributeHTTPTarget,
semconv.AttributeHTTPScheme,
semconv.AttributeHTTPFlavor,
semconv.AttributeNetHostName:
s.isHTTP = true
case semconv.AttributeURLFull:
case semconv.AttributeURLFull,
semconv.AttributeHTTPURL:
s.isHTTP = true
// ignoring error as if parse fails then we don't want the url anyway
s.urlFull, _ = url.Parse(v.Str())
Expand Down
34 changes: 34 additions & 0 deletions enrichments/trace/internal/elastic/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,40 @@ func TestElasticSpanEnrich(t *testing.T) {
AttributeSpanDestinationServiceResource: "testsvc",
},
},
{
name: "http_span_deprecated_http_url",
input: func() ptrace.Span {
span := getElasticSpan()
span.SetName("testspan")
// peer.service should be ignored if more specific deductions
// can be made about the service target.
span.Attributes().PutStr(semconv.AttributePeerService, "testsvc")
span.Attributes().PutInt(
semconv.AttributeHTTPResponseStatusCode,
http.StatusOK,
)
span.Attributes().PutStr(
semconv.AttributeHTTPURL,
"https://www.foo.bar:443/search?q=OpenTelemetry#SemConv",
)
return span
}(),
config: config.Enabled().Span,
enrichedAttrs: map[string]any{
AttributeTimestampUs: startTs.AsTime().UnixMicro(),
AttributeSpanName: "testspan",
AttributeProcessorEvent: "span",
AttributeSpanRepresentativeCount: float64(1),
AttributeSpanType: "external",
AttributeSpanSubtype: "http",
AttributeSpanDurationUs: expectedDuration.Microseconds(),
AttributeEventOutcome: "success",
AttributeSuccessCount: int64(1),
AttributeServiceTargetType: "http",
AttributeServiceTargetName: "www.foo.bar:443",
AttributeSpanDestinationServiceResource: "testsvc",
},
},
{
name: "http_span_no_full_url",
input: func() ptrace.Span {
Expand Down