All Products
Search
Document Center

Simple Log Service:Metric

Last Updated:Aug 18, 2023

Simple Log Service stores all the data in Metricstores as time series. Simple Log Service uses the model of time series data defined by Prometheus. For more information about the model, see DATA MODEL in the Prometheus documentation. Each time series consists of samples with the same metric identifier.

Metric identifier

Each time series has a unique metric identifier that consists of a metric name and labels.

A metric name is a string that indicates a description of a time series. A metric name must match the [a-zA-Z_:][a-zA-Z0-9_:]* regular expression. For example, http_request_total indicates that each sample of a time series indicates the total number of received HTTP requests.

A label is a key-value pair that indicates an attribute of a time series. Multiple key-value pairs are separated by vertical bars (|). A label key must match the [a-zA-Z_][a-zA-Z0-9_]* regular expression. A label value can contain all characters except vertical bars (|). For example, the value of the method key may be POST, and the value of the URL key may be /api/v1/get.

Samples

A sample indicates the value of a metric at a point in time. Each sample consists of a timestamp and a value. Timestamps are accurate to the nanosecond, and values are of the DOUBLE type.

Encoding format

When time series data is written to Simple Log Service, the Protocol Buffer (Protobuf) format must be used. This format is also used to write log data. For more information, see Data encoding. The metric identifier and samples are contained in the content field. The following table describes the related subfields.

Subfield

Description

Example

__name__

The metric name of the time series.

nginx_ingress_controller_response_size

__labels__

The labels of the time series. Format: {key}#$#{value}|{key}#$#{value}|{key}#$#{value}.

Note
  • The labels must be sorted by key in alphabetical order.

  • We recommend that you do not write a label whose value is an empty string. For example, if the value of the __labels__ field is app#$#|controller_class#$#nginx, we recommend that you do not write the label whose key is app to your Metricstore. Otherwise, PromQL aggregation errors may occur.

app#$#ingress-nginx|controller_class#$#nginx|controller_namespace#$#kube-system|controller_pod#$#nginx-ingress-controller-589877c6b7-hw9cj

__time_nano__

The timestamp of a sample. The value is accurate to nanoseconds.

1585727297293000000

__value__

The value of a sample.

36.0