fix(otel): lazy-init metrics and fix Grafana dashboards #53

Merged
Ichitux merged 2 commits from fix/otel-metrics-and-monitoring-dashboards into main 2026-07-21 13:11:07 +00:00
Owner
  • Fix OTel custom metrics not reaching Prometheus: ESM static import
    hoisting caused metrics.getMeter() to run before sdk.start(), getting
    NoopMeterProvider. Changed to lazy-init pattern so instruments are
    created on first use after the SDK configures the real MeterProvider.

  • Fix Grafana dashboards job labels: OTel adds service.namespace prefix
    (job=farmafinder/farmafinder-backend), updated queries to use regex
    match (job=~".*farmafinder-backend").

  • Fix histogram metric names: OTel appends unit suffix (_milliseconds)
    to histogram names (e.g. http_request_duration_ms_milliseconds_bucket).

Verified: app_heartbeat_total, http_requests_total, db_query_duration_ms,
redis_cmd_duration_ms, and all other custom metrics now flow correctly
through OTLP -> Alloy -> Prometheus remote_write.

- Fix OTel custom metrics not reaching Prometheus: ESM static import hoisting caused metrics.getMeter() to run before sdk.start(), getting NoopMeterProvider. Changed to lazy-init pattern so instruments are created on first use after the SDK configures the real MeterProvider. - Fix Grafana dashboards job labels: OTel adds service.namespace prefix (job=farmafinder/farmafinder-backend), updated queries to use regex match (job=~".*farmafinder-backend"). - Fix histogram metric names: OTel appends unit suffix (_milliseconds) to histogram names (e.g. http_request_duration_ms_milliseconds_bucket). Verified: app_heartbeat_total, http_requests_total, db_query_duration_ms, redis_cmd_duration_ms, and all other custom metrics now flow correctly through OTLP -> Alloy -> Prometheus remote_write.
Ichitux added 1 commit 2026-07-21 12:30:11 +00:00
fix(otel): lazy-init metrics and fix Grafana dashboards
Run Tests on Branches / Detect Changes (push) Successful in 14s
Run Tests on Branches / Backend Tests (push) Successful in 4m3s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
f32ff701e1
- Fix OTel custom metrics not reaching Prometheus: ESM static import
  hoisting caused metrics.getMeter() to run before sdk.start(), getting
  NoopMeterProvider. Changed to lazy-init pattern so instruments are
  created on first use after the SDK configures the real MeterProvider.

- Fix Grafana dashboards job labels: OTel adds service.namespace prefix
  (job=farmafinder/farmafinder-backend), updated queries to use regex
  match (job=~".*farmafinder-backend").

- Fix histogram metric names: OTel appends unit suffix (_milliseconds)
  to histogram names (e.g. http_request_duration_ms_milliseconds_bucket).

Verified: app_heartbeat_total, http_requests_total, db_query_duration_ms,
redis_cmd_duration_ms, and all other custom metrics now flow correctly
through OTLP -> Alloy -> Prometheus remote_write.
Ichitux added 1 commit 2026-07-21 12:30:56 +00:00
Merge branch 'main' into fix/otel-metrics-and-monitoring-dashboards
Run Tests on Branches / Detect Changes (push) Successful in 14s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Backend Tests (push) Successful in 1m46s
Run Tests on Branches / Frontend Tests (push) Has been skipped
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
e437ad427e
Ichitux merged commit 06ea844fd0 into main 2026-07-21 13:11:07 +00:00
Ichitux deleted branch fix/otel-metrics-and-monitoring-dashboards 2026-07-21 13:11:07 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Ichitux/FarmaFinder#53