mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-26 03:52:03 +02:00
Use standard HTTP attributes in httptrace.Extract()
This commit is contained in:
parent
a6f6d402a2
commit
31096d4ebc
@ -22,6 +22,7 @@ import (
|
|||||||
"go.opentelemetry.io/otel/api/global"
|
"go.opentelemetry.io/otel/api/global"
|
||||||
"go.opentelemetry.io/otel/api/kv"
|
"go.opentelemetry.io/otel/api/kv"
|
||||||
"go.opentelemetry.io/otel/api/propagation"
|
"go.opentelemetry.io/otel/api/propagation"
|
||||||
|
"go.opentelemetry.io/otel/api/standard"
|
||||||
"go.opentelemetry.io/otel/api/trace"
|
"go.opentelemetry.io/otel/api/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,10 +35,10 @@ var (
|
|||||||
func Extract(ctx context.Context, req *http.Request) ([]kv.KeyValue, []kv.KeyValue, trace.SpanContext) {
|
func Extract(ctx context.Context, req *http.Request) ([]kv.KeyValue, []kv.KeyValue, trace.SpanContext) {
|
||||||
ctx = propagation.ExtractHTTP(ctx, global.Propagators(), req.Header)
|
ctx = propagation.ExtractHTTP(ctx, global.Propagators(), req.Header)
|
||||||
|
|
||||||
attrs := []kv.KeyValue{
|
attrs := append(
|
||||||
URLKey.String(req.URL.String()),
|
standard.HTTPServerAttributesFromHTTPRequest("", "", req),
|
||||||
// Etc.
|
standard.NetAttributesFromHTTPRequest("tcp", req)...,
|
||||||
}
|
)
|
||||||
|
|
||||||
var correlationCtxKVs []kv.KeyValue
|
var correlationCtxKVs []kv.KeyValue
|
||||||
correlation.MapFromContext(ctx).Foreach(func(kv kv.KeyValue) bool {
|
correlation.MapFromContext(ctx).Foreach(func(kv kv.KeyValue) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user