-
Notifications
You must be signed in to change notification settings - Fork 598
Add log appender for tracing #1085
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
Add log appender for tracing #1085
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1085 +/- ##
=======================================
- Coverage 50.7% 50.5% -0.3%
=======================================
Files 165 168 +3
Lines 19808 19893 +85
=======================================
+ Hits 10059 10061 +2
- Misses 9749 9832 +83
☔ View full report in Codecov by Sentry. |
| let layer = layer::OpenTelemetryTracingBridge::new(&provider); | ||
| tracing_subscriber::registry().with(layer).init(); | ||
|
|
||
| info!(fruit = "apple", price = 2.99, message = "hello from from price"); |
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.
From SIG meeting notes 05/30/2023:
[Aaron] qn. Why use tracing for logging at all?
log, slog, tracing (events API) - 3 populate logs.
tracing-otel already converts events into SpanEvents, so why is that no sufficient already, and why we need another "bridge" to convert to Logs.?
[Cijo]
- SpanEvents require Span, and Span's sampling affects SpanEvents.
- OTel has limits/throttle on the number of SpanEvents per Span
- SpanEvents are given to Exporters, only when the Span itself is ended/dropped, as opposed to Logs(events) being sent to Exporters immediately (depending on Export Processor.)
[Lalit]
tracing allows events to be created outside Span, but SpanEvents in OTel API does not allow it outside tracing API.
The log facade could be used for pure logging., but does not allow structured logs.
Tracing crate already has ability to emit Logs Always (need to explore - https://docs.rs/tracing/latest/tracing/#emitting-log-records)
event!(Level::TRACE, greeting = ?my_struct);
How do we user decide if this should go as span_event or log?
- We need to investigate/explore this more. (there may be "Filter" that can be leverages Metadata)
- We need end-user feedback.
Python
Log API
Otel Tracing API (Spans, SpanEvents)
Rust
Log Crate -- the answer is similar to Python/other languages
Tracing crate - that has "events" and "Span", so the distinction is not easy to make.
Otel Tracing API (Spans, SpanEvents)
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.
Tracing crate already has ability to emit Logs Always (need to explore - https://docs.rs/tracing/latest/tracing/#emitting-log-records)
You shouldn't enable this feature for opentelemetry-rust. it's meant for libraries like hyper or tokio to smoothly transition to tracing in a minor semver release, allowing users to not immediately lose logging when then update their dependencies.
How do we user decide if this should go as span_event or log? [...] We need to investigate/explore this more. (there may be "Filter" that can be leverages Metadata)
Using dynamic_filter_fn is an option, but be sure to benchmark this since it might be a little too costly. We can always improve it on the tracing side of things though, especially since there is some low-hanging, performance-related fruit in tracing-subscriber that we've been meaning to improve. Y'all saying that it's a little too slow would sufficient for me to justify the positive impact of me working on fixing it.
|
Moving over here from the Discord discussion @djc and I started.
This would not work properly with our use case. So for now, it would be sufficient for us to be able to just emit all But for an overall better usability of One way to route them would be to add another special field. I also like the idea to utilize the Layer system of I also would like to keep the current behavior of marking a span as failed if an error event was emitted inside the span. |
|
@djc @jtescher @davidbarsky @valkum I marked this PR as non-draft, to unblock progress. Once we release Log Bridge API/SDK, this will be moved to tracing-opentelemetry repo (with some configs to let user decide how to export events). We can continue the discussion about how exactly that config looks like in tracing-opentelemetry repo. I'll need some helps there, will open an issue there. For now, this PR (and follow ups here), can help validate the Log Bridge API/SDK., help test its perf etc. |
|
@open-telemetry/rust-approvers Could you help review? |
Opening a PR here to get the initial appender working. Once this repo releases a new api/sdk, this can be shifted to the tracing-opentelemetry repo. Starting here temporarily, as releasing from this repo (+ updating tracing-opentelemetry to pick up the new release) need some time (especially since Metrics has breaking changes). This will allow us to continue polishing the log bridge api/sdk.
Changes
Adds log-appender for the tracing crate, which converts the Events from tracing into LogRecords.
Adds basic example
Add a stress test for testing logs. (Primarily using this to test what is the overhead introduced by OpenTelemetry, so OTel API/SDK log bridge can be optimized before release).
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes