Centralize shared OpenTelemetry code into source/extensions/common/opentelemetry/#44379
Open
mmorel-35 wants to merge 2 commits intoenvoyproxy:mainfrom
Open
Centralize shared OpenTelemetry code into source/extensions/common/opentelemetry/#44379mmorel-35 wants to merge 2 commits intoenvoyproxy:mainfrom
source/extensions/common/opentelemetry/#44379mmorel-35 wants to merge 2 commits intoenvoyproxy:mainfrom
Conversation
source/extensions/common/opentelemetry/
Contributor
Author
|
/cc @kyessenov It's based on #41011 , hopefully the comments you've already provided are addressed there. |
b732d1b to
b7e8cc7
Compare
…pentelemetry/` Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com> fix: correct clang-format issues and add opentelemetry changelog entry
b7e8cc7 to
e6ab146
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
sdk/common/types.hwith a sharedAttributeValuevariant type (Sdk::Commonnamespace) and#include <cstdint>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 Centralize OpenTelemetry Constants and Helpers in source/extensions/common/opentelemetry #41011Exporters
exporters/otlp/underExporters::Otlpnamespace; original tracer headers retained as forwarding/compat headersexporters/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)
populate_attribute_utils.h/cctoexporters/otlp/underExporters::Otlpnamespace — mirrorsOtlpPopulateAttributeUtilsfrom opentelemetry-cpp, which lives alongside the OTLP exportersgetStringKeyValue()→makeKeyValue()otlp_utils.h/otlp_utils_libkept as backward-compatibility forwarding shims withusing OtlpUtils = PopulateAttributeUtilspopulateAnyValue()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_telemetrygrpc_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
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
populate_attribute_utils_test.cctotest/extensions/common/opentelemetry/exporters/otlp/to mirror source layoutExporterEnvironmentTest+PopulateAttributeUtilsTest; renamed test cases to match new API names (MakeKeyValue,GetUserAgent)#include <type_traits>,#include "absl/strings/match.h"to testsREADME.mdto document new API names and locations (PopulateAttributeUtilsinexporters/otlp/,Exporters::Otlp::GetUserAgent(),environment_lib, and the newsdk/{trace,logs,metrics}_constants_libtargets)