Closed merc1031 closed 1 month ago
cargo tree | grep tracing │ │ └── tracing v0.1.40 │ │ ├── tracing-attributes v0.1.27 (proc-macro) │ │ └── tracing-core v0.1.32 │ │ │ │ └── tracing v0.1.40 (*) │ │ │ └── tracing v0.1.40 (*) │ │ │ └── tracing v0.1.40 (*) │ │ └── tracing v0.1.40 (*) │ └── tracing v0.1.40 (*) ├── axum-tracing-opentelemetry v0.18.0 │ ├── tracing v0.1.40 (*) │ ├── tracing-opentelemetry v0.23.0 │ │ ├── tracing v0.1.40 (*) │ │ ├── tracing-core v0.1.32 (*) │ │ ├── tracing-log v0.2.0 │ │ │ └── tracing-core v0.1.32 (*) │ │ └── tracing-subscriber v0.3.18 │ │ ├── tracing v0.1.40 (*) │ │ ├── tracing-core v0.1.32 (*) │ │ ├── tracing-log v0.2.0 (*) │ │ ├── tracing-serde v0.1.3 │ │ │ ├── tracing-core v0.1.32 (*) │ └── tracing-opentelemetry-instrumentation-sdk v0.18.0 │ ├── tracing v0.1.40 (*) │ └── tracing-opentelemetry v0.23.0 (*) │ │ │ └── tracing v0.1.40 (*) │ │ │ ├── tracing v0.1.40 (*) │ │ ├── tracing v0.1.40 (*) │ ├── tracing v0.1.40 (*) │ ├── tracing v0.1.40 (*) │ │ │ ├── tracing v0.1.40 (*) │ │ │ └── tracing v0.1.40 (*) │ ├── tracing v0.1.40 (*) │ ├── tracing-core v0.1.32 (*) │ ├── tracing-ecs v0.4.0 │ │ ├── tracing v0.1.40 (*) │ │ ├── tracing-core v0.1.32 (*) │ │ ├── tracing-log v0.2.0 (*) │ │ └── tracing-subscriber v0.3.18 (*) │ ├── tracing-elastic-apm v3.2.3 (https://github.com/merc1031/tracing-elastic-apm.git?rev=bd8cc1f9de82915c888bfd33460dc2a9e766d902#bd8cc1f9) │ │ ├── tracing v0.1.40 (*) │ │ ├── tracing-subscriber v0.3.18 (*) │ ├── tracing-subscriber v0.3.18 (*) ├── tracing v0.1.40 (*) ├── tracing-core v0.1.32 (*) ├── tracing-ecs v0.4.0 (*) ├── tracing-elastic-apm v3.2.3 (https://github.com/merc1031/tracing-elastic-apm.git?rev=bd8cc1f9de82915c888bfd33460dc2a9e766d902#bd8cc1f9) (*) ├── tracing-subscriber v0.3.18 (*)
uname -a Linux lloucas-ThinkPad-T15-Gen-2i 6.2.0-39-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:18:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
I expected to be able to use a constant in the fields portion of the instrument macro.
fields
instrument
I wrote the following expecting it to work like info_span!({OUTCOME} = "success"); (which does work)
info_span!({OUTCOME} = "success");
pub const OUTCOME: &str = "outcome"; #[instrument(fields({OUTCOME} = "success"))] fn name() {
However it doesnt compile. Am I misunderstanding?
This was a missing feature and fixed by #2941.
Bug Report
Version
Platform
Description
I expected to be able to use a constant in the
fields
portion of theinstrument
macro.I wrote the following expecting it to work like
info_span!({OUTCOME} = "success");
(which does work)However it doesnt compile. Am I misunderstanding?