---
icon: simple/prometheus
---

The 10x Metrics API provides Prometheus-compliant REST endpoints to query a Prometheus backend for [TenXSummary metrics](/run/output/metric/) and to [monitor](/run/monitor/) 10x Engine health.

!!! tip "Used by the MCP"
    The [MCP cost tools](/apps/mcp/) run these queries against your metrics backend.

| Deployment | Metrics Endpoint | User Management Endpoint |
|------------|------------------|--------------------------|
| **Cloud (SaaS)** | `https://prometheus.log10x.com` | `https://api.log10x.com` |
| **Staging** | `https://prometheus-staging.log10x.com` | `https://api-staging.log10x.com` |
| **Self-Hosted** | Your configured endpoint | Your configured endpoint |

Authenticate by placing your Log10x API key in an `X-10X-Auth` header.

Use this API to build custom cost analyses, dashboards, and automation on top of the per-pattern cost time series.

## :material-api: Endpoints

The `prometheus.log10x.com` endpoint exposes the following [Prometheus HTTP API](https://prometheus.io/docs/prometheus/latest/querying/api/){target="_blank"} endpoints:

| Endpoint | Methods | Description |
|----------|---------|-------------|
| [/query](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries){target="_blank"} | POST/GET | Instant queries |
| [/query_range](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries){target="_blank"} | POST/GET | Range queries |
| [/query_exemplars](https://prometheus.io/docs/prometheus/latest/querying/api/#querying-exemplars){target="_blank"} | POST/GET | Query exemplars |
| [/series](https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers){target="_blank"} | POST/GET | Find series by label |
| [/labels](https://prometheus.io/docs/prometheus/latest/querying/api/#getting-label-names){target="_blank"} | POST/GET | Get label names |
| [/label/{name}/values](https://prometheus.io/docs/prometheus/latest/querying/api/#querying-label-values){target="_blank"} | GET | Get label values |

??? tenx-api "Example: Query Pipeline Health"
	```bash
	curl -s -H "X-10X-Auth: <YOUR-API-KEY>" \
	  "https://prometheus.log10x.com/api/v1/query?query=tenx_pipeline_up"
	```

	Response:
	```json
	{
	  "status": "success",
	  "data": {
	    "resultType": "vector",
	    "result": [
	      {
	        "metric": {
	          "TENX_Tenant": "00000000-0000-0000-0000-000000000000",
	          "__name__": "tenx_pipeline_up",
	          "tenx_env": "production",
	          "tenx_host_name": "edge-node-1",
	          "tenx_pipeline_uuid": "a1b2c3d4-...",
	          "tenx_reported_name": "my-10x-pipeline"
	        },
	        "value": [1704109200, "1"]
	      }
	    ]
	  }
	}
	```

## :material-test-tube: Demo License Queries

Holders of an anonymous [demo license](/api/license/) can read back the metrics that the **same** license wrote, without an API key, via the `/api/v1/demo/*` mirror of the query endpoints. Authenticate with the demo license JWT in an `Authorization: Bearer` header (not `X-10X-Auth`):

| Endpoint | Methods |
|----------|---------|
| `/api/v1/demo/query` | POST/GET |
| `/api/v1/demo/query_range` | POST/GET |
| `/api/v1/demo/query_exemplars` | POST/GET |
| `/api/v1/demo/series` | POST/GET |
| `/api/v1/demo/labels` | POST/GET |
| `/api/v1/demo/label/{name}/values` | GET |

!!! warning "Demo limits"
    Demo queries are bounded to the **last 3 hours of data** and are rate limited. A request whose `start`, `end`, or `time` falls outside the 3-hour window, or whose PromQL range selector (e.g. `[24h]`) exceeds it, returns `400` with an explanation. For full-history, higher-throughput access, use an API key against the standard endpoints above. The AI query endpoints (`/query_ai`) are not available to demo licenses.

??? tenx-api "Example: Query demo data with a demo license"
	```bash
	# Mint a demo license (response includes { "license": "<jwt>", ... })
	LICENSE=$(curl -s -X POST "https://api.log10x.com/api/v1/license/demo" | jq -r .license)

	# Read back what that license wrote (last 3 hours only)
	curl -s -H "Authorization: Bearer $LICENSE" \
	  "https://prometheus.log10x.com/api/v1/demo/query?query=tenx_pipeline_up"
	```

## :material-chart-line: Available Metrics

### Pipeline Health

| Metric | Type | Description |
|--------|------|-------------|
| `tenx_pipeline_up` | Gauge | Pipeline running status (1 = up) |
| `tenx_pipeline_bootstrap_time_seconds` | Gauge | Pipeline startup time |
| `tenx_pipeline_runtime_seconds` | Gauge | Total pipeline runtime |
| `tenx_pipeline_input_time_seconds` | Gauge | Time spent processing input |
| `tenx_pipeline_invocation_time_seconds` | Gauge | Function invocation time |

### Event Counters

| Metric | Type | Description |
|--------|------|-------------|
| `totalEvents_total` | Counter | Total events processed |
| `totalBytes_total` | Counter | Total bytes processed |
| `tokenized_total` | Counter | Events matched to templates |
| `nonTokenized_total` | Counter | Events without template matches |
| `singleEvents_total` | Counter | Single (non-grouped) events |
| `eventGroups_total` | Counter | Number of event groups |

### Volume Metrics

| Metric | Type | Description |
|--------|------|-------------|
| `all_events_summaryVolume_total` | Counter | Total event volume |
| `all_events_summaryBytes_total` | Counter | Total event bytes |
| `emitted_events_summaryVolume_total` | Counter | Emitted event volume |
| `emitted_events_summaryBytes_total` | Counter | Emitted event bytes |
| `emitted_events_optimized_size_total` | Counter | Optimized output size |
| `indexed_events_summaryVolume_total` | Counter | Indexed event volume |
| `indexed_events_summaryBytes_total` | Counter | Indexed event bytes |
| `streamed_events_summaryVolume_total` | Counter | Streamed event volume |
| `streamed_events_summaryBytes_total` | Counter | Streamed event bytes |

## :material-tag-outline: Available Labels

Labels allow filtering and grouping metrics by dimension:

| Label | Description |
|-------|-------------|
| `TENX_Tenant` | Tenant/organization ID |
| `tenx_env` | Environment (e.g., production, staging) |
| `tenx_app` | Application name |
| `tenx_sub_app` | Sub-application identifier |
| `tenx_host_name` | Host running the pipeline |
| `tenx_pipeline_uuid` | Unique pipeline instance ID |
| `tenx_reported_name` | User-defined pipeline name |
| `tenx_fwd_input` | Log forwarder input source |
| `severity_level` | Log severity level |
| `message_pattern` | Matched message template |
| `http_code` | HTTP response code |
| `http_message` | HTTP response message |
| `k8s_namespace` | Kubernetes namespace |
| `k8s_pod` | Kubernetes pod name |
| `k8s_container` | Kubernetes container name |
| `index_app` | Target index application |
| `index_file` | Target index file |
| `tenx_user_service` | User-defined service label |
| `tenx_user_process` | User-defined process label |

## :material-code-braces: Query Examples

??? tenx-api "List All Metric Names"
	```bash
	curl -s -H "X-10X-Auth: <YOUR-API-KEY>" \
	  "https://prometheus.log10x.com/api/v1/label/__name__/values" | jq
	```

??? tenx-api "Query Event Volume by Environment"
	```bash
	curl -s -H "X-10X-Auth: <YOUR-API-KEY>" \
	  "https://prometheus.log10x.com/api/v1/query?query=sum(totalEvents_total)by(tenx_env)" | jq
	```

??? tenx-api "Query Range (Last Hour)"
	```bash
	curl -s -H "X-10X-Auth: <YOUR-API-KEY>" \
	  "https://prometheus.log10x.com/api/v1/query_range?\
	query=rate(totalEvents_total[5m])&\
	start=$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)&\
	end=$(date -u +%Y-%m-%dT%H:%M:%SZ)&\
	step=60s" | jq
	```

??? tenx-api "Get Series Metadata"
	```bash
	curl -s -H "X-10X-Auth: <YOUR-API-KEY>" \
	  "https://prometheus.log10x.com/api/v1/series?match[]=tenx_pipeline_up" | jq
	```

