Skip to content

Commit

Permalink
Revert semconv 1.25 for now
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 committed May 24, 2024
1 parent 4a4578f commit f5d166c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3086,7 +3086,6 @@ core,go.opentelemetry.io/collector/semconv/v1.16.0,Apache-2.0,Copyright The Open
core,go.opentelemetry.io/collector/semconv/v1.17.0,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.18.0,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.22.0,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.25.0,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.6.1,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.8.0,Apache-2.0,Copyright The OpenTelemetry Authors
core,go.opentelemetry.io/collector/semconv/v1.9.0,Apache-2.0,Copyright The OpenTelemetry Authors
Expand Down
1 change: 0 additions & 1 deletion cmd/serverless/linux_dependencies_amd64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ go.opentelemetry.io/collector/receiver/otlpreceiver/internal/trace
go.opentelemetry.io/collector/receiver/receiverhelper
go.opentelemetry.io/collector/semconv/v1.17.0
go.opentelemetry.io/collector/semconv/v1.18.0
go.opentelemetry.io/collector/semconv/v1.25.0
go.opentelemetry.io/collector/semconv/v1.6.1
go.opentelemetry.io/collector/service
go.opentelemetry.io/collector/service/extensions
Expand Down
1 change: 0 additions & 1 deletion cmd/serverless/linux_dependencies_arm64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ go.opentelemetry.io/collector/receiver/otlpreceiver/internal/trace
go.opentelemetry.io/collector/receiver/receiverhelper
go.opentelemetry.io/collector/semconv/v1.17.0
go.opentelemetry.io/collector/semconv/v1.18.0
go.opentelemetry.io/collector/semconv/v1.25.0
go.opentelemetry.io/collector/semconv/v1.6.1
go.opentelemetry.io/collector/service
go.opentelemetry.io/collector/service/extensions
Expand Down
5 changes: 2 additions & 3 deletions pkg/trace/traceutil/otel_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
semconv117 "go.opentelemetry.io/collector/semconv/v1.17.0"
semconv125 "go.opentelemetry.io/collector/semconv/v1.25.0"
semconv "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.opentelemetry.io/otel/attribute"
)
Expand Down Expand Up @@ -169,7 +168,7 @@ func GetOTelService(span ptrace.Span, res pcommon.Resource, normalize bool) stri
func GetOTelResource(span ptrace.Span, res pcommon.Resource) (resName string) {
resName = GetOTelAttrValInResAndSpanAttrs(span, res, false, "resource.name")
if resName == "" {
if m := GetOTelAttrValInResAndSpanAttrs(span, res, false, semconv125.AttributeHTTPRequestMethod, semconv.AttributeHTTPMethod); m != "" {
if m := GetOTelAttrValInResAndSpanAttrs(span, res, false, "http.request.method", semconv.AttributeHTTPMethod); m != "" {
// use the HTTP method + route (if available)
resName = m
if route := GetOTelAttrValInResAndSpanAttrs(span, res, false, semconv.AttributeHTTPRoute); route != "" {
Expand Down Expand Up @@ -266,7 +265,7 @@ func GetOTelHostname(span ptrace.Span, res pcommon.Resource, tr *attributes.Tran

// GetOTelStatusCode returns the DD status code of the OTel span.
func GetOTelStatusCode(span ptrace.Span) uint32 {
if code, ok := span.Attributes().Get(semconv125.AttributeHTTPResponseStatusCode); ok {
if code, ok := span.Attributes().Get("http.response.status_code"); ok {
return uint32(code.Int())
}
if code, ok := span.Attributes().Get(semconv.AttributeHTTPStatusCode); ok {
Expand Down
7 changes: 3 additions & 4 deletions pkg/trace/traceutil/otel_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
semconv125 "go.opentelemetry.io/collector/semconv/v1.25.0"
semconv "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.opentelemetry.io/otel/metric/noop"
)
Expand Down Expand Up @@ -269,12 +268,12 @@ func TestGetOTelResource(t *testing.T) {
},
{
name: "HTTP request method resource",
sattrs: map[string]string{semconv125.AttributeHTTPRequestMethod: "GET"},
sattrs: map[string]string{"http.request.method": "GET"},
expected: "GET",
},
{
name: "HTTP method and route resource",
sattrs: map[string]string{semconv125.AttributeHTTPMethod: "GET", semconv125.AttributeHTTPRoute: "/"},
sattrs: map[string]string{semconv.AttributeHTTPMethod: "GET", semconv.AttributeHTTPRoute: "/"},
expected: "GET /",
},
{
Expand Down Expand Up @@ -429,7 +428,7 @@ func TestGetOTelStatusCode(t *testing.T) {
span.Attributes().PutInt(semconv.AttributeHTTPStatusCode, 200)
assert.Equal(t, uint32(200), GetOTelStatusCode(span))
span.Attributes().Remove(semconv.AttributeHTTPStatusCode)
span.Attributes().PutInt(semconv125.AttributeHTTPResponseStatusCode, 404)
span.Attributes().PutInt("http.response.status_code", 404)
assert.Equal(t, uint32(404), GetOTelStatusCode(span))
}

Expand Down

0 comments on commit f5d166c

Please sign in to comment.