Adding telemetry to synchronized topology
Last updated
Last updated
This page describes StackState version 4.0.
The StackState 4.0 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.0 version range to upgrade to a more recent release.
When you have synchronized topology, every component/relation is synchronized via the template it was created with. That means that every time an update is received for a component/relation, that update is executed using the template. The only way to add telemetry or health checks to your synchronized topology is to edit the template with which the component/relation is created. In order to do so, StackState provides a template editor. The following sections will explain how the template editor works.
In the view, select a component that you'd like to add telemetry to. This opens a component pane on the right side of the screen, where next to the component you'll find a menu with options to edit the component. Click on Edit template.
After selecting the edit template option from the menu, the template editing UI appears
Aside from self-explanatory fields like template, name and description, the template editor is divided into two text editors: The input parameters and the template function. The following sections explain how to add streams and checks to your component using these two editors.
This section shows the actual data already synchronized to the topology element. All the data shown is accessible to be used while editing the templates. The typical setup is to define a variable element
which holds the topology element payload and is eventually exposed to the templated interpolation. Here is an example of an AWS lambda function payload:
This section shows the current template being used to synchronize the topology element. The template function has access to the component payload exposed by the input parameters and relies on using those variables to evaluate the template into a valid json document.
The streams
property is the way to configure telemetry into your topology element, the streams
is defined as a collection of DataStreams
which can be either a MetricStream or a EventStream, for example here is the payload for a MetricStream:
The template requires the following fields:
_type
: The type of Data Stream [MetricStream|EventStream].
name
: A name for the Data Stream.
query
: Object representing the conditions to filter the stream [MetricTelemetryQuery,EventTelemetryQuery].
dataSource
: The data source where to connect to fetch the data.
dataType
: The kind of data received on the stream [METRICS|EVENTS].
The query
object is probably the most important atribute of the stream
object. A query
object is defined as:
_type
: The type of the Query [MetricTelemetryQuery,EventTelemetryQuery]
conditions
: A collection of Objects with key
and value
atributes that represent the predicates that will help filtering the stream. The key
atributes are defined by the data source that is being used. In the example all keys
refer to atributes that you can filter on a Cloudwatch query. The value
accepts String, Numeric or Boolean values.
metricField
: The metric that we want to observe in the stream. Field only available for Metric Streams.
aggregation
: The function to apply in order to aggregate the data. [MEAN,PERCENTILE_25,PERCENTILE_50,PERCENTILE_75,PERCENTILE_90,PERCENTILE_95,PERCENTILE_98,PERCENTILE_99,MAX,MIN,SUM,VALUE_COUNT,EVENT_COUNT]. Field only available for Metric Streams
After editing the input parameters and template function, you can preview how the component with the added telemetry would look like by pressing the 'Preview' button below the template function. For example, if we add an extra stream to monitor the Errors
as:
If any mistakes were made during the editing of the template, the preview function will show you where the errors occurred.
You can also visit the history of previously executed templates. The historic representation will show both the input parameters and template function of a previously executed template, as well as the raw result of that execution. By clicking 'Load this template' you then replace your text editors on the left for the parameters and the function with the one you just loaded from the history.
You can also go to 'Template Examples' and get references on how to build templates. The examples tab also allows you to load an example into the text editors on the left by pressing 'Use this example'.