envcar: add environment carrier#8442
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8442 +/- ##
=====================================
Coverage 82.1% 82.1%
=====================================
Files 180 182 +2
Lines 13722 13756 +34
=====================================
+ Hits 11270 11304 +34
Misses 2049 2049
Partials 403 403
🚀 New features to boost your workflow:
|
Signed-off-by: Alan Clucas <alan@clucas.org>
|
I see that other propagators have example_test.go files. I think two scenarios might be interesting:
|
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: Alan Clucas <alan@clucas.org>
This comment was marked as resolved.
This comment was marked as resolved.
pellared
left a comment
There was a problem hiding this comment.
Let's please add a test that ensures that it works correctly in a scenario when the application (code) spawns processes from a few concurrent goroutines and each process is created inside a new span (so that each of the new process receives unique trace context).
Reference: https://opentelemetry.io/docs/specs/otel/context/env-carriers/#process-spawning
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Signed-off-by: Alan Clucas <alan@clucas.org>
Co-authored-by: Christophe Kamphaus <christophe.kamphaus@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
I am no longer blocking this PR. Only a few cleanups are needed.
Signed-off-by: Alan Clucas <alan@clucas.org>
pellared
left a comment
There was a problem hiding this comment.
Minor feedback regarding docs. Besides, LGTM. Great work!
Signed-off-by: Alan Clucas <alan@clucas.org>
Signed-off-by: Alan Clucas <alan@clucas.org>
|
I've invited you to the @open-telemetry/go-contributors team. This is required to let GH actions auto-request reviews from PRs opened against this module. |
Co-authored-by: Damien Mathieu <42@dmathieu.com>
#8649) ### Added - Add environment variables propagation carrier in `go.opentelemetry.io/contrib/propagators/envcar`. (#8442) ### Changed - Upgrade `go.opentelemetry.io/otel/semconv` to `v1.40.0`, including updates across instrumentation and detector modules. (#8631) - The semantic conventions v1.40.0 release introduces RPC breaking changes applied in this repository: - RPC spans and metrics no longer include `network.protocol.name`, `network.protocol.version`, or `network.transport` attributes. - `rpc.client.request.size`, `rpc.client.response.size`, `rpc.server.request.size`, and `rpc.server.response.size` are no longer emitted in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. - `rpc.message` span events and their message attributes are no longer emitted in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` (including when `WithMessageEvents` is configured). See [semantic-conventions v1.40.0 release](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.40.0) for complete details. ### Fixed - Ignore informational response status codes (`100-199`) except `101 Switching Protocols` when storing the HTTP status code in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` and `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#6913) - Make `Body` handling in `Transport` consistent with stdlib in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#8618) - Fix bucket boundaries for `rpc.server.call.duration` and `rpc.client.call.duration` in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#8642) - Host resource detector in `go.opentelemetry.io/contrib/otelconf` now includes `os.` attributes. (#8578) ### Removed - Drop support for [Go 1.24]. (#8628) [Go 1.24]: https://go.dev/doc/go1.24
Fixes #8300
Add a carrier implementing environment carrier based on top of TextMapCarrier.
Allows the callers selection of mechanism for setting environment variables, compatible with
os.Setenv- for users who'd like to set environment variables in spawned processes.This is mostly a migration of @pellared's work in open-telemetry/opentelemetry-go#6778 to go-contrib. I've added further test coverage to appease the coverage bot.
There are three example tests for how to use it.
This is incomplete due to ownership: I'd be happy to be CODEOWNER, or add @pellared as the owner.I've set myself as CODEOWNER