-
Notifications
You must be signed in to change notification settings - Fork 532
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
feat(logs): Make the logging
integration send Sentry logs
#4143
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #4143 +/- ##
==========================================
- Coverage 79.56% 79.49% -0.08%
==========================================
Files 141 141
Lines 15736 15784 +48
Branches 2675 2694 +19
==========================================
+ Hits 12520 12547 +27
- Misses 2369 2377 +8
- Partials 847 860 +13
|
logging
integration send Sentry logs
045fa2a
to
42c3835
Compare
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.
All in all looks good. I have some questions
} # type: Log | ||
propagation_context = scope.get_active_propagation_context() | ||
if propagation_context is not None: | ||
headers["trace_id"] = propagation_context.trace_id |
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.
I think the trace_id
should go into headers["trace"]["trace_id"]
(the trace
envelope header contains the DynamicSamplingContext of an event. See: https://github.com/getsentry/relay/blob/master/relay-server/src/envelope.rs#L1085)
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.
Also see here for the Dynamic Sampling Context (aka DSC) spec: https://develop.sentry.dev/sdk/telemetry/traces/dynamic-sampling-context/#dsc-specification
|
||
if level is not None: | ||
self._breadcrumb_handler = BreadcrumbHandler(level=level) | ||
self._sentry_logs_handler = SentryLogsHandler(level=level) |
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.
Should we have a separate sentry_logs_level
config option to specify what levels will be emitted as Sentry logs?
|
||
if level is not None: | ||
self._breadcrumb_handler = BreadcrumbHandler(level=level) | ||
self._sentry_logs_handler = SentryLogsHandler(level=level) |
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.
Lets just attach this handler if Sentry logs is enabled. This safes us some CPU cycles every time a log statement is called:
self._sentry_logs_handler = SentryLogsHandler(level=level) | |
client = sentry_sdk.get_client() | |
if client.options["_experiments"].get("enable_sentry_logs", False): | |
self._sentry_logs_handler = SentryLogsHandler(level=level) |
We have integrations that make the python logger create breadcrumbs and issues. This adds a third handler which creates Sentry logs on
logger.log
statements.Enable the logger with:
Refs #4150