Skip to content

Commit

Permalink
fix: normalizes request header constant
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
  • Loading branch information
baywet committed Dec 13, 2024
1 parent 3692bb2 commit e1f0d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nethttp_request_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (a *NetHttpRequestAdapter) getRequestFromRequestInformation(ctx context.Con
}
if request.Header.Get("Content-Type") != "" {
spanForAttributes.SetAttributes(
attribute.String("http.request.header.content-type", request.Header.Get("Content-Type")),
HttpRequestHeaderContentTypeAttribute.String(request.Header.Get("Content-Type")),
)
}
if request.Header.Get("Content-Length") != "" {
Expand Down
11 changes: 6 additions & 5 deletions span_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import "go.opentelemetry.io/otel/attribute"

// HTTP Request attributes
const (
HttpRequestBodySizeAttribute = attribute.Key("http.request.body.size")
HttpRequestResendCountAttribute = attribute.Key("http.request.resend_count")
HttpRequestMethodAttribute = attribute.Key("http.request.method")
HttpRequestBodySizeAttribute = attribute.Key("http.request.body.size")
HttpRequestResendCountAttribute = attribute.Key("http.request.resend_count")
HttpRequestMethodAttribute = attribute.Key("http.request.method")
HttpRequestHeaderContentTypeAttribute = attribute.Key("http.request.header.content-type")
)

// HTTP Response attributes
Expand All @@ -28,7 +29,7 @@ const (

// URL attributes
const (
UrlFullAttribute = attribute.Key("url.full")
UrlSchemeAttribute = attribute.Key("url.scheme")
UrlFullAttribute = attribute.Key("url.full")
UrlSchemeAttribute = attribute.Key("url.scheme")
UrlUriTemplateAttribute = attribute.Key("url.uri_template")
)

0 comments on commit e1f0d35

Please sign in to comment.