Metric Metadata

Each metric known to the MetricQ network includes metadata in the form of arbitrary name/value pairs, where name are strings and values are JSON values. Metadata values are free-form and can be used to store any information useful and related to a metric. Though, some restrictions apply in the form of reserved fields and standardized fields. Since this is JSON, the name should be in camelCase.

Reserved Fields

Reserved fields may not be used when declaring metadata for a metric. Tools consuming metadata are free to make use of these fields, though.

All fields starting with _

Reserved for the metadata storage backend implementation.

_id (string)

The name of the metric associated to this set of metadata.

date (string)

ISO 8601 formatted date at which the metadata was last updated (by Source.declare_metrics()). This is generated by the manager but can be overwritten by the source.

historic (bool)

Indicates whether this is stored in a database or not. Set by the manager.

source (string)

Token of the source that produces this metric. Set by the manager.

Standardized Fields

Some fields have a defined meaning that should be respected. Consuming tools might handle and display these fields in a special way.

description (string)

A human readable description of the measured quantity. For example, “Temperature of rack A2 in room E13” would be a description for a metric example.room-E13.rack-A2.temperature.

unit (string)

The unit symbol according to SI, e.g. "V" for voltage or "s" for time. If necessary, the SI prefix is included, e.g., "kV", "ms", or "kiB/s". Dimensionless quantities (e.g. counts) use either an empty string "" or the appropriate symbol, e.g., "rad". That is, the SI unit 1 is omitted as it is typically not shown.

rate (number)

The rate in Sa/s (samples per second) or Hz at which new values of this metric are typically produced. This is a hint to consumers and should be treated as a “best guess”, a source does not need to produce values at a perfectly constant rate.

interval (string)

This is the reciprocal of rate, but as a string. It corresponds to Timedelta.from_string() / Timedelta.precise_string. This can allow for more precise values and less floating point shenanigans, e.g., 3s instead of a rate of 0.3333333.

scope (one of "last", "next" or "point")

This describes the temporal validity of a single measurement value.

quantity (string)

The quantity being measured. Ideally this is the same as the last segment of the metric name, e.g. "power" or "temperature".

chunkSize (number or null)

In Python, this is set by the metricq library itself and should not be set by the user. The number of data points sent to the network in a single message, see Source.chunk_size() and Source.send().

Setting this to null means that the chunk size is either not known or varies between messages.

This is useful for monitoring, as rate / chunkSize gives an estimate of the expected message rate for a source.