ReferenceClientRanges

Ranges

Organizing telemetry data with time-based ranges and metadata.

This guide covers working with Ranges - time-based categorizations of data with metadata. Ranges are useful for organizing telemetry into tests, runs, events, or other logical groupings.

Range Configuration Reference

ParameterTypeRequiredDefaultDescription
namestringYes-Human-readable name for the range
time_rangeTimeRangeYes-Time interval spanned by the range (start must be ≤ end)
colorstringNo""Hex color code for identifying the range in visualizations (e.g., "#FF0000")
keyUUIDNoAutoUnique identifier (automatically generated by Synnax if not provided)
parentRangeNoNoneOptional parent range. Pass the parent Range itself.
retrieve_if_name_existsbooleanNoFalseIf True, retrieves existing range with same name and time range instead of creating a duplicate. Python only.

TypeScript does not support conditional range creation.

Understanding a Time Range

A TimeRange defines the start and end boundaries of a range. It specifies the time interval that the range covers.

Key Points:

  • Start and End -> A TimeRange has two properties: start and end, both of which are timestamps
  • End-Exclusive -> The range includes data from start up to (but not including) end
  • Validation -> The start time must be less than or equal to the end time

Creating Ranges

To create a range, use the client.ranges.create method:

Synnax will automatically generate a unique identifier for the range.

Only Create a Range if it Does Not Exist

Creating Child Ranges

For more information on child ranges, see the ranges page.

Retrieving Ranges

Fetch a range using the client.ranges.retrieve method.

Retrieving a Single Range

Retrieve a range by its name or key. Synnax will raise a NotFoundError if the range does not exist, and a MultipleFoundError if multiple ranges with the given name exist.

Retrieving Multiple Ranges

Retrieve multiple ranges by passing a list of names or keys. When retrieving multiple ranges, Synnax will not raise an error if a range cannot be found. Instead, the missing range will be omitted from the returned list.

Retrieving Child Ranges

If a range has child ranges, you can retrieve them directly from the parent range.

Retrieving a Parent Range

Navigate up the hierarchy by retrieving a child range’s parent.

Updating a Range

To update an existing range, use the same client.ranges.create method but specify the key of the range to update. This allows modification of the range’s name, time range, or color.

When updating a range, you must provide the key parameter. If you provide a key that doesn’t exist, Synnax will create a new range with that key instead of raising an error.

Updating a range will completely replace its properties. Make sure to include all the properties you want to keep, not just the ones you want to change.

Attaching Metadata

Ranges can store metadata as key-value pairs. This is useful for attaching information like test configuration parameters, numeric results, or part numbers.

All metadata values are stored as strings. It’s up to you to correctly cast the values to the appropriate type.

Setting Metadata

Getting Metadata

Deleting Metadata

Reading from Ranges

Ranges provide a convenient way to read data without specifying exact time boundaries. Once you have a range, you can read channel data directly from it.

Writing to Ranges

Writing to a range removes the burden of needing to correctly align the timestamps for different channels. The write will assume that the timestamp of the first sample is the start of the range.

Working with Channels

Ranges allow you to define aliases for channels that only apply within that range’s context. This is useful when you want to give a channel a more descriptive name for a specific test or operation.

Channel Aliases

Channels must maintain their original names, but you may want to refer to a channel differently in the context of a particular range. For example, you might want to call daq_analog_input_1 as tank_pressure for a burst test.

Aliases are only valid within the context of a particular range. If you try to access an aliased channel outside of the range, Synnax will not be able to find it.

Accessing Aliased Channels

Once you’ve set an alias, you can access the channel using that alias.

Deleting Ranges

Delete a range by passing its key to the client.ranges.delete method.