{"record":{"id":"d2d59a656c6eb023","repo":"vectordotdev/vector","slug":"unexpected-log","errorCode":null,"errorMessage":"unexpected log","messagePattern":"unexpected log","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/sinks/datadog/traces/sink.rs","lineNumber":51,"sourceCode":"    pub(crate) hostname: Option<String>,\n    pub(crate) agent_version: Option<String>,\n    // Those two last fields are configuration value and not a per-trace/span information, they come from the Datadog\n    // trace-agent config directly: https://github.com/DataDog/datadog-agent/blob/0f73a78/pkg/trace/config/config.go#L293-L294\n    pub(crate) target_tps: Option<i64>,\n    pub(crate) error_tps: Option<i64>,\n}\n\nimpl Partitioner for EventPartitioner {\n    type Item = Event;\n    type Key = PartitionKey;\n\n    fn partition(&self, item: &Self::Item) -> Self::Key {\n        match item {\n            Event::Metric(_) => {\n                panic!(\"unexpected metric\");\n            }\n            Event::Log(_) => {\n                panic!(\"unexpected log\");\n            }\n            Event::Trace(t) => PartitionKey {\n                api_key: item.metadata().datadog_api_key(),\n                env: t\n                    .get(event_path!(\"env\"))\n                    .map(|s| s.to_string_lossy().into_owned()),\n                hostname: log_schema().host_key().and_then(|key| {\n                    t.get((PathPrefix::Event, key))\n                        .map(|s| s.to_string_lossy().into_owned())\n                }),\n                agent_version: t\n                    .get(event_path!(\"agent_version\"))\n                    .map(|s| s.to_string_lossy().into_owned()),\n                target_tps: t\n                    .get(event_path!(\"target_tps\"))\n                    .and_then(|tps| tps.as_integer()),\n                error_tps: t\n                    .get(event_path!(\"error_tps\"))","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/datadog/traces/sink.rs#L33-L69","documentation":"The Datadog traces sink's partition function panicked because it received an Event::Log instead of the Event::Trace events it is designed to handle. The sink only supports trace events; any other event type reaching it indicates a topology wiring mistake where a log pipeline was routed into the traces sink. Vector panics deliberately because this is an unrecoverable misconfiguration of the internal event graph.","triggerScenarios":"Routing a logs source (or a transform emitting logs) into sinks.datadog.traces; a wildcard ('*') or catch-all output feeding the traces sink with mixed event types; a custom transform that does not filter non-trace events before the traces sink.","commonSituations":"Users configure datadog.traces alongside datadog.logs and accidentally point both at the same sink, or use a broad match like type='*'' in route outputs so logs land in the traces sink.","solutions":["Rewire the topology so only trace events flow into sinks.datadog.traces (fix the inputs list in config)","Insert a filter or route transform that drops non-trace events before the traces sink","If logs must also go to Datadog, add a separate datadog.logs sink and route logs to it"],"exampleFix":"// before\n[sinks.traces]\ntype = \"datadog_traces\"\ninputs = [\"all_events\"]\n\n// after\n[sinks.traces]\ntype = \"datadog_traces\"\ninputs = [\"route.trace_events\"]","handlingStrategy":"validation","validationCode":"// Ensure only trace events reach the sink\nfn assert_traces_only(events: &[Event]) -> Result<(), String> {\n    if events.iter().any(|e| !matches!(e, Event::Trace(_))) {\n        return Err(\"non-trace events routed to datadog_traces sink\".into());\n    }\n    Ok(())\n}","typeGuard":"fn is_trace(e: &Event) -> bool { matches!(e, Event::Trace(_)) }","tryCatchPattern":null,"preventionTips":["Never point sinks.datadog.traces at wildcard or mixed-event outputs","Route mixed streams through a route transform with a trace-only branch","Run vector validate before deploying topology changes"],"tags":["rust","vector","datadog","panic","topology"],"backgroundTag":"incompatible-source-type","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}