Customer metrics
Package: agentrouter.metrics.v1 Service: CustomerMetricsService
Endpoints
Get a metric for a user
What it does: Returns a metric for a single user. The user_id is forced to the authenticated caller: a caller can only read their own USER-layer metrics even within a project they share.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Customer that owns the project. Defaults to the caller's session customer when empty. |
project_id | no | Project the query is scoped to. Defaults to the caller's session project when empty. |
user_id | no | User to query. Must equal the authenticated caller; a mismatch is denied. |
metric | yes | Metric name from the catalog (e.g. "token_usage", "response_latency"). |
start_time | no | Start of the query window (inclusive) as an RFC3339 timestamp. Empty defaults to 24h before end_time. Example: 2026-01-02T15:04:05Z. |
end_time | no | End of the query window (exclusive) as an RFC3339 timestamp. Empty defaults to now, or to 24h after start_time when only start_time is set. |
step | no | Bucket granularity. Unset (STEP_UNSPECIFIED) picks a step scaled to the query window; see Step. |
group_by | no | Optional breakdown dimension (e.g. "model", "provider"); omit for none. |
Response fields:
| Field | Required | Description |
|---|---|---|
metric | output-only | Metric name that was queried. |
entity | output-only | Entity the metric was queried for. |
window | output-only | Time window and bucket step the series cover. |
series | output-only | One time series per group (or a single series when ungrouped). |
summary | output-only | Per-window rollup across the series. |
{"signatures":{"go":"func (x *CustomerMetricsClient) GetUserMetric(ctx context.Context, req *metricsv1.GetUserMetricRequest) (*metricsv1.MetricsResponse, error)","python":"get_user_metric(req: metrics_pb2.GetUserMetricRequest) -\u003e MetricsResponse","typescript":"getUserMetric(req: MessageInitShape\u003ctypeof tars_metrics_v1_metrics_pb.GetUserMetricRequestSchema\u003e): Promise\u003cMetricsResponse\u003e","cli":"tare api metrics user get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../users/01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tmetricsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/metrics/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026metricsv1.GetUserMetricRequest{}\n\n\tresp, err := client.CustomerMetrics().GetUserMetric(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/customermetrics/getusermetric\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom tars.metrics.v1 import metrics_pb2\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Populate the request fields -- see the \"Request fields\" table above\n# for the available fields and which are required.\nreq = metrics_pb2.GetUserMetricRequest()\ntry:\n result = client.customer_metrics.get_user_metric(req)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.customerMetrics.getUserMetric(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"customermetrics\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api metrics user get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../users/01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/users/{user_id}/metrics/{metric}","slug":"get-a-metric-for-a-user"}
Get a metric for an API key
What it does: Returns a metric for a single API key. The key must belong to the resolved (customer, project) scope, else NotFound.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Customer that owns the project. Defaults to the caller's session customer when empty. |
project_id | no | Project the query is scoped to. Defaults to the caller's session project when empty. |
api_key_id | yes | API key (UUID) to query. Must be owned by the resolved (customer, project); otherwise NotFound. |
metric | yes | Metric name from the catalog. |
start_time | no | Start of the query window (inclusive) as an RFC3339 timestamp. Empty defaults to 24h before end_time. Example: 2026-01-02T15:04:05Z. |
end_time | no | End of the query window (exclusive) as an RFC3339 timestamp. Empty defaults to now, or to 24h after start_time when only start_time is set. |
step | no | Bucket granularity. Unset (STEP_UNSPECIFIED) picks a step scaled to the query window; see Step. |
group_by | no | Optional breakdown dimension; omit for none. |
Response fields:
| Field | Required | Description |
|---|---|---|
metric | output-only | Metric name that was queried. |
entity | output-only | Entity the metric was queried for. |
window | output-only | Time window and bucket step the series cover. |
series | output-only | One time series per group (or a single series when ungrouped). |
summary | output-only | Per-window rollup across the series. |
{"signatures":{"go":"func (x *CustomerMetricsClient) GetApiKeyMetric(ctx context.Context, req *metricsv1.GetApiKeyMetricRequest) (*metricsv1.MetricsResponse, error)","python":"get_api_key_metric(req: metrics_pb2.GetApiKeyMetricRequest) -\u003e MetricsResponse","typescript":"getApiKeyMetric(req: MessageInitShape\u003ctypeof tars_metrics_v1_metrics_pb.GetApiKeyMetricRequestSchema\u003e): Promise\u003cMetricsResponse\u003e","cli":"tare api metrics api-key get --api-key-id $API_KEY_ID --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../api_keys/01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tmetricsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/metrics/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026metricsv1.GetApiKeyMetricRequest{}\n\n\tresp, err := client.CustomerMetrics().GetApiKeyMetric(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/customermetrics/getapikeymetric\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom tars.metrics.v1 import metrics_pb2\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Populate the request fields -- see the \"Request fields\" table above\n# for the available fields and which are required.\nreq = metrics_pb2.GetApiKeyMetricRequest()\ntry:\n result = client.customer_metrics.get_api_key_metric(req)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.customerMetrics.getApiKeyMetric(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"customermetrics\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api metrics api-key get --api-key-id $API_KEY_ID --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../api_keys/01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/api_keys/{api_key_id}/metrics/{metric}","slug":"get-a-metric-for-an-api-key"}
Get a project metric
What it does: Returns a project-level metric. The caller must be a member of the (customer, project) scope.
Request fields:
| Field | Required | Description |
|---|---|---|
customer_id | no | Customer that owns the project. Defaults to the caller's session customer when empty. |
project_id | no | Project to query. Defaults to the caller's session project when empty. |
metric | yes | Metric name from the catalog. |
start_time | no | Start of the query window (inclusive) as an RFC3339 timestamp. Empty defaults to 24h before end_time. Example: 2026-01-02T15:04:05Z. |
end_time | no | End of the query window (exclusive) as an RFC3339 timestamp. Empty defaults to now, or to 24h after start_time when only start_time is set. |
step | no | Bucket granularity. Unset (STEP_UNSPECIFIED) picks a step scaled to the query window; see Step. |
group_by | no | Optional breakdown dimension; omit for none. |
Response fields:
| Field | Required | Description |
|---|---|---|
metric | output-only | Metric name that was queried. |
entity | output-only | Entity the metric was queried for. |
window | output-only | Time window and bucket step the series cover. |
series | output-only | One time series per group (or a single series when ungrouped). |
summary | output-only | Per-window rollup across the series. |
{"signatures":{"go":"func (x *CustomerMetricsClient) GetProjectMetric(ctx context.Context, req *metricsv1.GetProjectMetricRequest) (*metricsv1.MetricsResponse, error)","python":"get_project_metric(req: metrics_pb2.GetProjectMetricRequest) -\u003e MetricsResponse","typescript":"getProjectMetric(req: MessageInitShape\u003ctypeof tars_metrics_v1_metrics_pb.GetProjectMetricRequestSchema\u003e): Promise\u003cMetricsResponse\u003e","cli":"tare api metrics project get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tmetricsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/metrics/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026metricsv1.GetProjectMetricRequest{}\n\n\tresp, err := client.CustomerMetrics().GetProjectMetric(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/customermetrics/getprojectmetric\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom tars.metrics.v1 import metrics_pb2\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Populate the request fields -- see the \"Request fields\" table above\n# for the available fields and which are required.\nreq = metrics_pb2.GetProjectMetricRequest()\ntry:\n result = client.customer_metrics.get_project_metric(req)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.customerMetrics.getProjectMetric(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"customermetrics\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api metrics project get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/customers/cust_01H.../projects/proj_01H.../metrics/01H...\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/customers/{customer_id}/projects/{project_id}/metrics/{metric}","slug":"get-a-project-metric"}
Get a metric for the calling user
What it does: Returns a USER-layer metric for the calling user, resolved entirely from the session token -- no tenancy scope is required.
Request fields:
| Field | Required | Description |
|---|---|---|
metric | yes | Metric name from the catalog. |
start_time | no | Start of the query window (inclusive) as an RFC3339 timestamp. Empty defaults to 24h before end_time. Example: 2026-01-02T15:04:05Z. |
end_time | no | End of the query window (exclusive) as an RFC3339 timestamp. Empty defaults to now, or to 24h after start_time when only start_time is set. |
step | no | Bucket granularity. Unset (STEP_UNSPECIFIED) picks a step scaled to the query window; see Step. |
group_by | no | Optional breakdown dimension; omit for none. |
Response fields:
| Field | Required | Description |
|---|---|---|
metric | output-only | Metric name that was queried. |
entity | output-only | Entity the metric was queried for. |
window | output-only | Time window and bucket step the series cover. |
series | output-only | One time series per group (or a single series when ungrouped). |
summary | output-only | Per-window rollup across the series. |
{"signatures":{"go":"func (x *CustomerMetricsClient) GetMyMetric(ctx context.Context, req *metricsv1.GetMyMetricRequest) (*metricsv1.MetricsResponse, error)","python":"get_my_metric(req: metrics_pb2.GetMyMetricRequest) -\u003e MetricsResponse","typescript":"getMyMetric(req: MessageInitShape\u003ctypeof tars_metrics_v1_metrics_pb.GetMyMetricRequestSchema\u003e): Promise\u003cMetricsResponse\u003e","cli":"tare api metrics me get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/me/metrics/01H...\" \\\n -H \"Authorization: Bearer $SESSION_TOKEN\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_SESSION_TOKEN in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tmetricsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/metrics/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithSessionToken(os.Getenv(\"AGENTROUTER_SESSION_TOKEN\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026metricsv1.GetMyMetricRequest{}\n\n\tresp, err := client.CustomerMetrics().GetMyMetric(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/customermetrics/getmymetric\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_SESSION_TOKEN in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom tars.metrics.v1 import metrics_pb2\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n session_token=os.environ[\"AGENTROUTER_SESSION_TOKEN\"],\n)\n\n# Populate the request fields -- see the \"Request fields\" table above\n# for the available fields and which are required.\nreq = metrics_pb2.GetMyMetricRequest()\ntry:\n result = client.customer_metrics.get_my_metric(req)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_SESSION_TOKEN in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n sessionToken: process.env.AGENTROUTER_SESSION_TOKEN,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.customerMetrics.getMyMetric(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"customermetrics\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api metrics me get --metric $METRIC","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/me/metrics/01H...\" \\\n -H \"Authorization: Bearer $SESSION_TOKEN\""},"persona":"Dashboard user (session token)","httpVerb":"GET","httpPath":"/v1/me/metrics/{metric}","slug":"get-a-metric-for-the-calling-user"}
List available metrics
What it does: Returns DPO's metric catalog: the known metrics, the layers and endpoint-layers supported, and the raw-metric passthrough route (DPO#22). The catalog is non-sensitive discovery metadata, so it is exposed here to every authenticated caller -- not just admin -- with no tenancy scope or special scope required. Uses a distinct path from the admin MetricsService.ListMetrics (/v1/metrics) to avoid colliding with GetMetric's /v1/metrics/{metric}.
Request body: None.
Response fields:
| Field | Required | Description |
|---|---|---|
metrics | output-only | Metrics DPO knows how to compute. |
layers | output-only | Layers accepted by GetMetric's layer field. |
endpoint_layers | output-only | Subset of layers that support the endpoint (child-of-entity) dimension. |
raw | output-only | The raw-metric passthrough route (DPO#21). |
{"signatures":{"go":"func (x *CustomerMetricsClient) ListMetrics(ctx context.Context, req *metricsv1.ListMetricsRequest) (*metricsv1.MetricCatalog, error)","python":"list_metrics(req: metrics_pb2.ListMetricsRequest) -\u003e MetricCatalog","typescript":"listMetrics(req: MessageInitShape\u003ctypeof tars_metrics_v1_metrics_pb.ListMetricsRequestSchema\u003e): Promise\u003cMetricCatalog\u003e","cli":"tare api metrics catalog","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/metric-catalog\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":{"files":[{"name":"main.go","content":"// Command example is a runnable example for the AgentRouter Go SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then `go run .`.\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\tagentrouter \"github.com/tetrateio/agentrouter-go\"\n\tmetricsv1 \"github.com/tetrateio/agentrouter-go/genapi/api/tars/metrics/v1\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tclient, err := agentrouter.New(ctx,\n\t\tagentrouter.WithBaseURL(os.Getenv(\"AGENTROUTER_BASE_URL\")),\n\t\tagentrouter.WithAPIKey(os.Getenv(\"AGENTROUTER_API_KEY\")),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"client: %v\", err)\n\t}\n\n\t// Populate the request fields -- see the \"Request fields\" table above for\n\t// the available fields and which are required.\n\treq := \u0026metricsv1.ListMetricsRequest{}\n\n\tresp, err := client.CustomerMetrics().ListMetrics(ctx, req)\n\tif err != nil {\n\t\tlog.Fatalf(\"call: %v\", err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", resp)\n}\n"},{"name":"go.mod","content":"module github.com/tetrateio/agentrouter-go-examples/customermetrics/listmetrics\n\ngo 1.26\n\nrequire github.com/tetrateio/agentrouter-go v0.1.1\n\n// Point this at the directory you extracted the downloaded Go SDK tarball into.\n// The directory name matches the tarball stem on the Download SDK page.\nreplace github.com/tetrateio/agentrouter-go =\u003e ./third_party/agentrouter-go-0.1.1\n"}]},"python":{"files":[{"name":"main.py","content":"\"\"\"Runnable example for the AgentRouter Python SDK.\n\nSet AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.\n\"\"\"\nimport os\n\nfrom tars.metrics.v1 import metrics_pb2\n\nfrom agentrouter_sdk import Client\n\nclient = Client(\n base_url=os.environ[\"AGENTROUTER_BASE_URL\"],\n api_key=os.environ[\"AGENTROUTER_API_KEY\"],\n)\n\n# Populate the request fields -- see the \"Request fields\" table above\n# for the available fields and which are required.\nreq = metrics_pb2.ListMetricsRequest()\ntry:\n result = client.customer_metrics.list_metrics(req)\n print(result)\nexcept Exception as err:\n print(\"Error:\", err)\n"},{"name":"requirements.txt","content":"# Point this at the directory you extracted the downloaded Python SDK tarball\n# into. The directory name matches the tarball stem on the Download SDK page.\n# To install instead from PyPI once published, replace the line below with:\n# agentrouter-sdk\u003e=0.1.0\nagentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1\n"}]},"typescript":{"files":[{"name":"index.ts","content":"// Runnable example for the AgentRouter TypeScript SDK.\n// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install \u0026\u0026 npx tsx index.ts`.\nimport { Client } from '@tetrate/agentrouter-sdk'\n\nconst client = new Client({\n baseUrl: process.env.AGENTROUTER_BASE_URL,\n apiKey: process.env.AGENTROUTER_API_KEY,\n})\n\n// Populate the request fields -- see the \"Request fields\" table above\n// for the available fields and which are required.\nconst req = {}\ntry {\n const result = await client.customerMetrics.listMetrics(req)\n console.log(result)\n} catch (err) {\n console.error('Error:', err)\n}\n"},{"name":"package.json","content":"{\n \"name\": \"customermetrics\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"dependencies\": {\n \"@tetrate/agentrouter-sdk\": \"file:./third_party/agentrouter-typescript-0.1.1\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.4.0\"\n }\n}\n"},{"name":"tsconfig.json","content":"{\n \"compilerOptions\": {\n \"target\": \"ES2020\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"esModuleInterop\": true,\n \"skipLibCheck\": true\n }\n}\n"}]},"cli":"tare api metrics catalog","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/metric-catalog\" \\\n -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Authenticated (API key or session token)","httpVerb":"GET","httpPath":"/v1/metric-catalog","slug":"list-available-metrics"}