ZeroCopyZeroCopy
Account

Metrics API

Scrape your team's transaction and Shredstream metrics into Prometheus or Grafana, or read historical metric series as JSON

Use the Metrics API to monitor your team's SWQoS traffic and Shredstream receivers in Grafana. Partners also receive metrics for their customer keys.

GET /api/v1/metrics returns Prometheus text exposition. For historical queries, use GET /api/v1/metrics/series. Both endpoints require a management key with usage:read.

Create a management key

On your team's API keys page, create a management key and select usage:read. Only a team admin can create it, after identity verification. Save the zc_mgmt_ secret when it appears; the console shows it once.

Choose a lifetime of 30, 90 or 365 days. If you set an IP restriction, allow the addresses your scraper uses. Create a replacement and update the scraper before the key expires, then revoke the old key. An SWQoS API key cannot authenticate metrics requests.

Scrape with Prometheus

Add this job to your Prometheus configuration. Replace YOUR_MANAGEMENT_KEY with the management key's secret. Restrict access to the configuration file.

prometheus.yml
scrape_configs:
  - job_name: zerocopy
    scheme: https
    metrics_path: /api/v1/metrics
    scrape_interval: 60s
    honor_timestamps: true
    track_timestamps_staleness: true
    authorization:
      type: Bearer
      credentials: YOUR_MANAGEMENT_KEY
    static_configs:
      - targets: [console.zerocopy.sh]

Each SWQoS sample covers one complete UTC minute, assigned by the transaction's first receipt time. Data is 3 minutes behind. Samples carry the minute's end as an explicit millisecond timestamp. Keep honor_timestamps enabled so Prometheus stores that timestamp. End Grafana graphs at now-3m to account for the lag.

Every metric is a gauge. Counts and SOL amounts are totals for that minute; use the values directly, or sum_over_time() to total stored minutes. rate() and increase() apply to counters and give incorrect results for these gauges. The endpoint emits only series observed in the minute, except zerocopy_key_info, which includes every non-deleted key. A missing series does not assert a zero. track_timestamps_staleness stops a missing timestamped series from staying visible through Prometheus's normal lookback window.

Scraping more often repeats the same minute. Scraping less often, or missing a scrape, can leave gaps: this endpoint does not replay missed minutes. Use the JSON history endpoint when you need historical buckets. Transaction records are best effort and are not a billing ledger.

Records that arrive after a minute was scraped are absent from its stored samples. JSON history reads current records and buckets them by resolution time, so its figures can differ from the scraped receipt-time buckets.

Grafana Cloud

The Metrics Endpoint integration can scrape the endpoint without a Prometheus server:

  1. In Grafana Cloud, open Connections and select Metrics Endpoint.
  2. Create a scrape job named zerocopy with the URL https://console.zerocopy.sh/api/v1/metrics and a one-minute scrape interval.
  3. Choose Bearer authentication. Paste the management key without the Bearer prefix.
  4. Test the connection, then save the job.

If the key has IP restrictions, allow the scraper addresses for your stack's region. Grafana documents them through its Allowlist API. The Metrics Endpoint integration uses the grafana service's addresses.

Import the dashboard

Download the Grafana dashboard JSON. In Grafana, open Dashboards, choose New > Import, then upload the file. Select the Prometheus datasource that stores your ZeroCopy metrics. The dashboard's time range ends three minutes before now.

The Customer and Key selectors use zerocopy_key_info. All customers includes your own keys, whose customer label is empty. SWQoS panels follow both selectors. Shredstream panels show the team's receivers independently of key selection.

Quantile panels show each key separately, with metro where present. Quantiles from different keys or minutes cannot be combined into a team quantile. Panels show No data when their selected series are absent, including a receiver panel for a team without Shredstream receivers.

Metric reference

SWQoS metrics have key_id. Where present, metro is a public metro identifier. quantile is 0.5, 0.9 or 0.99. Key names and customer references appear only on zerocopy_key_info.

