Skip to main content
Deploy Tero Edge as a sidecar to your application to filter Prometheus metrics before Prometheus scrapes them. Edge sits between Prometheus and your application, applying policies as each scrape passes through.

How it works

Edge runs as a sidecar container in the same pod as your application. Prometheus scrapes Edge instead of your application. Edge proxies the request to your app’s /metrics endpoint, applies policies to filter metrics, and returns the filtered response.

Key features

  • Streaming processing: Edge filters metrics line-by-line as they stream through, keeping memory usage bounded regardless of response size
  • Dual byte limits: Configure max_input_bytes_per_scrape to bound memory usage and max_output_bytes_per_scrape to cap filtered response size
  • Zero-copy forwarding: Edge forwards metrics that pass policy checks without extra allocations
  • Fail-open behavior: If policy evaluation fails, metrics pass through unchanged

Prerequisites

  • Application exposing Prometheus metrics on Kubernetes
  • Prometheus configured to scrape your pods
  • kubectl access to your cluster
  • Tero account

Connect

1

Create the secret

Store your API key as a Kubernetes secret:
2

Create the Edge ConfigMap

Create a ConfigMap with your Edge configuration:
tero-edge-config.yaml
Set upstream_url to your application’s metrics endpoint. If your app exposes metrics on port 8080 at /metrics, use http://localhost:8080.
3

Add Edge as a sidecar

Add the Edge container to your application deployment:
4

Update Prometheus scrape config

Update your Prometheus configuration to scrape the Edge sidecar port instead of your application’s metrics port:
Or if using ServiceMonitor (Prometheus Operator):
5

Verify

Check that both containers are running:
Test the metrics endpoint through Edge:
Check Edge logs for filtering activity:

Configuration

Prometheus settings

Configure Prometheus-specific settings in the prometheus section:
Example: High-cardinality filtering If your application exposes 1GB of metrics but policies filter it down to 1MB, configure a high input limit with a lower output limit:
This allows Edge to process the full 1GB response while capping the filtered output at 10MB.

Policy providers

Edge supports multiple policy sources. Configure them in the policy_providers array.

File provider

Load policies from a local file. Pick this for static policies bundled in the ConfigMap.

HTTP provider

Fetch policies from a remote endpoint. Use this for dynamic policies managed via the Tero API.
The ${TERO_API_KEY} variable is injected from the Kubernetes secret via the container environment configuration.

Memory tuning

Edge’s streaming architecture keeps memory usage predictable. Key factors:
  1. Input limit: max_input_bytes_per_scrape caps how much data Edge reads from upstream. This bounds memory for buffering input data.
  2. Output limit: max_output_bytes_per_scrape caps how much data Edge forwards to clients. Set this high if you have aggressive filtering.
  3. Line buffer: Edge processes each metric line with a 4KB buffer. Edge passes lines over the 4KB limit through unfiltered.
  4. Concurrent scrapes: Memory scales with concurrent scrapes. Each active scrape can use up to max_input_bytes_per_scrape.
For high-cardinality workloads with aggressive filtering:
This allows processing up to 1GB of metrics while capping output at 50MB.

Troubleshooting

Prometheus can’t scrape metrics Verify Edge is running and healthy:
Ensure Prometheus is configured to scrape port 9090 (Edge) not your app’s metrics port directly. Metrics not being filtered Check that policies loaded successfully:
Verify your policy targets metric telemetry type with METRIC_FILTER stage. Scrapes timing out If your app has high-cardinality metrics, increase resource limits:
Also check max_input_bytes_per_scrape isn’t truncating large responses. Some metrics missing Check if scrapes are being truncated due to input or output limits:
Increase the limit if needed, or add policies to drop unwanted metrics earlier in the stream.