Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:ArroyoSystems Arroyo Metrics Api Types

From Leeroopedia


Knowledge Sources
Domains Streaming, Metrics, API
Last Updated 2026-02-08 08:00 GMT

Overview

Defines the API-level types for representing operator and subtask metrics in the Arroyo REST API, including metric names, time-series data points, and hierarchical metric groupings.

Description

This module provides a compact set of serializable types for the metrics API:

  • MetricName -- an enum of tracked metric types: BytesRecv, BytesSent, MessagesRecv, MessagesSent, Backpressure, TxQueueSize, TxQueueRem. Derives EnumCount and EnumString from strum for iteration and parsing.
  • Metric -- a single time-series data point with a time (u64 timestamp) and value (f64).
  • SubtaskMetrics -- metrics for a single subtask, identified by index with a vector of Metric data points.
  • MetricGroup -- groups SubtaskMetrics under a specific MetricName.
  • OperatorMetricGroup -- groups MetricGroups under a specific node_id (operator).

Usage

Use these types when building the metrics endpoint in the Arroyo API server to return operator-level and subtask-level time-series data to the UI dashboard.

Code Reference

Source Location

Signature

pub enum MetricName {
    BytesRecv, BytesSent, MessagesRecv, MessagesSent,
    Backpressure, TxQueueSize, TxQueueRem,
}

pub struct Metric { pub time: u64, pub value: f64 }
pub struct SubtaskMetrics { pub index: u32, pub metrics: Vec<Metric> }
pub struct MetricGroup { pub name: MetricName, pub subtasks: Vec<SubtaskMetrics> }
pub struct OperatorMetricGroup { pub node_id: u32, pub metric_groups: Vec<MetricGroup> }

Import

use arroyo_rpc::api_types::metrics::{MetricName, Metric, SubtaskMetrics, MetricGroup, OperatorMetricGroup};

I/O Contract

Inputs

Name Type Required Description
node_id u32 Yes Operator node identifier
name MetricName Yes Which metric is being reported
index u32 Yes Subtask index within the operator

Outputs

Name Type Description
OperatorMetricGroup OperatorMetricGroup Hierarchical metric data for an operator (serialized as JSON)

Usage Examples

use arroyo_rpc::api_types::metrics::{MetricName, Metric, SubtaskMetrics, MetricGroup};

let metrics = MetricGroup {
    name: MetricName::MessagesRecv,
    subtasks: vec![
        SubtaskMetrics {
            index: 0,
            metrics: vec![
                Metric { time: 1700000000, value: 1500.0 },
                Metric { time: 1700000060, value: 1620.0 },
            ],
        },
    ],
};

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment