{"record":{"id":"a76589b1360fa4cb","repo":"linera-io/linera-protocol","slug":"benchmark-requires-the-opentelemetry-feature-to","errorCode":null,"errorMessage":"Benchmark requires the 'opentelemetry' feature to be enabled. Run with: cargo run --features opentelemetry --bin linera -- benchmark ...","messagePattern":"Benchmark requires the 'opentelemetry' feature to be enabled\\. Run with: cargo run --features opentelemetry --bin linera -- benchmark \\.\\.\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/main.rs","lineNumber":795,"sourceCode":"                context.wallet().save()?;\n\n                let time_total = time_start.elapsed();\n                info!(\n                    \"Revoking committees confirmed after {} ms\",\n                    time_total.as_millis()\n                );\n            }\n\n            #[cfg_attr(\n                not(feature = \"opentelemetry\"),\n                allow(unreachable_code, unused_variables)\n            )]\n            Benchmark(benchmark_command) => {\n                // Require opentelemetry feature for benchmarks to ensure traffic is properly\n                // labeled as synthetic. Without this, benchmark traffic would be mislabeled\n                // as \"organic\" and corrupt production metrics.\n                #[cfg(not(feature = \"opentelemetry\"))]\n                anyhow::bail!(\n                    \"Benchmark requires the 'opentelemetry' feature to be enabled. \\\n                     Run with: cargo run --features opentelemetry --bin linera -- benchmark ...\"\n                );\n\n                // Mark all benchmark traffic as synthetic for observability filtering.\n                std::env::set_var(\"LINERA_TRAFFIC_TYPE\", \"synthetic\");\n\n                match benchmark_command {\n                    BenchmarkCommand::Single {\n                        options: benchmark_options,\n                    } => {\n                        let BenchmarkOptions {\n                            num_chains,\n                            tokens_per_chain,\n                            transactions_per_block,\n                            fungible_application_id,\n                            bps,\n                            close_chains,","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/main.rs#L777-L813","documentation":"Thrown by the `linera benchmark` command when the binary was compiled without the `opentelemetry` Cargo feature. The gate exists so benchmark traffic is always labeled synthetic (the feature branch sets LINERA_TRAFFIC_TYPE=synthetic for OpenTelemetry labeling); without it, synthetic benchmark traffic would be counted as organic and corrupt production metrics. The bail fires under `#[cfg(not(feature = \"opentelemetry\"))]` before any benchmark work starts.","triggerScenarios":"Running `cargo run --bin linera -- benchmark ...` (or any benchmark invocation on a build that omitted the feature). The cfg-gated branch in the Benchmark command handler at linera-service/src/cli/main.rs:795 triggers immediately on command dispatch.","commonSituations":"Developer rebuilds the CLI with a default/minimal feature set and re-runs a benchmark that worked on a feature-enabled build; distributed release binaries built without the feature; CI scripts or aliases that drop the `--features opentelemetry` flag.","solutions":["Re-run with the feature enabled: `cargo run --features opentelemetry --bin linera -- benchmark ...`","For an installed binary, rebuild it with the feature: `cargo install --features opentelemetry linera-service`","If benchmarks are routine in your workflow, enable the feature permanently in `.cargo/config.toml` or workspace default features"],"exampleFix":"# before\ncargo run --bin linera -- benchmark --chains e476187f6ddfeb040... \n\n# after\ncargo run --features opentelemetry --bin linera -- benchmark --chains e476187f6ddfeb040...","handlingStrategy":"validation","validationCode":"# fail fast before launching a benchmark\nif ! cargo tree -f \"{f}\" -e features --bin linera 2>/dev/null | grep -qw opentelemetry; then\n  echo \"linera build lacks 'opentelemetry'; rebuild with --features opentelemetry\" >&2\n  exit 1\nfi\ncargo run --features opentelemetry --bin linera -- benchmark ...","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Encode the feature flag in the script/alias you use for benchmarks so it is never omitted","Pin the invocation in CI as `cargo run --features opentelemetry --bin linera -- benchmark ...`","Treat 'Benchmark requires the opentelemetry feature' as a build-configuration error, not a runtime failure — fix the build, not the call site"],"tags":["benchmark","cargo-features","linera-cli","opentelemetry"],"backgroundTag":"missing-compile-feature","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}