Description
Bug Report
Hi there. I am building a cli which may-or-may-not have opentelemetry enabled. We initialize tracing early on and conditionally enable opentelemetry based on some flags. We use reload layers starting with None
to allow enabling layers later on. Everything works, except context propagation. If the layer is not present when the registry is init'ed, WithContext
is not set up correctly meaning set_parent
and friends silently fails due to not being able to downcast the subscriber (L142).
tracing-opentelemetry/src/span_ext.rs
Lines 139 to 150 in 5e3354e
I can confirm this does not work as expected even if the reload layer is initialized with Some(T)
either. The layer does work if you use a Some(T) without the reload layer, however.
Version
│ │ │ │ └── tracing v0.1.37
│ │ │ │ ├── tracing-attributes v0.1.26 (proc-macro)
│ │ │ │ └── tracing-core v0.1.31
│ │ │ └── tracing v0.1.37 (*)
│ │ ├── tracing v0.1.37 (*)
│ │ └── tracing v0.1.37 (*)
│ │ │ └── tracing v0.1.37 (*)
│ │ ├── tracing v0.1.37 (*)
│ └── tracing v0.1.37 (*)
│ ├── tracing v0.1.37 (*)
│ ├── tracing v0.1.37 (*)
│ │ └── tracing v0.1.37 (*)
├── tracing v0.1.37 (*)
├── tracing-appender v0.2.2
│ └── tracing-subscriber v0.3.18
│ ├── tracing v0.1.37 (*)
│ ├── tracing-core v0.1.31 (*)
│ └── tracing-log v0.2.0
│ └── tracing-core v0.1.31 (*)
├── tracing-chrome v0.7.1
│ ├── tracing-core v0.1.31 (*)
│ └── tracing-subscriber v0.3.18 (*)
├── tracing-opentelemetry v0.23.0
│ ├── tracing v0.1.37 (*)
│ ├── tracing-core v0.1.31 (*)
│ ├── tracing-log v0.2.0 (*)
│ └── tracing-subscriber v0.3.18 (*)
├── tracing-subscriber v0.3.18 (*)
│ ├── tracing v0.1.37 (*)
│ │ ├── tracing v0.1.37 (*)
│ │ │ └── tracing v0.1.37 (*)
│ ├── tracing v0.1.37 (*)
│ │ ├── tracing v0.1.37 (*)
│ ├── tracing v0.1.37 (*)
│ ├── tracing v0.1.37 (*)
│ ├── tracing-test v0.2.4
│ │ ├── tracing-core v0.1.31 (*)
│ │ ├── tracing-subscriber v0.3.18 (*)
│ │ └── tracing-test-macro v0.2.4 (proc-macro)
│ │ ├── tracing v0.1.37 (*)
│ │ │ └── tracing v0.1.37 (*)
│ │ │ ├── tracing v0.1.37 (*)
│ │ │ ├── tracing v0.1.37 (*)
│ │ │ │ ├── tracing v0.1.37 (*)
├── tracing v0.1.37 (*)
├── tracing-test v0.2.4 (*)
Platform
macOS / Linux