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
Copy file name to clipboardexpand all lines: docs/controllers/observability.md
+19-15
Original file line number
Diff line number
Diff line change
@@ -48,37 +48,40 @@ cargo add opentelemetry-otlp
48
48
49
49
!!! warning "Telemetry Dependencies"
50
50
51
-
This simple use of `cargo add` above assumes the above dependencies always work well at all given versions, but this is not always true. You might see multiple versions of `opentelemetry` libs / `tonic` in `cargo tree` (which might not work), and due to different release cycles and pins, you might not be able to upgrade opentelemetry dependencies immediately. For working combinations see for instance the [pins in controller-rs](https://github.com/kube-rs/controller-rs/blob/main/Cargo.toml) + [examples in tracing-opentelemetry](https://github.com/tokio-rs/tracing-opentelemetry/tree/v0.1.x/examples).
51
+
This simple use of `cargo add` above assumes the above dependencies may not always work well at latest versions. You might receive multiple versions of `opentelemetry` libs / `tonic` in `cargo tree` (which might not work), and due to different release cycles and pins, you might not be able to upgrade opentelemetry dependencies immediately. For working combinations see for instance the [pins in controller-rs](https://github.com/kube-rs/controller-rs/blob/main/Cargo.toml) + [examples in tracing-opentelemetry](https://github.com/tokio-rs/tracing-opentelemetry/tree/v0.1.x/examples).
52
52
53
53
Setting up the layer and configuring the `collector` follows fundamentally the same process:
However, tracing requires us to have a configurable location of **where to send spans**, the provders needs to be globally registered, and you likely want to set some resource attributes, so creating the actual `tracer` requires a bit more work:
which can be extended better using the [opentelemetry_semantic_conventions](https://docs.rs/opentelemetry-semantic-conventions/0.26.0/opentelemetry_semantic_conventions/resource/index.html).
104
107
105
-
### Instrumenting
108
+
For a full setup example for this code see [controller-rs/telemetry.rs](https://github.com/kube-rs/controller-rs/blob/main/src/telemetry.rs).
106
109
107
-
At this point, you can start adding `#[instrument]` attributes onto functions you want, in particular `reconcile`:
110
+
### Instrumenting
111
+
Once you have initialised your registry, you can start adding `#[instrument]` attributes onto functions you want. Let's do `reconcile`:
108
112
109
113
```rust
110
114
#[instrument(skip(ctx))]
@@ -126,7 +130,7 @@ To link logs and traces we take advantage that tracing data is being outputted t
0 commit comments