Static metrics

Publish statically configured metrics on an interval

status: stable role: aggregator role: daemon role: sidecar delivery: at-least-once acknowledgements: no egress: batch state: stateless output: metrics
Publish statically configured metrics on an interval. This can be useful for publishing heartbeats or sending the value of an environment variable as a metric.

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "static_metrics"
    }
  }
}
[sources.my_source_id]
type = "static_metrics"
sources:
  my_source_id:
    type: static_metrics
{
  "sources": {
    "my_source_id": {
      "type": "static_metrics",
      "interval_secs": 1,
      "metrics": {
        "kind": "absolute",
        "name": null,
        "value": null
      },
      "namespace": "static"
    }
  }
}
[sources.my_source_id]
type = "static_metrics"
interval_secs = 1
namespace = "static"

  [sources.my_source_id.metrics]
  kind = "absolute"
sources:
  my_source_id:
    type: static_metrics
    interval_secs: 1
    metrics:
      kind: absolute
      name: null
      value: null
    namespace: static

interval_secs

optional float
The interval between metric emitting, in seconds.
default: 1 (seconds)

metrics

optional [object]
Tag configuration for the internal_metrics source.
Array object

metrics.kind

required string literal enum
Kind of the static metric - either absolute or incremental
Enum options
OptionDescription
absoluteAbsolute metric.
incrementalIncremental metric.
Examples
"absolute"
"incremental"

metrics.name

required string literal
Name of the static metric

metrics.tags

optional object
Key-value pairs representing tags and their values to add to the metric.
metrics.tags.*
required string literal
An individual tag - value pair.

metrics.value

required object
“Observed” value of the static metric

A set of observations which are counted into buckets.

It also contains the total count of all observations and their sum to allow calculating the mean.

A histogram bucket.

The buckets within this histogram.

The total number of observations contained within this histogram.
The sum of all observations contained within this histogram.

A set of observations which are represented by quantiles.

Each quantile contains the upper value of the quantile (0 <= φ <= 1). It also contains the total count of all observations and their sum to allow calculating the mean.

The total number of observations contained within this summary.

A single quantile observation.

The quantiles measured from this summary.

The sum of all observations contained within this histogram.
metrics.value.counter
required object
A cumulative numerical value that can only increase or be reset to zero.
The value of the counter.
A set of observations without any aggregation or sampling.
The observed values within this distribution.
metrics.value.distribution.statistic
required string literal enum
The type of statistics to derive for this distribution.
Enum options
OptionDescription
histogramA histogram representation.
summaryCorresponds to Datadog’s Distribution Metric https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition
Examples
"histogram"
"summary"
metrics.value.gauge
required object
A single numerical value that can arbitrarily go up and down.
The value of the gauge.
metrics.value.set
required object
A set of (unordered) unique values for a key.
metrics.value.set.values
required [string]
The values in the set.
metrics.value.sketch
required object

A data structure that can answer questions about the cumulative distribution of the contained samples in space-efficient way.

Sketches represent the data in a way that queries over it have bounded error guarantees without needing to hold every single sample in memory. They are also, typically, able to be merged with other sketches of the same type such that client-side and server-side aggregation can be accomplished without loss of accuracy in the queries.

A generalized metrics sketch.

DDSketch implementation based on the Datadog Agent.

While DDSketch has open-source implementations based on the white paper, the version used in the Datadog Agent itself is subtly different. This version is suitable for sending directly to Datadog’s sketch ingest endpoint.

The average value of all observations within the sketch.

A split representation of sketch bins.

The bins within the sketch.

The number of observations within the sketch.
The maximum value of all observations within the sketch.
The minimum value of all observations within the sketch.
The sum of all observations within the sketch.

namespace

optional string literal
Overrides the default namespace for the metrics emitted by the source.
default: static

Outputs

<component_id>

Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.

Output Data

Metrics

counter

counter
A single value that can be incremented or reset to a zero value but not decremented.
* optional
Any tags present on the metric.

distribution

distribution
A distribution represents a distribution of sampled values. It is used with services that support global histograms and summaries.
* optional
Any tags present on the metric.

gauge

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.
* optional
Any tags present on the metric.

set

gauge
A set represents an array of unique values.
* optional
Any tags present on the metric.

Telemetry

Metrics

link

component_discarded_events_total

counter
The number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
intentional
True if the events were discarded intentionally, like a filter transform, or false if due to an error.
pid optional
The process ID of the Vector instance.

component_errors_total

counter
The total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
error_type
The type of the error
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.

component_received_bytes_total

counter
The number of raw bytes accepted by this component from source origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_event_bytes_total

counter
The number of event bytes accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_count

histogram

A histogram of the number of events passed in each internal batch in Vector’s internal topology.

Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.

component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_lag_time_seconds

histogram
The difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

Examples

Emit a heartbeat

Given this event...
...and this configuration...
sources:
  my_source_id:
    type: static_metrics
    metrics:
      - name: heartbeat
        kind: absolute
        value:
          gauge:
            value: 1
        tags:
          env: ${ENV}
[sources.my_source_id]
type = "static_metrics"

  [[sources.my_source_id.metrics]]
  name = "heartbeat"
  kind = "absolute"

[sources.my_source_id.metrics.value.gauge]
value = 1

    [sources.my_source_id.metrics.tags]
    env = "${ENV}"
{
  "sources": {
    "my_source_id": {
      "type": "static_metrics",
      "metrics": [
        {
          "name": "heartbeat",
          "kind": "absolute",
          "value": {
            "gauge": {
              "value": 1
            }
          },
          "tags": {
            "env": "${ENV}"
          }
        }
      ]
    }
  }
}
...this Vector event is produced:
{
  "gauge": {
    "value": 1
  },
  "kind": "absolute",
  "name": "heartbeat",
  "namespace": "static",
  "tags": {
    "env": "${ENV}"
  },
  "timestamp": "2024-09-10T19:04:58Z"
}

How it works

Context

By default, the static_metrics source augments events with helpful context keys.

State

This component is stateless, meaning its behavior is consistent across each input.