You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `init_subscribers` function returns a `OtelGuard` instance. Following the guard pattern, this struct provides no functions but, when dropped, ensures that any pending traces/metrics are sent before it exits. The syntax `let _guard` is suggested to ensure that Rust does not drop the struct until the application exits.
36
+
The `init_subscriber()` function returns an `OtelGuard` instance. Following the guard pattern, this struct provides no functions but, when dropped, ensures that any pending traces/metrics are sent before it exits. The syntax `let _guard` is suggested to ensure that Rust does not drop the struct until the application exits.
37
+
38
+
## Configuration Options
39
+
40
+
### Presets
41
+
42
+
-`TracingConfig::development()` - Pretty format, stderr, with debug info
43
+
-`TracingConfig::production()` - JSON format, stdout, minimal metadata
44
+
-`TracingConfig::debug()` - Full verbosity with all span events
45
+
-`TracingConfig::minimal()` - Compact format, no OpenTelemetry
46
+
-`TracingConfig::testing()` - Minimal output for tests
47
+
48
+
### Custom Configuration
49
+
50
+
```rust,no_run
51
+
use init_tracing_opentelemetry::TracingConfig;
52
+
53
+
TracingConfig::default()
54
+
.with_pretty_format() // or .with_json_format(), .with_compact_format()
55
+
.with_stderr() // or .with_stdout(), .with_file(path)
To configure opentelemetry tracer & tracing (& metrics), you can use the functions from `init_tracing_opentelemetry::tracing_subscriber_ext`, but they are very opinionated (and WIP to make them more customizable and friendly), so we recommend making your composition, but look at the code (to avoid some issue) and share your feedback.
66
+
For backward compatibility, the old API is still available:
0 commit comments