Send metrics data over HTTP
StackState Self-hosted v5.1.x
Overview
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 integrations 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 StackState stac
CLI.
StackState Receiver API
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 Kubernetes install - configuration parameters.
Common JSON object
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.
Depending on your StackState configuration, received metrics that are too old will be ignored.
JSON property: "metrics"
Metrics can be sent to the StackState Receiver API using the "metrics"
property of the common JSON object.
Every metric has the following details:
The metric name. You can also specify a unit type here. Note that the metric name must not start with any of the following prefixes:
host
,labels
,name
,tags
,timeReceived
,timestamp
,tags
orvalues
. In the example above, the metric name istest.metric
.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
orraw
.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.
Send metrics to StackState
Multiple metrics can be sent in one JSON message via HTTP POST to the StackState Receiver API address. For example:
You can also send metrics to StackState using the stac
CLI metric send
command.
See also
Last updated