Send metrics data over HTTP
StackState Self-hosted v5.1.x
Last updated
StackState Self-hosted v5.1.x
Last updated
StackState can either pull metrics from a data source or can receive pushed metrics. Pushed metrics are stored by StackState, while pulled metrics aren't. Pushed metrics are stored for the duration of the configured retention period. This page describes how metrics can be pushed.
There are several ways to send metrics to StackState. A large number of are provided out of the box that may help you get started. If there is no out of the box integration, you can send metrics to StackState using either HTTP or the .
The StackState Receiver API accepts topology, metrics, events and health data in a common JSON object. The default location for the receiver API is the <STACKSTATE_RECEIVER_API_ADDRESS>
, constructed using the <STACKSTATE_BASE_URL>
and <STACKSTATE_RECEIVER_API_KEY>
.
The <STACKSTATE_RECEIVER_API_ADDRESS>
for StackState deployed on Kubernetes or OpenShift is:
The <STACKSTATE_BASE_URL>
and <STACKSTATE_RECEIVER_API_KEY>
are set during StackState installation, for details see .
Topology, metrics, events and health data are sent to the receiver API via HTTP POST. There is a common JSON object used for all messages. One message can contain multiple metrics and multiple events.
Every metric has the following details:
The UTC timestamp of the metric expressed in epoch seconds.
The value of the metric (double). In the example above, the value is 10.0
.
hostname - The host this metric is from.
type - The type of metric. Can be gauge
, count
, rate
, counter
or raw
.
tags - Optional. A list of key/value tags to associate with the metric.
The timestamp
and value
are used to plot the metric as a time series. The name
and tags
can be used to define a metric stream in StackState.
You can also send metrics to StackState using the stac
CLI metric send
command.
Metrics can be sent to the StackState Receiver API using the "metrics"
property of the .
The metric name. You can also here. Note that the metric name must not start with any of the following prefixes: host
, labels
, name
, tags
, timeReceived
, timestamp
, tags
or values
. In the example above, the metric name is test.metric
.
Multiple metrics can be sent in one JSON message via HTTP POST to the . For example: