mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-30 04:40:41 +02:00
Move content length out of basic attributes (#1031)
* Move content length out of basic attributes semconv.httpBasicAttributesFromHTTPRequest() was including the request's content length, which is a high-cardinality label. It ended up in metric labels through the use of that function by semconv.HTTPServerMetricAttributesFromHTTPRequest(). * Add CHANGELOG entry Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
3780b80214
commit
b40fdf174b
@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
- Renamed `go.opentelemetry.io/otel/api/standard` package to `go.opentelemetry.io/otel/semconv` to avoid the ambiguous and generic name `standard` and better describe the package as containing OpenTelemetry semantic conventions. (#1016)
|
||||
|
||||
### Fixed
|
||||
|
||||
- The `semconv.HTTPServerMetricAttributesFromHTTPRequest()` function no longer generates the high-cardinality `http.request.content.length` label. (#1031)
|
||||
|
||||
## [0.10.0] - 2020-07-29
|
||||
|
||||
This release migrates the default OpenTelemetry SDK into its own Go module, decoupling the SDK from the API and reducing dependencies for instrumentation packages.
|
||||
|
@ -151,11 +151,15 @@ func httpCommonAttributesFromHTTPRequest(request *http.Request) []kv.KeyValue {
|
||||
if ua := request.UserAgent(); ua != "" {
|
||||
attrs = append(attrs, HTTPUserAgentKey.String(ua))
|
||||
}
|
||||
if request.ContentLength > 0 {
|
||||
attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength))
|
||||
}
|
||||
|
||||
return append(attrs, httpBasicAttributesFromHTTPRequest(request)...)
|
||||
}
|
||||
|
||||
func httpBasicAttributesFromHTTPRequest(request *http.Request) []kv.KeyValue {
|
||||
// as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality
|
||||
attrs := []kv.KeyValue{}
|
||||
|
||||
if request.TLS != nil {
|
||||
@ -177,9 +181,6 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []kv.KeyValue {
|
||||
if flavor != "" {
|
||||
attrs = append(attrs, HTTPFlavorKey.String(flavor))
|
||||
}
|
||||
if request.ContentLength > 0 {
|
||||
attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength))
|
||||
}
|
||||
|
||||
return attrs
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user