opentelemetry tracer: add support for environment resource detector (#29547)
Commit Message: Allow specifying resource detectors for the OpenTelemetry tracer via a new configuration resource_detectors. The resource detector reads from the env variable OTEL_RESOURCE_ATTRIBUTES which is defined by the OTel specification. The detector returns a resource object populated with the detected attributes, which is sent as part of the OTLP request. Additional Description: This PR adds the "foundation" for building other resource detectors in Envoy. It is based on the OTel collector implementation. Users can configure multiple resource detectors, and they work together to "merge" all the detected attributes into a single resource object, which is then part of the OTLP message exported. Risk Level: Low Testing: Multiple unit tests, that cover all new code/scenarios. I also did manual testing, running Envoy locally with the OTel tracer + env resource detector enabled. Resource attributes detected from my environment is successfully exported as seen in the Jaeger screenshot. resource-detectors-env-jaeger Docs Changes: Not sure if I should add/where. Happy to do it. Release Notes: N/A Platform Specific Features: N/A [Optional Runtime guard:] N/A [Optional Fixes #28929] Here is how the new config is used: tracing: provider: name: envoy.tracers.opentelemetry typed_config: "@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig grpc_service: envoy_grpc: cluster_name: opentelemetry_collector timeout: 0.250s service_name: envoy-gRPC-exporter resource_detectors: # --> NEW CONFIG - name: envoy.tracers.opentelemetry.resource_detectors.environment typed_config: "@type": type.googleapis.com/envoy.extensions.tracers.opentelemetry.resource_detectors.v3.EnvironmentResourceDetectorConfig Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com> Mirrored from https://github.com/envoyproxy/envoy @ 4eaa1f866164eee5d51e46406bcb31d8dec99bddmain
parent
cdb43f6559
commit
f5b171e919
5 changed files with 41 additions and 0 deletions
@ -0,0 +1,9 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package( |
||||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], |
||||
) |
@ -0,0 +1,25 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.extensions.tracers.opentelemetry.resource_detectors.v3; |
||||
|
||||
import "udpa/annotations/status.proto"; |
||||
|
||||
option java_package = "io.envoyproxy.envoy.extensions.tracers.opentelemetry.resource_detectors.v3"; |
||||
option java_outer_classname = "EnvironmentResourceDetectorProto"; |
||||
option java_multiple_files = true; |
||||
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/tracers/opentelemetry/resource_detectors/v3;resource_detectorsv3"; |
||||
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||
|
||||
// [#protodoc-title: Environment Resource Detector config] |
||||
|
||||
// Configuration for the Environment Resource detector extension. |
||||
// The resource detector reads from the ``OTEL_RESOURCE_ATTRIBUTES`` |
||||
// environment variable, as per the OpenTelemetry specification. |
||||
// |
||||
// See: |
||||
// |
||||
// `OpenTelemetry specification <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.24.0/specification/resource/sdk.md#detecting-resource-information-from-the-environment>`_ |
||||
// |
||||
// [#extension: envoy.tracers.opentelemetry.resource_detectors.environment] |
||||
message EnvironmentResourceDetectorConfig { |
||||
} |
Loading…
Reference in new issue