MetricLabelsValue
zerocopy_key_infokey_id, name, customer, state1 for each non-deleted key. state is active, expired or revoked; customer is empty for own keys
zerocopy_swqos_transactionskey_id, metro, outcomeTransactions in the minute; outcome is landed, failed or expired
zerocopy_swqos_slots_to_landkey_id, metro, quantileSlots to land for landed transactions
zerocopy_swqos_edge_time_secondskey_id, metro, quantileTime from receipt to forwarding, in seconds
zerocopy_swqos_tips_solkey_id, metroTips in SOL for landed transactions; token tips count at their SOL value when sent
zerocopy_swqos_priority_fees_solkey_id, metroPriority fees in SOL for landed and failed transactions
zerocopy_swqos_failed_transactionskey_id, errorFailed transactions by normalized error; the team's top 20 errors in the minute, with the rest under other. unknown means the error is empty or unparseable
zerocopy_swqos_compute_unit_price_microlamportskey_id, quantileCompute unit price in microlamports per compute unit, for legacy and v0 transactions only; v1 sets a total priority fee
zerocopy_swqos_compute_unit_limitkey_id, quantileRequested compute unit limit
zerocopy_swqos_landed_indexkey_id, quantileZero-based position in the block for landed transactions
zerocopy_swqos_block_engine_submissionskey_id, engine, resultSubmission attempts by result; engine is jito for Jito (BAM), dbi for Jito (DBI), harmonic, everstake or gbx
zerocopy_shredstream_packets_per_secondreceiver_id, receiver, metroPackets delivered per second over the preceding two minutes
zerocopy_shredstream_bytes_per_secondreceiver_id, receiver, metroBytes delivered per second over the preceding two minutes
zerocopy_shredstream_errors_per_secondreceiver_id, receiver, metroDelivery errors per second over the preceding two minutes

Error labels contain at most 120 characters. Normalization removes varying transaction details such as amounts, addresses and instruction indexes.

Block engine submissions

Each attempt counts once, including attempts for bundles with several transactions. For Jito (BAM), the latest status replaces the initial submission answer.

ResultMeaning
acceptedThe engine acknowledged receipt; this does not establish landing
processed, finalizedThe latest Jito (BAM) status
rejected, dropped, error, timeout, rate_limited, unavailableThe engine's corresponding answer
dbi_writtenSent through Jito (DBI)
no_resultHarmonic, Everstake or GBX acknowledged receipt and has no later status
otherAn unrecognized answer

Empty or skipped submissions are omitted.

Show key names and customers

Join transaction values to the info metric with on (key_id) group_left:

Transactions with key names and customers
zerocopy_swqos_transactions
  * on (key_id) group_left (name, customer)
    (topk by (key_id) (1, timestamp(zerocopy_key_info)) > bool 0)

The result retains metro and outcome and adds name and customer. To group by customer, apply sum by (customer, outcome) to the joined expression. Keys without a customer reference have customer="".

topk selects the newest info sample for each key, then > bool 0 turns its timestamp into 1. This avoids duplicate matches while Prometheus still has an older name or customer reference in its lookback window.

JSON history

GET /api/v1/metrics/series returns the same historical metric buckets as the console's Metrics page. Set MANAGEMENT_API_KEY to your management key. Rust and Go use the example project.

src/bin/metric_series.rs
use serde_json::Value;
use swqos_examples::swqos::{Result, required};

#[tokio::main]
async fn main() -> Result<()> {
    let response = reqwest::Client::new()
        .get("https://console.zerocopy.sh/api/v1/metrics/series?metric=transactions&range=24h&group_by=outcome")
        .bearer_auth(required("MANAGEMENT_API_KEY")?)
        .send()
        .await?;
    let status = response.status();
    let body = response.text().await?;
    let reply: Value = serde_json::from_str(&body)
        .map_err(|error| format!("HTTP {status}: {error}; body: {body}"))?;
    if !status.is_success() {
        return Err(format!("HTTP {status}: {reply}").into());
    }
    println!("{}", serde_json::to_string_pretty(&reply)?);
    Ok(())
}

Choose metric from transactions, landed_rate, failed_rate, expired_rate, slots_to_land, edge_time, tips or priority_fees. For slots_to_land and edge_time, use quantile=0.5, 0.9 or 0.99. Group by key, metro, outcome, path, source or kind. Path groups can overlap because a transaction can use several paths.

Use range=1h, 24h (the default), 7d or 30d, or supply RFC 3339 from and to times within the last 90 days. Filter with key_id, metro and outcome; repeat a parameter to select several values. A partner can select a customer key with key_id.

The response includes metric, unit, optional quantile, step_seconds, from, to and series. Each series has labels and points pairs of [unix_ms, value]; a null value means the bucket has no value. Consult the metric history reference for query formats and units.

JSON rates use percent from 0 to 100. JSON edge_time uses microseconds, and tips and priority_fees use lamports. tips includes token tips at their SOL value when sent. The corresponding Prometheus metrics use seconds and SOL.

Rate limits

Each management key can make 600 GET requests per minute across the Management API. Responses include RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Exceeding the limit returns 429 rate_limited and a Retry-After header. IP restrictions apply to both metrics endpoints.

A team can run two analytics requests at once. Prometheus requests count toward this limit only when a cached response is unavailable; JSON history requests always count. Excess concurrent requests return 429 analytics_busy with Retry-After: 1. Use one scrape job per team and let Grafana query Prometheus for its panels.