Metric Event

A deeper look into Vector's internal metric event.

The metric data model is in beta and still under development. We are working to address core issues such as supporting labels.

As mentioned in the data model page, Vector's events must be one of 2 types: a log or a metric. This page provides a deeper dive into Vector's metric event type and how they flow through Vector internally. Understanding this goes a long way in properly configuring Vector for your use case.

Structure

Vector characterizes a metric event as a data structure that must be one of a fixed set of types:

metric.proto
counter example
histogram example
message Metric {
oneof metric {
Counter counter = 1;
Histogram histogram = 2;
Gauge gauge = 3;
Set set = 4;
}
}
message Counter {
string name = 1;
double val = 2;
google.protobuf.Timestamp timestamp = 3;
}
message Histogram {
string name = 1;
double val = 2;
uint32 sample_rate = 3;
google.protobuf.Timestamp timestamp = 4;
}
message Gauge {
string name = 1;
double val = 2;
enum Direction {
None = 0;
Plus = 1;
Minus = 2;
}
Direction direction = 3;
google.protobuf.Timestamp timestamp = 4;
}
message Set {
string name = 1;
string val = 2;
google.protobuf.Timestamp timestamp = 3;
}

You can view a complete definition in the event proto definition.

Types

A vector metric must be one of the following types: Counter, Histogram, Gauge, Set. Each are described below:

Counter

A counter is a single value that can only be incremented, it cannot be decremented. Your downstream metrics sink will receive this value and aggregate appropriately.

Name

Type

Description

name

string

Counter metric name.

val

double

Amount to increment.

timestamp

timestamp

Time metric was created/ingested.

Histogram

Also called a "timer". A histogram represents the frequency distribution of a value. This is commonly used for timings, helping to understand quantiles, max, min, and other aggregations.

Depending on the downstream service Vector will aggregate histograms internally (such is the case for the prometheus sink) or forward them immediately to the service for aggregation.

Name

Type

Description

name

string

Histogram metric name.

val

double

Specific value.

sample_rate

int

The bucket/distribution the metric is a part of.

timestamp

timestamp

Time metric was created/ingested.

Gauge

A gauge represents a point-in-time value that can increase and decrease. Vector's internal gauge type represents changes to that value. Gauges should be used to track fluctuations in values, like current memory or CPU usage.

Name

Type

Description

name

string

Histogram metric name.

val

double

Specific value.

direction

string

The value direction. If it should increase or descrease the aggregated value.

timestamp

timestamp

Time metric was created/ingested.

Set

A set represents a count of unique values. The val attribute below represents that unique value.

Name

Type

Description

name

string

Set metric name.

val

string

Specific value.

timestamp

timestamp

Time metric was created/ingested.