Mirroring Telemetry
Pull telemetry from existing telemetry sources using the concept of mirroring.
This page describes StackState version 4.2.
The StackState 4.2 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.2 version range to upgrade to a more recent release.
Mirroring is a way to connect StackState to third-party telemetry data sources. In the case of mirroring StackState does not require the telemetry to be present within StackState's telemetry data source, but will retrieve the telemetry whenever it needs it. This means you can work with existing telemetry as if it were just a part of the 4T data model.
When to use mirroring
Mirroring has some major advantages:
Cost savings on both storage and bandwidth.
Data access is always fresh.
All data is always available; in some cases throttling limits may prevent all data from being transferred, so mirroring is the only viable option.
There are however also some disadvantages:
Availability and retention of the data depends on the availability and retention of the data source.
If StackState requires streaming data it is forced to start polling data from the data source. When dealing with lots of streaming data, the limits that made mirroring a good idea in the first place now cause the same problems.
StackState has to make an outgoing connection to the mirror, which means that you will have to allow StackState to access your mirror. In order to secure these connections, firewalls rules may need to be configured. Especially in large enterprise this may cause installation delays.
If you wish to use mirroring, but need a solution to any of the above disadvantages we recommend that you contact us.
To get started with mirroring, have a look at our mirroring tutorial.
Mirror Architecture
Before mirroring StackState used to work with a plugin system to allow it to work with third-party telemetry data sources. Still some telemetry sources are accessed via the custom plugin method, but over time these will be deprecated in favor of the mirroring architecture, which builds on the plugin architecture.
Mirroring is performed using two components: the Mirror Plugin
and a remote telemetry system called the Mirror
. The Mirror Plugin is a StackState plugin configured to talk to the Mirror. The plugin requires the Mirror to implement the Mirror REST API. In its turn, the Mirror acts as a gateway to the target telemetry system and is implemented as a webserver.
The StackState instance has to be able to open a connection to the mirror. There is some work planned to use the agent to reverse the connection, but this is not available as of yet.
The Mirror is intended to be stateless and to proxy StackState requests to the target telemetry system. The Mirror can be implemented in any technology or programming language. The only requirement is that it implements the Mirror REST API described below.
Mirror REST API
The Mirror API consists of 4 methods:
Test Connection
Get Field Names
Get Field Values
Get Metric Values
All the requests are POST requests and input/output is passed in the JSON body of the request or response.
Common Request Information
Each request JSON contains a number of fields. The following fields are common:
Connection Details
Query Equality Conditions
Time Range
Result Set Limit
Connection Details
The field connectionDetails
is mandatory and must be present in each request. The field contains arbitrary JSON configuration for connecting to the target system. This is a flexible configuration, and it is up to the Mirror implementor to decide what configuration elements are required. For example, a target telemetry source URL, timeouts, API key, and many others.
Example:
Query Equality Conditions
Query Conditions are used to select a subset of the telemetry from the target telemetry system. Query Conditions are a list of equality conditions interpreted as a conjunction of equality statements, i.e. all conditions are interpreted as a logical AND
.
Please see the example below:
The equality condition consists of the key and value. The key
is of type string, and it contains the name of the variable/field/label in the remote monitoring system. The value
is a JSON object that contains the actual value of one of three types: string, double or boolean.
Time Range
The time range parameters are startTime
and endTime
, each holding a timestamp in epoch milliseconds indicating the query date range.
Result Set Limit
The field "limit" asks the Mirror to return only a subset of the results.
Common Response Information
The Mirror is expected to reply with the header X-MIRROR-API-KEY
and the StackState Mirror Plugin should compare it with the API key configured in the StackState server.
Method: Test Connection
This API is a way to test the connection with the remote telemetry system.
Sample request:
If the Mirror can successfully connect to the remote telemetry system, it should reply with the following success response:
In case there was an error while connecting to the remote telemetry system, the Mirror should return a failure response:
The error field may contain more detailed error information.
Method: Field Names
This API retrieves field names from the remote telemetry system.
Sample request:
The FieldNamesRequest
request type contains a FieldNamesQuery
object. The query object contains conditions
, startTime
, endTime
, and limit
acting as a filter for the result field list. These parameters help the user to do continuous refinement of available field names during configuration of a telemetry stream.
A successful response should contain the list of field descriptors for the fields in the format below:
The interpretation of the field descriptor is given below:
fieldName
- the name of the field.fieldType
- one of threeSTRING
,NUMBER
,BOOLEAN
classified
- indicates that special care need to be taken when logging or displaying the values of this field.
Method: Field Values
This API retrieves field values from the remote monitoring system.
Sample request:
The FieldValuesResponse holds the list of possible values:
There are two types of values: CompleteValue
, and FieldValuePattern
. The CompleteValue
indicates that the value
field contains a full value token. The FieldValuePattern
specifies the partial value that can be used as a fieldValuePrefix
in subsequent refinement requests.
Method: Get Metric Values
The Get Metric Values API allows fetching metric values.
There are two types of metric queries: raw and aggregated.
Sample raw metric request:
A raw metric request is executed when one wants to fetch raw (non aggregated) values from the remote telemetry system. The Mirror can recognize this query by the absence of the optional aggregation
object in the query
field. Besides common fields, there is a metricField
which optionally indicates the source field for metric values.
An example response of the raw metric query is given below:
The fields have the following meaning:
the
points
list contains several sublists each representing one data pointthe field name positions of values in the data point sublist is specified by the
dataFormat
fieldthe field
isPartial
indicates if the response has been truncated either by application of thelimit
field or by the telemetry store itself. In this case, the user should take action and execute another metric request specifying the last point timestamp asrequest
.query
.startTime
to retrieve truncated values.
Sample aggregated metric request:
The request is the same as for raw query with one exception, The aggregation
field is not empty and holds the aggregation method
and aggregation bucket size bucketSizeMillis
. The aggregation is done using the batching windowing method.
The following aggregation methods are supported by the Mirror Plugin:
MEAN
- meanPERCENTILE_25
- 25 percentilePERCENTILE_50
- 50 percentilePERCENTILE_75
- 75 percentilePERCENTILE_90
- 90 percentilePERCENTILE_95
- 95 percentilePERCENTILE_98
- 98 percentilePERCENTILE_99
- 99 percentileMAX
- maximumMIN
- minimumSUM
- sumEVENT_COUNT
- the number of occurrences during bucket interval
An example response of an aggregated query request is given below:
The fields have the same meaning as for the raw metric query. The only difference is that the points
sublists contain startTimestamp
and endTimestamp
fields indicating aggregated bucket start and stop time. The positions are specified in the dataFormat
format field.
Error responses
In case of a Mirror request failure the Mirror may reply with the following errors:
Remote metric system connection issues
Metric not found error
Mirror or remote metric system does not support metric type
If the failure does not fall into any previous category then mirror can return generic
RemoteMirrorError
.
Last updated