Server Metrics Collection
AIPerf automatically collects metrics from Prometheus-compatible endpoints exposed by LLM inference servers and serving frontends (vLLM, SGLang, TRT-LLM, Dynamo, Triton, etc.).
Long runs and collection failures
Numeric sample histories, including scrape timestamps and histogram buckets, are
stored in an anonymous file on the artifact filesystem. All samples remain
available for exact aggregation and Parquet export; collection does not retain
the complete numeric history in resident memory. Use disk-backed artifact
storage rather than a memory-backed emptyDir or tmpfs for long runs.
Backing-file growth reserves disk space before exposing writable mappings.
If reservation fails because the volume is full, collection stops with an
explicit error and retains previously collected samples for export. Periodic
flushes synchronize and release only recently accessed page ranges, including
array-growth copies and out-of-order inserts, rather than scanning the full
retained history.
AIPERF_SERVER_METRICS_STORAGE_MAX_BYTES limits the backing file, including
array-growth allocations (default 16 GiB).
AIPERF_SERVER_METRICS_STORAGE_FLUSH_BYTES controls flush and page-cache release
frequency (default 8 MiB). AIPERF_SERVER_METRICS_MAX_SERIES limits distinct
endpoint/name/label combinations (default 20,000), including changing labels.
Slow endpoints have at most one periodic scrape in flight; busy ticks are
skipped. Phase-boundary scrapes can still overlap a periodic scrape.
Exceeding a storage or series budget stops server-metrics collection and reports
an explicit error. Already collected samples are exported where possible, while
inference request processing and final client-metric exports continue. Terminal
resource failures report a degraded run after export; recoverable scrape errors
remain advisory. The
primary profile_export_aiperf.json includes server_metrics_error_summary so
missing telemetry cannot be mistaken for a complete server-metrics history.
Fatal collector failures remain in this export even if the collector later
reconnects or restarts.
Delayed failure notifications from a stopped collector also leave inference
processing and final export running.
Aggregation and disk writes run outside the service heartbeat event loop.
On Kubernetes, the optional metrics process runs as a restartable native sidecar. Its OOM kill or liveness restart does not terminate the controller job. A restarted process cannot recover its predecessor’s anonymous sample store; the controller releases that result producer, reports incomplete telemetry, and exports the inference results with a degraded run status. Native sidecars require Kubernetes 1.29+; disable server metrics on older supported clusters.
Quick Reference
Key metrics by server:
vLLM
Dynamo
SGLang
SGLang server-side setup is required. SGLang does not expose Prometheus exposition format at /metrics by default. Launch the server with --enable-metrics:
Without this flag, GET /metrics returns 404 and AIPerf’s auto-discovery silently falls back to no server-metrics collection (server_metrics_export.* files will not be produced).
TRT-LLM
TRT-LLM server-side setup is required. Unlike vLLM, trtllm-serve does not expose Prometheus exposition format at /metrics by default — the default /metrics returns an iteration-stats JSON array (application/json), which is not parseable as Prometheus. Two consequences:
- Enable Prometheus on the server. Pass
return_perf_metrics: truein yourextra_llm_api_options.yaml. This mounts the proper Prometheus exposition at/prometheus/metrics(a non-standard path). Addenable_iter_perf_stats: truewhen you want iteration-derived queue/KV/memory metrics from the PyTorch backend. - AIPerf auto-detects and falls back. When AIPerf hits
/metricsand getsapplication/json, it automatically probes<base>/prometheus/metricsonce. If the alt path serves Prometheus, AIPerf swaps the URL and continues — no manual override needed. If the alt path also fails (e.g.return_perf_metricswas not set), the collector auto-disables for the remainder of the run with a single warning.
Example extra_llm_api_options.yaml snippet:
Triton Inference Server
Triton serves Prometheus metrics at http://localhost:8002/metrics by default, not on the inference HTTP port. Use --server-metrics http://HOST:8002/metrics when the inference URL and metrics URL differ. Triton latency summaries are ignored by AIPerf; enable --metrics-config histogram_latencies=true for first-response histogram percentiles.
Quick Start
Server metrics are collected by default - just run AIPerf normally:
AIPerf automatically:
- Discovers the
/metricsendpoint on your inference server (base URL +/metrics) - Tests endpoint reachability before profiling starts
- Captures baseline metrics before warmup period begins (reference point for deltas) — also where AIPerf first parses the response and validates it as Prometheus exposition format; see Compatibility & auto-disable for what happens when an endpoint returns non-Prometheus content
- Collects metrics at configurable intervals during warmup and profiling
- Performs final scrape after profiling completes (captures end state)
- Exports selected formats (default: JSON + CSV + Parquet):
server_metrics_export.json- Aggregated statistics (profiling period only)server_metrics_export.csv- Tabular format (profiling period only)server_metrics_export.parquet- Raw time-series with delta calculationsserver_metrics_export.jsonl- Time-series data (all scrapes, opt-in only)
Custom file naming: The --profile-export-prefix (or --profile-export-file) flag changes the prefix for all export files, including server metrics. Any file extension is automatically stripped from the provided value. For example:
Time filtering: Statistics in JSON/CSV exports exclude the warmup period, showing only metrics from the profiling phase. The JSONL file contains all scrapes (including warmup) for complete time-series analysis.
Format selection: By default, JSON, CSV, and Parquet formats are generated (JSONL is opt-in to avoid large files). To opt out of Parquet, or to include JSONL for time-series analysis:
Adding Custom Endpoints
Kubernetes auto-discovery
When AIPerf runs in Kubernetes, server_metrics.discovery can add inference-pod
Prometheus endpoints to the endpoints derived from endpoint.urls and the explicit
server_metrics.urls list:
mode: auto (the default) uses Kubernetes discovery only when AIPerf is running
in-cluster. mode: kubernetes requires the Kubernetes path and warns when used
outside a cluster. mode: disabled uses only URL-derived and explicit endpoints.
Discovery is best-effort: a timeout or API error does not prevent the benchmark
from using its other endpoints.
If namespace is omitted, discovery searches only the benchmark pod’s own
namespace, resolved from AIPERF_NAMESPACE or its mounted ServiceAccount namespace.
It never silently expands to cluster scope. namespace: "*" is the explicit
all-namespace mode and requires a cluster-scoped pods: list grant. To discover a
server in another named namespace, add that namespace to the operator chart’s
serverMetricsDiscoveryNamespaces value; if the benchmark pod uses a custom
ServiceAccount, use the chart’s {namespace, serviceAccounts} entry form. See
Kubernetes RBAC and security.
The built-in eligibility rules select Dynamo’s
nvidia.com/metrics-enabled=true pods, pods with
aiperf.nvidia.com/metrics-paths, and recognized inference-server images. A supplied
label_selector explicitly selects matching pods. A generic
prometheus.io/scrape=true annotation alone is not enough, which avoids collecting
unrelated Loki, Grafana, and cluster-monitoring endpoints. Eligible pods can use the
standard prometheus.io/{port,path,scheme} annotations; the AIPerf paths annotation
accepts a comma-separated path list. Discovered paths are used as declared after
adding a leading slash when needed; AIPerf does not append /metrics to a custom
annotation path.
RBAC prerequisites
Discovery lists pods using the benchmark pod’s ServiceAccount:
For example, to allow benchmarks in the chart-configured benchmark namespace to
discover Dynamo in dynamo-server:
Then set server_metrics.discovery.namespace: dynamo-server in the AIPerf YAML.
A denied pod list emits a warning naming the namespace and required grant; it does
not fail the benchmark.
Disabling Server Metrics
Selecting Output Formats
Compatibility & auto-disable
AIPerf scrapes /metrics at ~3 Hz and parses the response as Prometheus exposition format. When a server speaks something else at that path (most commonly TRT-LLM, which serves an iteration-stats JSON array), AIPerf does not retry-and-spam — it detects the mismatch on the first scrape and disables collection for that endpoint with a single log line. This avoids the failure mode where parse errors at the scrape interval inflate run time by 10×+.
Detection. A response is treated as non-Prometheus when either:
- the HTTP
Content-Typeisapplication/json(the response body is never read in this case — the rejection is cheaper than parsing); or - the body fails to parse as Prometheus exposition format (
prometheus_client.parser.text_string_to_metric_familiesraisesValueError— e.g. a server returnstext/plainwith garbage, or a JSON body without a content-type).
TRT-LLM /prometheus/metrics fallback. Before disabling, AIPerf probes <base>/prometheus/metrics exactly once — TRT-LLM mounts the proper Prometheus path there when launched with return_perf_metrics: true (see the TRT-LLM entry in the Quick Reference table above). If the probe succeeds, the collector swaps its URL there and the run continues with the alt endpoint. The probe is attempted whenever the configured URL ends with /metrics and is not already /prometheus/metrics itself — so /metrics, /v1/metrics, and /api/metrics all trigger the fallback probe. URLs that don’t end in /metrics (e.g. /stats, /telemetry) are left untouched, and /prometheus/metrics is excluded to avoid probing the same path it would swap to.
On auto-disable. A single WARNING is emitted naming the endpoint and the suppression flag. Subsequent scrape cycles short-circuit, the collector emits no further log noise, and the rest of the benchmark proceeds normally — other configured endpoints (DCGM telemetry, additional --server-metrics URLs) are unaffected.
To suppress the warning entirely, pass --no-server-metrics — collection is skipped, no probe is attempted, no warning is logged.
Warmup / profiling phase boundary
When server metrics collection is runtime-active (configure found at least one reachable Prometheus endpoint), AIPerf coordinates the warmup-to-profiling transition so late histogram observations cannot leak into profiling deltas:
- Both
ServerMetricsManagerandPhaseRunnerwait forAIPERF_SERVER_METRICS_COLLECTION_FLUSH_PERIODagainst the same absolute deadline. - The manager suspends periodic scrapes, drains in-flight warmup-tagged scrapes, takes a final warmup scrape, then publishes
SERVER_METRICS_WARMUP_BOUNDARY_READY. - The runner does not return from warmup (so profiling credits cannot start) until that acknowledgement arrives.
If the acknowledgement is missing while collection is active, the runner aborts with a TimeoutError before profiling credits start. That fail-closed contract protects attribution when collectors are live but slow. The status wait before phases start is deliberately fail-open: if ServerMetricsStatusMessage has not arrived within min(SCRAPE_TIMEOUT, 5) seconds, there is no evidence any collector is live (the common cause is an unreachable /metrics with the default enabled=True, where the manager has already shut down and would never ack), so phases start with the barrier off and a warning is logged rather than failing the run.
When collection is runtime-inactive (no reachable /metrics, or --no-server-metrics), the flush and ack waits are skipped entirely. The benchmark proceeds without server-metrics exports, matching the behaviour when server metrics were never enabled.
The ack wait budget defaults to COLLECTION_FLUSH_PERIOD + SCRAPE_TIMEOUT * (N + 2) + 5, where N is the reachable collector count from ServerMetricsStatusMessage; that covers the manager’s worst case of one scrape timeout draining in-flight scrapes, one waiting on cancelled periodic scrapes, and N serial final scrapes. Set AIPERF_SERVER_METRICS_WARMUP_BOUNDARY_TIMEOUT to override that derived budget.
Configuration
Output Files
The filenames below are defaults. When --profile-export-prefix <prefix> is used, server metrics files are named <prefix>_server_metrics.{json,csv,jsonl,parquet} (any file extension in the prefix is stripped automatically). All files are written to the artifact directory (--artifact-dir / --output-artifact-dir, default: ./artifacts/<run_info>).
1. Time-Series: server_metrics_export.jsonl
Line-delimited JSON with metrics snapshots over time:
Fields:
endpoint_url: Source Prometheus endpointtimestamp_ns: Collection timestamp in nanosecondsendpoint_latency_ns: HTTP round-trip time in nanosecondsmetrics: All metrics from this endpoint- Counter/Gauge:
{"value": N}or{"labels": {...}, "value": N} - Histogram:
{"buckets": {"le": count}, "sum": N, "count": N}with optional labels
- Counter/Gauge:
2. Aggregated Statistics: server_metrics_export.json
Aggregated statistics from profiling period. Metrics from all endpoints are merged, each series tagged with endpoint_url.
In named multi-phase runs, server_metrics_export.json remains the run-level export for existing readers. For exact server metrics from one phase, use phases/<phase_name>/server_metrics.json; phase_manifest.json lists which phase files were written.
Query with jq:
3. CSV Export: server_metrics_export.csv
Tabular export organized in five sections (separated by blank lines): gauge, counter, histogram, unknown, info. The unknown section holds families that the Prometheus server declared as # TYPE foo untyped (or with no # TYPE line at all); they use the same statistics columns as gauges.
- Labels expanded into individual columns for easy filtering/pivoting
- Open directly in Excel/Sheets or load with pandas
4. Parquet Export: server_metrics_export.parquet
Raw time-series data with delta calculations applied. Uses a normalized schema (~50% smaller than wide format) where histogram buckets are separate rows. Each label becomes a column for SQL filtering.
Schema overview:
See Parquet Schema Reference for complete schema, metadata, and query examples.
Related documentation:
- JSON Schema Reference - Complete JSON export format specification
- Server Metrics Reference - Metric definitions by backend (vLLM, SGLang, TRT-LLM, Dynamo, Triton)
- Parquet Schema Reference - Raw time-series data schema
Quick examples:
Statistics by Metric Type
Now that you understand the output formats, let’s examine how statistics are structured within each metric type.
Statistics are nested under a stats field within each series item. All metrics use the stats format for consistent API access.
Gauge (point-in-time values)
Statistics: avg, min, max, std, p1, p5, p10, p25, p50, p75, p90, p95, p99
Gauge percentiles are computed from actual collected samples (not estimated from buckets).
Counter (cumulative totals)
Statistics: total, rate, and when --slice-duration is set: rate_avg, rate_min, rate_max, rate_std
total: Change during profiling period (uses last pre-profiling sample as reference)rate: Increase per second (total/duration)- Counter resets are detected and handled (negative deltas → total = 0)
Histogram (distributions)
Statistics (stats): count, count_rate, sum, sum_rate, avg, p1_estimate, p5_estimate, p10_estimate, p25_estimate, p50_estimate, p75_estimate, p90_estimate, p95_estimate, p99_estimate
Series-level field: buckets (per-bucket delta counts, not cumulative)
avg(sum/count) is exact- Percentiles are estimates from bucket interpolation
Prometheus Summary metrics are not supported. Summary quantiles are computed cumulatively over the entire server lifetime, making them unsuitable for benchmark-specific analysis. Use Histogram families for percentile estimation when the server offers them. Rare optional Summary families, such as SGLang’s sglang:eplb_balancedness, Triton’s nv_inference_*_summary_us, or Triton’s response-cache nv_cache_*_summary_per_model, are ignored by AIPerf exports.
Timesliced Statistics
When configured with --slice-duration, AIPerf computes windowed statistics over fixed time intervals. Each series includes a timeslices array with per-window statistics:
- Gauges: Each timeslice contains
avg,min,max - Counters: Each timeslice contains
total,rate - Histograms: Each timeslice contains
count,sum,avg,buckets
Partial timeslices (at the end of the collection period) are marked with is_complete: false and excluded from aggregate statistics (e.g., rate_avg, rate_min) to ensure fair comparison. Individual timeslice data includes both complete and partial slices for data completeness.
Labeled Metrics
Prometheus metrics with labels (e.g., model, status) are aggregated separately for each unique label combination. When collecting from multiple endpoints, series are merged together with each tagged by endpoint_url.
Unit Inference
AIPerf automatically infers units from metric names and descriptions using standard Prometheus conventions (_seconds, _bytes, _requests, etc.). Units appear in both JSON and CSV exports. The unit field is optional—if no unit can be inferred, it’s omitted.