Improve Doc to Make the Tracing Context Example #575#583
Improve Doc to Make the Tracing Context Example #575#583artsiomkaltovich wants to merge 5 commits intometrics-rs:mainfrom
Conversation
99380f8 to
71f9bf2
Compare
tobz
left a comment
There was a problem hiding this comment.
Currently, these changes don't actually compile when trying to run the doctests.
You'll need to add some of these dependencies to [dev-dependencies] and potentially update the enabled feature flags for some of the existing dev dependencies.
You can run cargo test -p metrics-tracing-context --doc locally to execute the tests while fixing the dependencies to ensure they're passing before requesting another review.
metrics-tracing-context/src/lib.rs
Outdated
| //! use metrics_tracing_context::MetricsLayer; | ||
| //! use metrics_tracing_context::TracingContextLayer; |
There was a problem hiding this comment.
| //! use metrics_tracing_context::MetricsLayer; | |
| //! use metrics_tracing_context::TracingContextLayer; | |
| //! use metrics_tracing_context::{MetricsLayer, TracingContextLayer}; |
There was a problem hiding this comment.
Hello @tobz.
I will fix the ci, if other changes are ok.
There was a problem hiding this comment.
I've added dependencies, but I still got the following error:
---- metrics-tracing-context/src/lib.rs - (line 11) stdout ----
error[E0277]: the trait bound `PrometheusRecorder: Recorder` is not satisfied
--> metrics-tracing-context/src/lib.rs:32:30
|
24 | metrics::set_global_recorder(recorder).unwrap();
| ---------------------------- ^^^^^^^^ the trait `Recorder` is not implemented for `PrometheusRecorder`
I've failed to understand why as Recorder as implemented for PrometheusRecorder and all dependencies seems up to date.
metrics-tracing-context/Cargo.toml
Outdated
| tracing-subscriber = { workspace = true, features = ["registry"] } | ||
| tracing-subscriber = { workspace = true, features = ["registry", "fmt"] } | ||
| tokio = { workspace = true } | ||
| metrics-exporter-prometheus = { version = "0.17.0", features = ["http-listener", "hyper", "hyper-util"] } |
There was a problem hiding this comment.
This probably needs to be a path dependency (see metrics-util above).
There was a problem hiding this comment.
Yes, it is. I can't get why :)
Thank you.
Improve Doc to Make the Tracing Context Example ready to use out of the Box.
Please refer to issue #575