# Create inspect

URL: https://docs.hanzo.ai/docs/openapi/o11y/inspectmetrics

> Returns one metric's raw time series over a window of at most thirty minutes — each series with its labels and timestamp/value pairs.

`POST /v1/o11y/metrics/inspect`

> [O11y →](https://docs.hanzo.ai/docs/openapi/o11y) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                |
| ------------- | ---------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/o11y/metrics/inspect` |
| **Method**    | `POST`                                         |
| **Operation** | `InspectMetrics`                               |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`         |

Returns one metric's raw time series over a window of at most
thirty minutes — each series with its labels and timestamp/value pairs.

## Request

5 fields, body `application/json` (required).

| Field               | In   | Type                  | Required | Description                                                                                           |
| ------------------- | ---- | --------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `end`               | body | integer (int64)       | yes      | End is the end of the window as a Unix timestamp in milliseconds, at most thirty minutes after start. |
| `filter`            | body | o11y.O11yMetricFilter | —        |                                                                                                       |
| `filter.expression` | body | string                | —        | Expression is the filter, in the query-builder filter syntax.                                         |
| `metricName`        | body | string                | yes      | MetricName is the metric to inspect.                                                                  |
| `start`             | body | integer (int64)       | yes      | Start is the start of the window as a Unix timestamp in milliseconds.                                 |

## Response

| Status    | Body                      | Meaning           |
| --------- | ------------------------- | ----------------- |
| `200`     | o11y.O11yMetricInspectOut | ok                |
| `202`     | Approval                  | held for approval |
| `default` | problem-details           | refused           |

`200` body — 17 fields.

| Field                                      | In   | Type                     | Always | Description                                                               |
| ------------------------------------------ | ---- | ------------------------ | ------ | ------------------------------------------------------------------------- |
| `data`                                     | body | o11y.O11yMetricSeriesSet | —      |                                                                           |
| `data.series`                              | body | o11y.O11yMetricSeries\[] | —      | Series are the time series.                                               |
| `data.series[].labels`                     | body | o11y.O11yMetricLabel\[]  | —      | Labels identify the series.                                               |
| `data.series[].labels[].key`               | body | o11y.O11yMetricField     | —      |                                                                           |
| `data.series[].labels[].key.description`   | body | string                   | —      | Description describes the field.                                          |
| `data.series[].labels[].key.fieldContext`  | body | string                   | —      | FieldContext is the context the field lives in, e.g. resource, attribute. |
| `data.series[].labels[].key.fieldDataType` | body | string                   | —      | FieldDataType is the field's data type.                                   |
| `data.series[].labels[].key.name`          | body | string                   | —      | Name is the field's name.                                                 |
| `data.series[].labels[].key.signal`        | body | string                   | —      | Signal is the telemetry signal the field belongs to.                      |
| `data.series[].labels[].key.unit`          | body | string                   | —      | Unit is the field's unit.                                                 |
| `data.series[].labels[].value`             | body | any                      | —      | Value is the label's value.                                               |
| `data.series[].values`                     | body | o11y.O11yMetricPoint\[]  | —      | Values are the series' points, in time order.                             |
| `data.series[].values[].partial`           | body | boolean                  | —      | Partial marks a point whose bucket the window only partly covers.         |
| `data.series[].values[].timestamp`         | body | integer (int64)          | —      | Timestamp is the point's time as a Unix timestamp in milliseconds.        |
| `data.series[].values[].value`             | body | number (double)          | —      | Value is the point's value.                                               |
| `data.series[].values[].values`            | body | number (double)\[]       | —      | Values carries the bucket values of a heatmap point.                      |
| `status`                                   | body | string                   | —      | Status is "success".                                                      |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo o11y metrics inspect \
  --end 0 \
  --metric-name <metricName> \
  --start 0
```

**SDK**

**.ts**

```ts
import { Configuration, O11yApi } from 'hanzoai';

const api = new O11yApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.inspectMetrics({ metricName: "<metricName>", start: 0, end: 0 });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import O11yApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = O11yApi(client).inspect_metrics(metric_name="<metricName>", start=0, end=0)
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.O11yAPI.InspectMetrics(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, o11y_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = o11y_api::inspect_metrics(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.O11yApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new O11yApi(client).inspectMetrics();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/o11y/metrics/inspect \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "metricName": "<metricName>",
       "start": 0,
       "end": 0
     }'
```

**MCP**

Tool `o11y`, op `InspectMetrics` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "o11y",
         "arguments": {
           "op": "InspectMetrics",
           "input": {
             "metricName": "<metricName>",
             "start": 0,
             "end": 0
           }
         }
       }
     }'
```

---

[O11y API](https://docs.hanzo.ai/docs/openapi/o11y) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
