SignalFx Developers Guide

const()

Creates a stream of constant-value timeseries.

Syntax

const(value=<constant_value>, key=<dimensions>, timeseries=<timeseries_specs>)

Table 1. Parameter definitions
Parameter Type Description

value

number

The numeric value to use when generating a single timeseries

key

JSON object (key-value pair) or array of objects

The dimensions and values to insert into the timeseries

timeseries

array of objects

If specified, generates multiple constant timeseries in the output stream. Each object in the array contains a key child object and a value

Examples

Using const() to create a single timeseries

This SignalFlow expression publishes a single timeseries without any dimensions:

const(value=.5).publish()

To add dimensions to it, add the key parameter:

const(value=.5, key={"host": "host2"}).publish()

Using const() to create multiple timeseries

Test distinct static thresholds for a set of dimension values by generating multiple timeseries using const(). Specify each timeseries in the timeseries parameter. Don’t specify value and key as arguments to const(); instead, specify them in the value of timeseries.

1
2
3
4
5
6
7
8
9
# Define thresholds with two timeseries:
#   - one with a 'aws_region:us-east-1' dimension with a value of 75
#   - another with a 'aws_region:us-west-1' dimension with a value of 85
thresholds = const(timeseries=[
    {'key': {'aws_region': 'us-east-1'}, 'value': 75},
    {'key': {'aws_region': 'us-west-1'}, 'value': 85}])

# Use those thresholds in a detector and let correlation do the work
detect(data('cpu.utilization').promote('aws_region') > thresholds).publish('cpu too high')

© Copyright 2019 SignalFx.

Third-party license information