Centralize shared OpenTelemetry code into source/extensions/common/opentelemetry/
#44379
CI (Envoy) / Envoy/Publish and verify
succeeded
Apr 14, 2026 in 1h 24m 59s
Envoy/Publish and verify (success)
Check has finished
Details
Check run finished (success ✔️)
The check run can be viewed here:
Envoy/Publish and verify (pr/44379/main@7c85abe)
Check started by
Request (pr/44379/main@7c85abe)
@mmorel-35
7c85abe #44379
merge main@5aeaf37
Centralize shared OpenTelemetry code into `source/extensions/common/opentelemetry/`
Centralizes shared OpenTelemetry types, utilities, and exporters into
source/extensions/common/opentelemetry/, aligning the directory structure and naming conventions with opentelemetry-cpp.Changes Made
SDK structure (mirrors opentelemetry-cpp)
- Added
sdk/common/types.hwith a sharedAttributeValuevariant type (Sdk::Commonnamespace) and#include <cstdint>- Added
sdk/trace/constants.h,sdk/logs/constants.h, andsdk/metrics/constants.hwith per-signal OTLP service method and HTTP endpoint constants (Sdk::Trace,Sdk::Logs,Sdk::Metricsnamespaces) — avoids empty placeholder files and provides real utility, mirroring the approach in #41011Exporters
- Moved OTLP trace exporter (gRPC + HTTP) to
exporters/otlp/underExporters::Otlpnamespace; original tracer headers retained as forwarding/compat headers- Added
exporters/otlp/environment.h/ccwithExporters::Otlp::GetUserAgent()— mirrorsGetOtlpDefaultUserAgent()from opentelemetry-cpp'sotlp_environment.h; used by both gRPC and HTTP exporters as it is an exporter identity concern, not HTTP-specificAttribute utilities (mirrors opentelemetry-cpp)
- Moved
populate_attribute_utils.h/cctoexporters/otlp/underExporters::Otlpnamespace — mirrorsOtlpPopulateAttributeUtilsfrom opentelemetry-cpp, which lives alongside the OTLP exporters- Renamed
getStringKeyValue()→makeKeyValue()otlp_utils.h/otlp_utils_libkept as backward-compatibility forwarding shims withusing OtlpUtils = PopulateAttributeUtils- Fixed
populateAnyValue()to handle all 17AttributeValuealternatives, including array types for bool/int/uint/int64/double/uint64/bytes (previously fell intoIS_ENVOY_BUG); uint64 values exceedingINT64_MAXare now clamped rather than silently wrapping to negativeCross-extension dependency fix
stat_sinks/open_telemetry/open_telemetry_http_impl.ccnow depends oncommon/opentelemetrydirectly instead ofaccess_loggers/open_telemetry- Updated
grpc_trace_exporter.cc,grpc_access_log_impl.cc, andopen_telemetry_impl.ccto consume the newsdk/{trace,logs,metrics}/constants.hrather than inline string literalsType safety & correctness
- Added
resource_spans_size()/scope_spans_size()guards inlogExportedSpans()to prevent out-of-bounds proto accessOtelAttributeschanged fromstd::maptoabsl::flat_hash_map; compile-timestatic_assertadded to testTests & docs
- Moved
populate_attribute_utils_test.cctotest/extensions/common/opentelemetry/exporters/otlp/to mirror source layout- Split tests into
ExporterEnvironmentTest+PopulateAttributeUtilsTest; renamed test cases to match new API names (MakeKeyValue,GetUserAgent)- Added
#include <type_traits>,#include "absl/strings/match.h"to tests- Updated
README.mdto document new API names and locations (PopulateAttributeUtilsinexporters/otlp/,Exporters::Otlp::GetUserAgent(),environment_lib, and the newsdk/{trace,logs,metrics}_constants_libtargets)- Updated changelog
Environment
Request variables
| Key | Value |
|---|---|
| ref | 1b0ef65 |
| sha | 7c85abe |
| pr | 44379 |
| base-sha | 5aeaf37 |
| actor | |
| message | Centralize shared OpenTelemetry code into source/extensions/common/opentelemetry/... |
| started | 1776142701.081967 |
| target-branch | main |
| trusted | false |
Build image
Container image/s (as used in this CI run)
| Key | Value |
|---|---|
| default | docker.io/envoyproxy/envoy-build:86873047235e9b8232df989a5999b9bebf9db69c |
| mobile | docker.io/envoyproxy/envoy-build:mobile-86873047235e9b8232df989a5999b9bebf9db69c |
Version
Envoy version (as used in this CI run)
| Key | Value |
|---|---|
| major | 1 |
| minor | 38 |
| patch | 0 |
| dev | true |
Loading