Skip to content

Commit 4ebc3e1

Browse files
authored
fix(loki sink, observability): Drop non-fatal template render errors to warnings (#17746)
If a render error doesn't result in a dropped event, it seems more like a warning than an error. For the places that currently emit template errors with `drop_event: false`: * `loki` sink: skips inserting label if key or value fails to render; falls back to `None` for partitioning using `tenant_id` * `throttle` transform: falls back to `None` for throttle key * `log_to_metric` transform: skips tag addition * `papertrail` sink: falls back to `vector` for the `process` field * `splunk_hec_logs` sink: falls back to `None` for partition keys (source, sourcetype, index) * `splunk_hec_metrics` sink: falls back to `None` for source, sourcetype, index Fixes: #17487 Signed-off-by: Jesse Szwedko <[email protected]> Signed-off-by: Jesse Szwedko <[email protected]>
1 parent 92a36e0 commit 4ebc3e1

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/internal_events/template.rs

+21-13
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,33 @@ impl<'a> InternalEvent for TemplateRenderingError<'a> {
1919
}
2020
msg.push('.');
2121

22-
error!(
23-
message = %msg,
24-
error = %self.error,
25-
error_type = error_type::TEMPLATE_FAILED,
26-
stage = error_stage::PROCESSING,
27-
internal_log_rate_limit = true,
28-
);
22+
if self.drop_event {
23+
error!(
24+
message = %msg,
25+
error = %self.error,
26+
error_type = error_type::TEMPLATE_FAILED,
27+
stage = error_stage::PROCESSING,
28+
internal_log_rate_limit = true,
29+
);
2930

30-
counter!(
31-
"component_errors_total", 1,
32-
"error_type" => error_type::TEMPLATE_FAILED,
33-
"stage" => error_stage::PROCESSING,
34-
);
31+
counter!(
32+
"component_errors_total", 1,
33+
"error_type" => error_type::TEMPLATE_FAILED,
34+
"stage" => error_stage::PROCESSING,
35+
);
3536

36-
if self.drop_event {
3737
emit!(ComponentEventsDropped::<UNINTENTIONAL> {
3838
count: 1,
3939
reason: "Failed to render template.",
4040
});
41+
} else {
42+
warn!(
43+
message = %msg,
44+
error = %self.error,
45+
error_type = error_type::TEMPLATE_FAILED,
46+
stage = error_stage::PROCESSING,
47+
internal_log_rate_limit = true,
48+
);
4149
}
4250
}
4351
}

0 commit comments

Comments
 (0)