https://github.com/ttys3/rust-otel-tracing-demo
https://github.com/ttys3/rust-otel-tracing-demo
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ttys3/rust-otel-tracing-demo
- Owner: ttys3
- Created: 2021-12-13T12:40:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-20T10:56:41.000Z (over 2 years ago)
- Last Synced: 2025-03-10T20:42:10.766Z (over 1 year ago)
- Language: Rust
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust tracing demo
1. use format layer to display tracing as logs to stdout instead of a standalone trace pipline from `opentelemetry::sdk::export::trace::stdout`
2. `tracing_subscriber::fmt::init()` will set the global subscriber and global logger, in most cases you should avoid using it.
3. `env_logger::init()` will logging in **UTC** timezone, to use **localtime**, you need build your own `Logger`.
4. `tracing_subscriber::fmt::layer().with_timer(fmt::time::LocalTime::rfc_3339())` will not work
and the log will **disappear** if you do not build with `RUSTFLAGS="--cfg unsound_local_offset"`
5. `SubscriberInitExt::init()` will set global default subscriber and init `tracing-log` (also init default `Logger`)
https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/index.html#runtime-configuration-with-layers
https://docs.rs/tracing-subscriber/latest/tracing_subscriber/util/trait.SubscriberInitExt.html#method.init
https://github.com/open-telemetry/opentelemetry-rust
https://crates.io/crates/opentelemetry
common exporters:
```
opentelemetry-jaeger
opentelemetry-otlp
opentelemetry-prometheus
opentelemetry-zipkin
```
https://www.jaegertracing.io/docs/1.28/getting-started/#all-in-one
```shell
# replace podman with docker if you are using docker
podman run --name jaeger -d -p6831:6831/udp -p6832:6832/udp -p14268:14268 -p16686:16686 jaegertracing/all-in-one:latest
xdg-open http://localhost:16686/
```