1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

Name context functions consistently (#481)

It would be nice to follow a single schema for naming context
functions. In the trace package we followed the form FooFromContext
and ContextWithFoo. Do the same in the correlation package. The schema
WithFoo is mainly used for functions following the options pattern.

Not sure about a name of the NewContext function, though. For now I
have left it alone.

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
This commit is contained in:
Krzesimir Nowak
2020-02-27 18:10:52 +01:00
committed by GitHub
parent a6b805894e
commit 8ebc7bbad0
9 changed files with 17 additions and 17 deletions

View File

@ -58,7 +58,7 @@ func main() {
helloHandler := func(w http.ResponseWriter, req *http.Request) {
attrs, entries, spanCtx := httptrace.Extract(req.Context(), req)
req = req.WithContext(correlation.WithMap(req.Context(), correlation.NewMap(correlation.MapUpdate{
req = req.WithContext(correlation.ContextWithMap(req.Context(), correlation.NewMap(correlation.MapUpdate{
MultiKV: entries,
})))