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

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: 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 = 1

    [sources.my_source_id.metrics.tags]
    env = "${ENV}"
{
  "sources": {
    "my_source_id": {
      "type": "static_metrics",
      "metrics": [
        {
          "name": "heartbeat",
          "kind": "absolute",
          "value": {
            "gauge": 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.