-
Notifications
You must be signed in to change notification settings - Fork 924
feat(config): wire top-level attribute_limits into per-signal providers #5365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ocelotl
wants to merge
4
commits into
open-telemetry:main
Choose a base branch
from
ocelotl:diego/config-attribute-limits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0948391
feat(config): wire top-level attribute_limits into per-signal providers
ocelotl 2669730
fix(lint): move AttributeLimits import to top level, apply ruff format
ocelotl 9e6b9b0
chore: add changelog fragment for #5365
ocelotl 1f0393f
Fix ruff
ocelotl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| `opentelemetry-sdk`: wire top-level `attribute_limits` into per-signal providers via declarative config; add `log_record_limits` support to `LoggerProvider` |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,11 +295,13 @@ def _from_api_log_record( | |
| record: LogRecord, | ||
| resource: Resource, | ||
| instrumentation_scope: InstrumentationScope | None = None, | ||
| limits: LogRecordLimits | None = None, | ||
| ) -> ReadWriteLogRecord: | ||
| return cls( | ||
| log_record=record, | ||
| resource=resource, | ||
| instrumentation_scope=instrumentation_scope, | ||
| **({} if limits is None else {"limits": limits}), | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -671,6 +673,7 @@ def __init__( | |
| *, | ||
| logger_metrics: LoggerMetricsT, | ||
| _logger_config: _LoggerConfig, | ||
| log_record_limits: LogRecordLimits | None = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise here. |
||
| ): | ||
| super().__init__( | ||
| instrumentation_scope.name, | ||
|
|
@@ -683,6 +686,7 @@ def __init__( | |
| self._instrumentation_scope = instrumentation_scope | ||
| self._logger_metrics = logger_metrics | ||
| self._logger_config = _logger_config | ||
| self._log_record_limits = log_record_limits or LogRecordLimits() | ||
|
|
||
| def _is_enabled(self) -> bool: | ||
| return self._logger_config.is_enabled | ||
|
|
@@ -728,6 +732,7 @@ def emit( | |
| record=record, | ||
| resource=self._resource, | ||
| instrumentation_scope=self._instrumentation_scope, | ||
| limits=self._log_record_limits, | ||
| ) | ||
| else: | ||
| _set_log_record_exception_attributes(record.log_record) | ||
|
|
@@ -750,6 +755,7 @@ def emit( | |
| record=log_record, | ||
| resource=self._resource, | ||
| instrumentation_scope=self._instrumentation_scope, | ||
| limits=self._log_record_limits, | ||
| ) | ||
|
|
||
| self._logger_metrics.emit_log() | ||
|
|
@@ -783,6 +789,7 @@ def __init__( | |
| *, | ||
| meter_provider: MeterProvider | None = None, | ||
| _logger_configurator: _LoggerConfiguratorT | None = None, | ||
| log_record_limits: LogRecordLimits | None = None, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small nit, but I'd prefer moving public keyword arguments before private ones for readability. |
||
| ): | ||
| if resource is None: | ||
| self._resource = Resource.create({}) | ||
|
|
@@ -802,6 +809,7 @@ def __init__( | |
| self._logger_configurator = ( | ||
| _logger_configurator or _default_logger_configurator | ||
| ) | ||
| self._log_record_limits = log_record_limits or LogRecordLimits() | ||
| self._at_exit_handler = None | ||
| if shutdown_on_exit: | ||
| self._at_exit_handler = atexit.register(self.shutdown) | ||
|
|
@@ -829,6 +837,7 @@ def _get_logger_no_cache( | |
| scope, | ||
| logger_metrics=self._logger_metrics, | ||
| _logger_config=self._apply_logger_configurator(scope), | ||
| log_record_limits=self._log_record_limits, | ||
| ) | ||
|
|
||
| def _get_logger_cached( | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this be handled already by the
LogRecordLimitsconstructor?