Skip to content

Commit 2a60f21

Browse files
committed
fix(docs): build of sample & add screenshot for log
1 parent 2c9f520 commit 2a60f21

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

96.6 KB
Loading

init-tracing-opentelemetry/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
281281
Log export can be toggled at runtime via `.with_logs(bool)`:
282282

283283
```rust,no_run
284+
use init_tracing_opentelemetry::TracingConfig;
285+
//...
284286
TracingConfig::default()
285287
.with_logs(false) // disable log export (default: enabled when feature is active)
286-
.init_subscriber()?;
288+
.init_subscriber()
289+
.expect("valid tracing configuration");
287290
```
291+
> Traces are automatically attached to logs as well, so if the logs are queried in Grafana (for example), the trace automatically links to the log line.
292+
293+
![screenshot of grafana logs](https://raw.githubusercontent.com/davidB/tracing-opentelemetry-instrumentation-sdk/refs/heads/main/examples/logging/screenshot_grafana.png)
288294

289295
Configure the following environment variables to control the logs exporter (in addition to the shared variables above):
290296

0 commit comments

Comments
 (0)