Skip to content

Query metrics

Run an arbitrary PromQL query against your APM / infra metric backend when Metric overlay and Metrics that moved don't cover the question. Returns the raw Prometheus response plus which backend served it (Grafana Cloud, AMP, Datadog Prometheus, Log10x cloud, or generic Prom).

Example

You

run apm_request_duration_p99{service="payments-svc"} now

Log10x

apm_request_duration_p99{service="payments-svc",pod="payments-7c4f"} 4823.2
apm_request_duration_p99{service="payments-svc",pod="payments-9d1a"} 5102.4
apm_request_duration_p99{service="payments-svc",pod="payments-2b8e"} 4901.7

Backend: grafana_cloud, served in 142ms.

More to ask

  • "range query last hour, minute granularity, payments-svc p99"
  • "verify kafka_consumer_lag exists in our backend"
  • "label values for service on apm_request_duration_p99"

Prerequisites

LOG10X_CUSTOMER_METRICS_URL configured with one of these LOG10X_CUSTOMER_METRICS_TYPE values:

  • grafana_cloud — Grafana Cloud, auth via API key with MetricsReader scope.
  • amp — AWS Managed Prometheus, auth via SigV4 from ambient AWS credentials.
  • datadog_prom — Datadog's Prometheus-compatible read API, auth via DD_API_KEY + DD_APP_KEY.
  • log10x — Log10x cloud metrics (prometheus.log10x.com), auth as <api_key>/<env_id> in LOG10X_CUSTOMER_METRICS_AUTH.
  • generic_prom — any Prometheus-compatible endpoint with Bearer-token or no auth.

Schema and samples

Input example

Real call against the demo env (captured by scripts/capture-tool-envelopes.mjs).

{
  "promql": "sum(rate(all_events_summaryBytes_total[5m]))",
  "mode": "instant",
  "view": "summary"
}
Input schema

Agent-facing JSON Schema (the canonical shape the MCP server publishes via tools/list):

{
  "type": "object",
  "properties": {
    "promql": {
      "type": "string",
      "description": "PromQL expression to execute against the customer metric backend. Example: `apm_request_duration_p99{service=\"payments-svc\"}`."
    },
    "mode": {
      "type": "string",
      "enum": [
        "instant",
        "range"
      ],
      "default": "instant",
      "description": "`instant` runs a point-in-time query; `range` runs over a time window with a bucket step."
    },
    "start": {
      "type": "string",
      "description": "Start of the range window — ISO8601 or UNIX seconds. Required when mode=range."
    },
    "end": {
      "type": "string",
      "description": "End of the range window. Required when mode=range."
    },
    "step": {
      "type": "string",
      "description": "Bucket step for range queries, in seconds. Required when mode=range."
    }
  },
  "required": [
    "promql"
  ],
  "additionalProperties": false
}

Source: src/tools/customer-metrics-query.ts.

Output example

Real envelope from the demo env. view: "summary" returns the full StructuredOutput with typed data. Long arrays + base64 PNG bodies trimmed for readability; the real call returns them in full.

Headline (the 1-line agent-facing answer):

log10x query sum(rate(all\_events\_summaryBytes\_total[5m])): 1 series returned (vector).

{
  "schema_version": "1.0",
  "schema_epoch": "2026-05-25",
  "tool": "log10x_customer_metrics_query",
  "generated_at": "2026-05-26T15:38:01.889Z",
  "view": "summary",
  "summary": {
    "headline": "log10x query `sum(rate(all_events_summaryBytes_total[5m]))`: 1 series returned (vector)."
  },
  "data": {
    "promql": "sum(rate(all_events_summaryBytes_total[5m]))",
    "backend": "log10x",
    "mode": "instant",
    "result_type": "vector",
    "series_count": 1,
    "shown_count": 1,
    "series": [
      {
        "metric_name": "result",
        "labels": {},
        "instant_value": {
          "value": "82151.29285214993",
          "timestamp": 1779809881
        }
      }
    ]
  },
  "actions": [],
  "truncated": false,
  "warnings": []
}
Output schema

The data block inside the StructuredOutput envelope:

interface ToolData {
  promql: string;
  backend: string;
  mode: string;
  result_type: string;
  series_count: number;
  shown_count: number;
  series: Array<{
    metric_name: string;
    labels: {  };
    instant_value: { value: string; timestamp: number };
  }>;
}

Envelope-level fields the agent should also read: summary.headline (1-line answer), actions[] (next-call chain hints as {tool, args, reason}), truncated: boolean, images[] (PNG attachments where applicable), schema_epoch (engine-ID stability boundary).