Skip to content

[CONFIGURATION] Apply general attribute_limits to tracer and logger providers - #4468

Open
ayush-singh-0601 wants to merge 1 commit into
open-telemetry:mainfrom
ayush-singh-0601:config-general-attribute-limits
Open

[CONFIGURATION] Apply general attribute_limits to tracer and logger providers#4468
ayush-singh-0601 wants to merge 1 commit into
open-telemetry:mainfrom
ayush-singh-0601:config-general-attribute-limits

Conversation

@ayush-singh-0601

Copy link
Copy Markdown

Fixes #4467

The YAML parser already accepted attribute_limits, but SdkBuilder logged a warning and ignored them. Per the spec, general attribute limits should apply when tracer/logger limits are not set, and model-specific limits should win when they are.

Changes

  • Pass attribute_limits from CreateConfiguredSdk into CreateTracerProvider and CreateLoggerProvider.
  • If a provider has no limits, copy attribute_count_limit and attribute_value_length_limit from the general config into SpanLimits / LogRecordLimits.
  • If a provider does have limits, keep using those values (including span-only fields such as event/link limits).
  • Existing two-argument CreateTracerProvider / CreateLoggerProvider overloads are unchanged; a three-argument overload takes the general limits so the previous ABI is preserved.
  • Unit tests cover general limits, provider override, and CreateConfiguredSdk wiring for both traces and logs.

How changes were tested

  • Added SdkBuilder.SpanLimitsFromAttributeLimits and SdkBuilder.SpanLimitsOverrideAttributeLimits.
  • Added programmatic tests that emit log records through a recording exporter and that read GetSpanLimits() on the configured tracer provider.

I could not run the C++ test binaries in this environment (no local CMake/Bazel build of opentelemetry-cpp). CI should run sdk_builder_test and programmatic_configuration_test.

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

…roviders

The YAML parser already accepted attribute_limits, but SdkBuilder
ignored them. Pass the general limits into CreateTracerProvider and
CreateLoggerProvider, and use them when the provider has no
model-specific limits. Provider limits still take precedence.

Fixes open-telemetry#4467
@ayush-singh-0601
ayush-singh-0601 requested a review from a team as a code owner August 21, 2026 15:30
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.64%. Comparing base (68a575f) to head (c82730a).

Files with missing lines Patch % Lines
sdk/src/configuration/sdk_builder.cc 92.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4468      +/-   ##
==========================================
+ Coverage   82.62%   82.64%   +0.02%     
==========================================
  Files         512      512              
  Lines       20139    20160      +21     
==========================================
+ Hits        16638    16659      +21     
  Misses       3501     3501              
Files with missing lines Coverage Δ
...lude/opentelemetry/sdk/configuration/sdk_builder.h 100.00% <ø> (ø)
sdk/src/configuration/sdk_builder.cc 61.64% <92.00%> (+0.54%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CONFIGURATION] General attribute limits

1 participant