Skip to content

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

Open
ayush-singh-0601 wants to merge 5 commits 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 5 commits into
open-telemetry:mainfrom
ayush-singh-0601:config-general-attribute-limits

Conversation

@ayush-singh-0601

@ayush-singh-0601 ayush-singh-0601 commented Aug 21, 2026

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).
  • CreateTracerProvider and CreateLoggerProvider take an optional AttributeLimitsConfiguration* that defaults to nullptr.
  • 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 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.69%. Comparing base (1c2b007) to head (a1556d4).

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4468      +/-   ##
==========================================
+ Coverage   82.67%   82.69%   +0.02%     
==========================================
  Files         516      516              
  Lines       20197    20214      +17     
==========================================
+ Hits        16696    16713      +17     
  Misses       3501     3501              
Files with missing lines Coverage Δ
...lude/opentelemetry/sdk/configuration/sdk_builder.h 100.00% <ø> (ø)
sdk/src/configuration/sdk_builder.cc 61.75% <95.24%> (+0.57%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ayush-singh-0601

Copy link
Copy Markdown
Author

can you please any changes that i need to make or is it fine

@ayush-singh-0601

Copy link
Copy Markdown
Author

all checks are passed , please tell if any more changes needed

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Requesting a minor change noted below.

Comment thread sdk/include/opentelemetry/sdk/configuration/sdk_builder.h
@ayush-singh-0601

Copy link
Copy Markdown
Author

@dbarker done

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

2 participants