# Metrics reference

Every metric Observability provides, with resource type, unit, and meaning, plus the metrics query arguments, response fields, limits, and errors.

The platform provides the five metrics below, listed by resource type. Every metric is a counter that the platform reads every 30 seconds while the instance runs. To query them, see [Query metrics](/docs/observability/query-metrics); for how counters and statistics work, see [What is Origin Cloud Observability?](/docs/observability).

All counters start again from zero when an instance is stopped and started. `RATE` and `INCREASE` account for such a restart, so a data point never turns negative. `INCREASE` is extrapolated to the full period, so it can be a fractional number even for a byte counter.

| Metric | Resource type | Unit |
| --- | --- | --- |
| [`oc_compute_instance_cpu_seconds_total`](#oc_compute_instance_cpu_seconds_total) | Compute instance | `seconds` |
| [`oc_network_interface_receive_bytes_total`](#oc_network_interface_receive_bytes_total) | Network interface | `bytes` |
| [`oc_network_interface_transmit_bytes_total`](#oc_network_interface_transmit_bytes_total) | Network interface | `bytes` |
| [`oc_volume_read_bytes_total`](#oc_volume_read_bytes_total) | Volume | `bytes` |
| [`oc_volume_write_bytes_total`](#oc_volume_write_bytes_total) | Volume | `bytes` |

## oc_compute_instance_cpu_seconds_total [#oc_compute_instance_cpu_seconds_total]

| Property | Value |
| --- | --- |
| Resource type | Compute instance |
| Unit | `seconds` |
| Counts | The total CPU time the instance has consumed, summed over all its vCPUs. |
| `RATE` | The average number of busy vCPUs during the period, in CPU seconds per second. `1.0` means one vCPU fully busy; the maximum is the instance type’s vCPU count. |
| `INCREASE` | The CPU seconds the instance consumed during the period. |

## oc_network_interface_receive_bytes_total [#oc_network_interface_receive_bytes_total]

| Property | Value |
| --- | --- |
| Resource type | Network interface |
| Unit | `bytes` |
| Counts | The total bytes the instance has received on the network interface. |
| `RATE` | The average inbound throughput during the period, in bytes per second. Multiply by 8 for bits per second. |
| `INCREASE` | The bytes received during the period. |

## oc_network_interface_transmit_bytes_total [#oc_network_interface_transmit_bytes_total]

| Property | Value |
| --- | --- |
| Resource type | Network interface |
| Unit | `bytes` |
| Counts | The total bytes the instance has sent on the network interface. |
| `RATE` | The average outbound throughput during the period, in bytes per second. Multiply by 8 for bits per second. |
| `INCREASE` | The bytes sent during the period. |

## oc_volume_read_bytes_total [#oc_volume_read_bytes_total]

| Property | Value |
| --- | --- |
| Resource type | Volume |
| Unit | `bytes` |
| Counts | The total bytes the instance has read from the volume while attached. |
| `RATE` | The average read throughput during the period, in bytes per second. |
| `INCREASE` | The bytes read during the period. |

## oc_volume_write_bytes_total [#oc_volume_write_bytes_total]

| Property | Value |
| --- | --- |
| Resource type | Volume |
| Unit | `bytes` |
| Counts | The total bytes the instance has written to the volume while attached. |
| `RATE` | The average write throughput during the period, in bytes per second. |
| `INCREASE` | The bytes written during the period. |

## Query arguments [#query-arguments]

The `observability.metrics` query takes one `input` argument of type `MetricQueryInput` and returns one series per metric name:

```graphql
query Metrics($input: MetricQueryInput!) {
  observability {
    metrics(input: $input) {
      metricName
      resourceUrn
      unit
      dataPoints {
        timestamp
        value
      }
    }
  }
}
```

The fields of `MetricQueryInput`:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `resourceUrn` | `Urn` | yes | URN of one compute instance, volume, or network interface. |
| `metricNames` | `[String!]` | yes | One or more metric names from this page. Each name returns one series, in the order given. |
| `from` | `DateTime` | yes | Start of the time window, as an RFC 3339 timestamp. The first data point is at `from`. |
| `to` | `DateTime` | yes | End of the time window, as an RFC 3339 timestamp. Must not be earlier than `from`. |
| `periodSeconds` | `Int` | yes | Length of each period and spacing of the data points, in seconds. Values below 1 count as 1. There’s no maximum. Use at least 60, because each data point needs two values collected 30 seconds apart. |
| `statistic` | `MetricStatisticInput` | yes | `RATE` (average per-second increase over the period) or `INCREASE` (total increase over the period). |

A metric name that exists but belongs to another resource type returns a series without data points.

## Response fields [#response-fields]

The query returns a list of `MetricSeries`, one per requested metric name.

| Field | Type | Description |
| --- | --- | --- |
| `metricName` | `String` | The metric name, as requested. |
| `resourceUrn` | `Urn` | The resource the series belongs to. |
| `unit` | `String` | Unit of the underlying counter: `seconds` or `bytes`. A `RATE` value is this unit per second. |
| `dataPoints` | `[MetricDataPoint!]` | The data points in time order. Empty when the platform has no values for the window. |
| `dataPoints.timestamp` | `DateTime` | End of the period the data point covers. |
| `dataPoints.value` | `Float` | The `RATE` or `INCREASE` for that period. |

## Limits [#limits]

| Limit | Value |
| --- | --- |
| Data points per query | 11,000, summed over all metrics in the query. Each metric contributes `(to - from) / periodSeconds + 1` data points. |
| Queries per minute | 60 per organization. Every admitted query counts, including one that later fails for an unknown metric name. |
| Concurrent queries | 4 per organization. |
| Query duration | 30 seconds. A query that runs longer is stopped and returns `SERVICE_UNAVAILABLE`. |
| Data retention | 90 days. Older periods return no data points. |
| Collection interval | 30 seconds, while the instance runs. |

## Errors [#errors]

Errors carry their code in `extensions.code`. For the general meaning of each code, see [Error codes](/docs/platform/reference/errors).

| Code | Cause | What to do |
| --- | --- | --- |
| `BAD_REQUEST` | A name in `metricNames` isn’t one of the metrics on this page (message: `metric <name> is not in the catalog`), or `resourceUrn` isn’t a compute instance, volume, or network interface. | Correct the metric name or the URN. |
| `FORBIDDEN` | You don’t have `observability.metric.get` on the resource. | Ask for a role that includes it, such as Viewer. See [Built-in roles](/docs/iam/roles). |
| `CONFLICT` | The query exceeds the data point limit, the per-minute limit, or the concurrency limit. All three return the message `metric query rate limit exceeded; please retry later`. | Check that the query has at most 11,000 data points. If it does, wait a few seconds and retry. |
| `SERVICE_UNAVAILABLE` | The query didn’t finish within 30 seconds, or metrics are temporarily unavailable. | Retry. If it keeps timing out, query a shorter window or fewer metrics. |

A query that fails isn’t billed.

