ref: Make logs, metrics go via scope #5213
Draft
+163
−144
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.
Description
Logs and metrics were going through a completely separate pipeline compared to other events.
Conceptually, they're still different from regular events since they're more lightweight and attribute-based (no data, contexts, etc., everything is an attribute) so separate handling makes sense. However, the pipeline should still conceptually resemble the one we use for other event types, for consistency.
Current pipeline for non-log, non-metric events
scope.capture_XXX. This merges the current scope stack and callsclient.capture_XXXwith the resulting merged scope.client.capture_XXXcontains virtually all of the logic, most notably:scope.apply_to_event, populating contexts, user data, etc.This PR
client.capture_XXX, we callscope.capture_XXX, like we do for other event types, and then callclient.capture_XXXfrom there.client.capture_XXXnow calls a newscope.apply_to_telemetryfunction internally (akin toscope.apply_to_event, but sets attributes instead).Note: This is just a first PR, I will refactor further.
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)