router icon indicating copy to clipboard operation
router copied to clipboard

Custom metrics are not exported to prometheus

Open AndrewGrachov opened this issue 5 months ago • 0 comments

Describe the bug

Router version 2.3.0

I am trying to record some metrics using "apollo_router::metrics::meter_provider()"

    let router = apollo_router::main();
    let meter = apollo_router::metrics::meter_provider().meter("apollo/router/plugins");
    let histogram = meter
        .u64_histogram("tokio")
        .init();
    histogram.record(100, &[]);

Expected behavior

Metric is exported to prometheus

Additional context

Exporter configuration

    metrics:
      prometheus:
        enabled: true
        listen: "0.0.0.0:2224"
        path: /metrics
      common:
        resource:
          environment: "${env.ENVIRONMENT:-production}"
          region: "${env.REGION:-unknown}"
        buckets:
          - 0.001
          - 0.003
          - 0.005
          - 0.007
          - 0.015
          - 0.03
          - 0.04
          - 0.05
          - 0.06
          - 0.07
          - 0.08
          - 0.09
          - 0.1
          - 0.15
          - 0.2
          - 0.3
          - 0.4
          - 0.5
          - 0.7
          - 1.0
          - 1.3
          - 1.5
          - 2.0
          - 3.0
          - 5.0

AndrewGrachov avatar Jun 11 '25 11:06 AndrewGrachov