Route Templates

Collapses dynamic path segments in the Prometheus route label into stable templates, so high-variety URLs share one series instead of widening cardinality

Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.

Category: Practical
Task: Collapses dynamic path segments in the Prometheus route label into stable templates, so high-variety URLs share one series instead of widening cardinality

Prerequisites: The product runtime and any backend services referenced by this configuration.

Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 and follow the first reverse-proxy tutorial to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# Route Label Templating
#
# Collapses dynamic path segments in the Prometheus route label into stable
# templates, so high-variety URLs share one series instead of widening
# cardinality. More precise than a prefix route, still bounded. Scraped via
# the admin /metrics endpoint.
#
admin:
  address: "127.0.0.1:9901"

metrics:
  route_templates:
    - "/users/{id}"
    - "/users/{id}/orders"

insecure_options:
  allow_private_endpoints: true

listeners:
  - name: web
    address: "127.0.0.1:8080"
    filter_chains:
      - routing

filter_chains:
  - name: routing
    filters:
      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend
      - filter: load_balancer
        clusters:
          - name: backend
            endpoints:
              - "127.0.0.1:3000"