feat(config): wire top-level attribute_limits into per-signal providers#5365
Open
ocelotl wants to merge 6 commits into
Open
feat(config): wire top-level attribute_limits into per-signal providers#5365ocelotl wants to merge 6 commits into
ocelotl wants to merge 6 commits into
Conversation
Parses config.attribute_limits in configure_sdk() and passes it as a global fallback to create_tracer_provider() and create_logger_provider(). Per-signal limits (tracer_provider.limits / logger_provider.limits) always take precedence; absent fields fall back to the global value, then to OTel spec defaults. For logs, adds log_record_limits to the LoggerProvider constructor, threads it through Logger, and applies it when constructing each ReadWriteLogRecord — mirroring how SpanLimits flows through TracerProvider.
herin049
approved these changes
Jun 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the OpenTelemetry SDK declarative configuration path to support top-level attribute_limits as a global fallback for traces and logs, and adds programmatic log_record_limits support to LoggerProvider so log attribute limits can be configured consistently with SpanLimits.
Changes:
- Thread
config.attribute_limitsthroughconfigure_sdk()intocreate_tracer_provider()/create_logger_provider()as a fallback when per-signal limits are absent. - Implement log-record limits creation in declarative config and pass the resulting
log_record_limitsintoLoggerProvider, propagating toLoggerandReadWriteLogRecord. - Update/expand configuration tests and add a changelog entry.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_sdk.py | Plumbs top-level attribute_limits into per-signal configurators. |
| opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_tracer_provider.py | Adds global fallback handling for span attribute limits in declarative config. |
| opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_logger_provider.py | Adds log-record limits handling and wires limits into LoggerProvider construction. |
| opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/init.py | Threads log_record_limits from provider → logger → emitted log records. |
| opentelemetry-sdk/tests/_configuration/test_sdk.py | Updates expectations for updated configurator call signatures. |
| opentelemetry-sdk/tests/_configuration/test_tracer_provider.py | Adds tests covering global fallback semantics for traces. |
| opentelemetry-sdk/tests/_configuration/test_logger_provider.py | Updates tests to validate log-record limits are applied (not just warned/ignored). |
| opentelemetry-sdk/src/opentelemetry/sdk/trace/export/init.py | Minor formatting-only change to console exporter default formatter. |
| .changelog/5365.added | Documents the new config wiring and LoggerProvider limits support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…kwarg order - _create_span_limits/_create_log_record_limits now pass SpanLimits.UNSET / LogRecordLimits.UNSET instead of None when the resolved attribute value length limit is absent, so OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT and OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT can no longer override a declarative-config-derived value - add LogRecordLimits.UNSET, mirroring SpanLimits.UNSET, to make this possible - reorder Logger/LoggerProvider keyword-only args so log_record_limits (public) comes before the private _logger_config/_logger_configurator args - extend env-var-bypass tests to cover the attribute length limit fields
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.
Closes #5357
Summary
config.attribute_limitsinconfigure_sdk()and passes it as a global fallback tocreate_tracer_provider()andcreate_logger_provider()tracer_provider.limits/logger_provider.limits) always take precedence; absent fields fall back to the global value, then to OTel spec defaultslog_record_limitsparameter toLoggerProvider, threads it throughLoggerdown to eachReadWriteLogRecord— mirroring howSpanLimitsflows throughTracerProviderTest plan
tests/_configuration/test_sdk.py— global limits passed to per-signal factoriestests/_configuration/test_tracer_provider.py— per-signal override, global fallback, spec defaultstests/_configuration/test_logger_provider.py— same coverage for logs; verifies limits are applied (not just warned about)tests/logs/— no regressions in existing log SDK tests