Method write

Writes metric data to Monitoring.

HTTP request

POST https://monitoring.api.cloud.yandex.net/monitoring/v2/data/write

Query parameters

Parameter Description
folderId

Required. ID of the folder that the metric belongs to.

The maximum string length in characters is 50.

service

Required. ID of the service that the metric belongs to. Use service=custom for custom metrics.

The maximum string length in characters is 50.

Body parameters

{
  "ts": "string",
  "labels": "object",
  "metrics": [
    {
      "name": "string",
      "labels": "object",
      "type": "string",
      "ts": "string",
      "value": "number",
      "timeseries": [
        {
          "ts": "string",
          "value": "number"
        }
      ]
    }
  ]
}
Field Description
ts string (int64)

Common timestamp for all metrics.

labels object

Common labels for all metrics as key:value pairs.

metrics[] object

List of metrics.

metrics[].
name
string

Required. Name of the metric.

metrics[].
labels
object

Metric labels as key:value pairs.

metrics[].
type
string

Type of the metric. The default value is DGAUGE.

  • DGAUGE: Gauge with fractional values.
  • IGAUGE: Gauge with integer values.
  • COUNTER: Counter.
  • RATE: Rate.
metrics[].
ts
string (int64)

Time point in the timestamp format. If it is not specified, the current time is used.

metrics[].
value
number (double)

Required. Metric value in the time point.

metrics[].
timeseries[]
object

List of several points.

metrics[].
timeseries[].
ts
string (int64)

Time point in the timestamp format.

metrics[].
timeseries[].
value
number (double)

Metric value.

Response

HTTP Code: 200 - OK

{
  "writtenMetricsCount": "string",
  "errorMessage": "string"
}
Field Description
writtenMetricsCount string (int64)

Number of successfully written metrics.

errorMessage string

Error message if the writing failed.