Skip to content

Commit 97f6dda

Browse files
committed
docs: update docs & task about launching otel viewers
1 parent edfdaf9 commit 97f6dda

File tree

4 files changed

+33
-53
lines changed

4 files changed

+33
-53
lines changed

.mise.toml

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,7 @@ wait_for = ["deny"]
4444

4545
[tasks.megalinter]
4646
description = "Run megalinter in container"
47-
run = '''
48-
#!/usr/bin/env bash
49-
if command -v podman > /dev/null; then
50-
podman run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8"
51-
elif command -v nerdctl > /dev/null; then
52-
nerdctl run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8"
53-
elif command -v docker > /dev/null; then
54-
docker run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8"
55-
else
56-
echo "Container runner not found: podman, nerdctl, or docker required"
57-
exit 1
58-
fi
59-
'''
47+
run = 'docker run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8"'
6048

6149
[tasks.test]
6250
description = "Launch tests"
@@ -125,39 +113,28 @@ hide = true
125113
description = "Install cargo-hack"
126114
run = 'cargo binstall -y cargo-hack || cargo install --locked cargo-hack'
127115

128-
# Container and example tasks
116+
117+
[tasks.run-otel-desktop-viewer]
118+
description = "Run otel-desktop-viewer as receiver and viewer of otel trace"
119+
run = [
120+
'# Viewer: open http://localhost:8000',
121+
'docker run -p 8000:8000 -p 4317:4317 -p 4318:4318 ghcr.io/ctrlspice/otel-desktop-viewer:latest-amd64',
122+
]
123+
129124
[tasks.run-jaeger]
130125
description = "Run Jaeger all-in-one container"
131-
run = '''
132-
#!/usr/bin/env bash
133-
134-
container_cmd=""
135-
if command -v podman > /dev/null; then
136-
container_cmd="podman"
137-
elif command -v nerdctl > /dev/null; then
138-
container_cmd="nerdctl"
139-
elif command -v docker > /dev/null; then
140-
container_cmd="docker"
141-
else
142-
echo "Container runner not found: podman, nerdctl, or docker required"
143-
exit 1
144-
fi
145-
146-
$container_cmd run --rm --name jaeger \
147-
-e COLLECTOR_ZIPKIN_HOST_PORT=9411 \
148-
-e COLLECTOR_OTLP_ENABLED=true \
149-
-p 6831:6831/udp \
150-
-p 6832:6832/udp \
151-
-p 5778:5778 \
152-
-p 16686:16686 \
153-
-p 4317:4317 \
154-
-p 4318:4318 \
155-
-p 14250:14250 \
156-
-p 14268:14268 \
157-
-p 14269:14269 \
158-
-p 9411:9411 \
159-
docker.io/jaegertracing/all-in-one:latest
160-
'''
126+
run = [
127+
"# Viewer: open http://localhost:16686",
128+
'''
129+
docker run --rm --name jaeger \
130+
-p 16686:16686 \
131+
-p 4317:4317 \
132+
-p 4318:4318 \
133+
-p 5778:5778 \
134+
-p 9411:9411 \
135+
cr.jaegertracing.io/jaegertracing/jaeger:latest
136+
'''
137+
]
161138

162139
[tasks.run-example-grpc-server]
163140
description = "Run gRPC server example"

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ A set of rust crates to help working with tracing + opentelemetry
1010

1111
To collect and visualize trace on local, some ofthe simplest solutions:
1212

13+
![screenshot](examples/axum-otlp/Screenshot-20251103_1308.jpg)
14+
1315
### Otel Desktop Viewer
1416

1517
[CtrlSpice/otel-desktop-viewer: desktop-collector](https://github.com/CtrlSpice/otel-desktop-viewer)
@@ -31,19 +33,12 @@ open http://localhost:8000
3133

3234
# docker/nerdctl/podman or any container runner
3335
docker run --rm --name jaeger \
34-
-e COLLECTOR_ZIPKIN_HOST_PORT:9411 \
35-
-e COLLECTOR_OTLP_ENABLED:true \
36-
-p 6831:6831/udp \
37-
-p 6832:6832/udp \
38-
-p 5778:5778 \
3936
-p 16686:16686 \
4037
-p 4317:4317 \
4138
-p 4318:4318 \
42-
-p 14250:14250 \
43-
-p 14268:14268 \
44-
-p 14269:14269 \
39+
-p 5778:5778 \
4540
-p 9411:9411 \
46-
jaegertracing/all-in-one:1.49
41+
cr.jaegertracing.io/jaegertracing/jaeger:latest
4742

4843
open http://localhost:16686
4944
```
51.3 KB
Loading

examples/axum-otlp/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@ async fn health() -> impl IntoResponse {
4646
#[tracing::instrument]
4747
async fn index() -> impl IntoResponse {
4848
tracing::info!(monotonic_counter.index = 1);
49+
sleep_10ms().await;
50+
sleep_10ms().await;
51+
sleep_10ms().await;
4952
let trace_id = find_current_trace_id();
5053
dbg!(&trace_id);
5154
//std::thread::sleep(std::time::Duration::from_secs(1));
5255
axum::Json(json!({ "my_trace_id": trace_id }))
5356
}
5457

58+
#[tracing::instrument]
59+
async fn sleep_10ms() {
60+
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
61+
}
62+
5563
async fn proxy_handler(Path((service, path)): Path<(String, String)>) -> impl IntoResponse {
5664
// Overwrite the otel.name of the span
5765
tracing::Span::current().record("otel.name", format!("proxy {service}"));

0 commit comments

Comments
 (0)