Skip to content

Gateway Mode

Starting with RBLN Metrics Exporter v0.3.0, a single exporter instance can collect metrics from multiple remote hosts in gateway mode. Gateway mode follows the multi-target exporter pattern provided by Prometheus and is intended for bare-metal or non-Kubernetes environments where deploying an exporter per host is impractical.

Aspect local (default) gateway
Deployment One per node (DaemonSet) One central instance
Collection target rbln-smd on the local node Remote rbln-smd specified per scrape
Target selection None (own node) Query parameter ?target=<host:port>
Kubernetes pod labels Provided Not provided (hardware metrics only)

Operation

When Prometheus scrapes /metrics?target=<host:port> on the gateway, the gateway connects to the target's rbln-smd over gRPC, collects the full set of metrics on demand, and returns them in Prometheus format. The gateway does not retain metric state between requests or maintain a target list. The Prometheus scrape configuration defines the targets. The gateway caches gRPC connections for each target and reconnects automatically if a connection is lost.

Gateway Startup

The exporter runs in one of two execution modes, selected at startup with the --mode flag or the RBLN_METRICS_EXPORTER_MODE environment variable.

rbln-metrics-exporter --mode=gateway --port=9200

Prometheus Scrape Configuration

List the NPU host addresses under targets. Use relabel_configs to pass each address as the target query parameter and direct HTTP requests to the gateway.

scrape_configs:
  - job_name: rbln-npu-gateway
    metrics_path: /metrics
    static_configs:
      - targets:
          - npu-host-1:50051   # rbln-smd gRPC address of each NPU host
          - npu-host-2:50051
    relabel_configs:
      # 1. Copy each listed address into the ?target= query parameter.
      - source_labels: [__address__]
        target_label: __param_target
      # 2. Keep it as the instance label so series can be distinguished per host.
      - source_labels: [__param_target]
        target_label: instance
      # 3. Send the HTTP request to the gateway, not the NPU host.
      - target_label: __address__
        replacement: rbln-gateway:9200   # gateway exporter address

With this configuration, Prometheus sends a scrape request to the gateway for each host. For example, it scrapes http://rbln-gateway:9200/metrics?target=npu-host-1:50051 for npu-host-1 and stores the returned series with the instance="npu-host-1:50051" label.

Scrape timeout

The gateway collects metrics during each scrape request, so slow responses from target hosts increase collection time. The gateway honors the timeout in the X-Prometheus-Scrape-Timeout-Seconds header sent by Prometheus. Increase Prometheus's scrape_timeout if collection needs more time.