You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
Increase the visibility of the api/key package (#650)
* Point to the convenience functions in api/key package This is to increase the visibility of the api/key package through the api/core package, otherwise developers often tend to miss the api/key package altogether and write `core.Key(name).TYPE(value)` and complain at the verbosity of such a construction. The api/key package would allow them to write `key.TYPE(name, value)`. * Use the api/key package where applicable This transforms all the uses of `core.Key(name).TYPE(value)` to `key.TYPE(name, value)`. This also should help increasing the visibility of the api/key package for developers reading the otel-go code. Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
This commit is contained in:
@@ -22,8 +22,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"go.opentelemetry.io/otel/api/core"
|
||||
"go.opentelemetry.io/otel/api/global"
|
||||
"go.opentelemetry.io/otel/api/key"
|
||||
"go.opentelemetry.io/otel/api/trace"
|
||||
"go.opentelemetry.io/otel/exporters/trace/stdout"
|
||||
"go.opentelemetry.io/otel/plugin/othttp"
|
||||
@@ -65,7 +65,7 @@ func ExampleNewHandler() {
|
||||
case "":
|
||||
err = fmt.Errorf("expected /hello/:name in %q", s)
|
||||
default:
|
||||
trace.SpanFromContext(ctx).SetAttributes(core.Key("name").String(pp[1]))
|
||||
trace.SpanFromContext(ctx).SetAttributes(key.String("name", pp[1]))
|
||||
}
|
||||
return pp[1], err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user