Skip to content

Commit

Permalink
cleanup and make checks happy
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz committed May 30, 2023
1 parent 1ae8407 commit 40ce049
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
28 changes: 24 additions & 4 deletions src/internal_events/loki.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
use crate::emit;
use metrics::counter;
use vector_common::internal_event::error_stage;
use vector_common::internal_event::{error_stage, error_type};
use vector_core::internal_event::{ComponentEventsDropped, InternalEvent, INTENTIONAL};

#[derive(Debug)]
pub struct LokiEventUnlabeledError;

impl InternalEvent for LokiEventUnlabeledError {
fn emit(self) {
error!(
message = "Event had no labels. Adding default `agent` label.",
error_code = "unlabeled_event",
error_type = error_type::CONDITION_FAILED,
stage = error_stage::PROCESSING,
internal_log_rate_limit = true,
);

counter!(
"component_errors_total", 1,
"error_type" => "unlabeled_event",
"error_code" => "unlabeled_event",
"error_type" => error_type::CONDITION_FAILED,
"stage" => error_stage::PROCESSING,
);
}
Expand All @@ -23,14 +32,25 @@ pub struct LokiOutOfOrderEventDroppedError {

impl InternalEvent for LokiOutOfOrderEventDroppedError {
fn emit(self) {
let reason = "Dropping out-of-order event(s).";

error!(
message = reason,
error_code = "out_of_order",
error_type = error_type::CONDITION_FAILED,
stage = error_stage::PROCESSING,
internal_log_rate_limit = true,
);

emit!(ComponentEventsDropped::<INTENTIONAL> {
count: self.count,
reason: "out_of_order",
reason,
});

counter!(
"component_errors_total", 1,
"error_type" => "out_of_order",
"error_code" => "out_of_order",
"error_type" => error_type::CONDITION_FAILED,
"stage" => error_stage::PROCESSING,
);
}
Expand Down
25 changes: 10 additions & 15 deletions website/content/en/highlights/2023-07-05-0-31-0-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ We cover them below to help you upgrade quickly:
#### Removal of various deprecated internal metrics {#deprecated-internal-metrics}

Over the course of many of the previous releases, we've been working to deprecate the usage of older
internal metrics as we worked towards implementing full support for the
[Component Specification][component_spec], which dictates the basic metrics that all components, or
the basic metrics all components of a specific type, are expected to emit.
internal metrics as we worked towards implementing full support for the [Component
Specification][component_spec], which dictates the basic metrics that all components, or the basic
metrics all components of a specific type, are expected to emit.

We've made enough progress here that we've gone ahead and removed many of the deprecated metrics
from this release. First, below is a list of all metrics we've removed:
We've made enough progress on this work that we've gone ahead and removed many of the deprecated
metrics from this release. First, below is a list of all metrics we've removed:

- `events_in_total` (superceded by `component_received_events_total`)
- `events_out_total` (superceded by `component_sent_events_total`)
Expand All @@ -39,16 +39,11 @@ from this release. First, below is a list of all metrics we've removed:
- `events_failed_total` (superceded by `component_errors_total`)

Most of the removals have straightforward replacements, but the `processed_`-prefixed metrics
involve a small amount of logic.

For sources, `processed_bytes_total` is superceded by `component_received_bytes_total`, and
`processed_events_total` is superceded by `component_received_events_total`. For sinks,
`processed_bytes_total` is superceded by `component_sent_bytes_total`, and `processed_events_total`
is superceded by `component_sent_events_total`. Essentially, the previous metrics dealt with the
bytes/event totals as events flowed into and out of Vector, such that "processing" events in a
source meant receiving them, and "processing" events in a sink meant sending them out. The newer
metrics, `component_received_*` and `component_sent_*`, are meant to be self-documenting and
consistent across all components.
involve a small amount of logic. For **sources**, `processed_bytes_total` is superceded by
`component_received_bytes_total`, and `processed_events_total` is superceded by
`component_received_events_total`. For **sinks**, `processed_bytes_total` is superceded by
`component_sent_bytes_total`, and `processed_events_total` is superceded by
`component_sent_events_total`.

A small note is that a small number of components still emit some of these metrics, as they provided
additional tags and information that is disallowed by the Component Specification. They will be
Expand Down

0 comments on commit 40ce049

Please sign in to comment.