Skip to content

fix(observabilidade): corrigir labels e migrar dashboard MongoDB para Grafana v2#25

Merged
diego64 merged 1 commit into
mainfrom
fix/dashboard-mongodb-queries-labels
Jun 7, 2026
Merged

fix(observabilidade): corrigir labels e migrar dashboard MongoDB para Grafana v2#25
diego64 merged 1 commit into
mainfrom
fix/dashboard-mongodb-queries-labels

Conversation

@diego64

@diego64 diego64 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Migrate MongoDB dashboard from Grafana v1 schema (schemaVersion: 38, flat panels[]) to Grafana v2 API format (apiVersion: dashboard.grafana.app/v2, elements{} + RowsLayout)
  • Fix all metric label mismatches introduced by percona/mongodb_exporter upgrade to v0.44
  • Reorganize layout into four collapsible sections for better readability

Root cause

The dashboard was built targeting an older exporter version. After upgrading to percona/mongodb_exporter:0.44.0, all label names changed and every panel returned "No data":

Metric Old label (broken) New label (correct)
mongodb_ss_connections state conn_type
mongodb_ss_opcounters metric was _total, label type no suffix, label legacy_op_type
mongodb_ss_metrics_document metric was _total, label state no suffix, label doc_op_type
mongodb_ss_metrics_cursor_open label state csr_type
mongodb_ss_globalLock_currentQueue metric was _total no suffix, label count_type
mongodb_ss_network_bytes_* mongodb_ss_network_bytes_in_total mongodb_ss_network_bytesIn

Changes

observabilidade/grafana/dashboards/mongodb.json

  • Format: migrated from v1 panels[] to v2 elements{} + RowsLayout required by Grafana 13
  • All PromQL expressions updated with correct labels per exporter v0.44
  • Layout reorganized into 4 sections:
    1. Status Geralmongodb_up, conexões ativas/disponíveis, memória residente, fila bloqueada, taxa de operações
    2. Memória e Redemongodb_ss_mem_resident + virtual over time, mongodb_ss_network_bytesIn/Out rate
    3. Documentos e Cursoresmongodb_ss_metrics_document by doc_op_type, cursores abertos (csr_type="total"), conexões over time
    4. Logs — LogQL stream {container="bv-mongodb"} via Loki datasource loki-bv

Test plan

  • All containers healthy: docker compose ps — all services Up (healthy)
  • Exporter exposing metrics: curl localhost:9216/metrics | grep mongodb_up returns 1
  • Prometheus scraping: curl localhost:9090/api/v1/query?query=mongodb_up returns result[0].value = "1"
  • Grafana dashboard at http://localhost:3001 — all panels show data, no "No data" banners
  • Stat panels: Status MongoDB = "Online", Conexões Ativas ≥ 1, Memória Residente > 0
  • Timeseries panels: Taxa de Operações, Memória, Rede show historical data (may need 1–2 min of scrape history)
  • Logs panel: shows bv-mongodb container log stream

🤖 Generated with Claude Code

…s incorretas

Labels do mongodb_exporter 0.44 diferem da versão anterior:
- conn_type substitui state em mongodb_ss_connections
- legacy_op_type substitui type em mongodb_ss_opcounters
- doc_op_type substitui state em mongodb_ss_metrics_document
- csr_type substitui state em mongodb_ss_metrics_cursor_open
- mongodb_ss_network_bytesIn substitui mongodb_ss_network_bytes_in_total
- mongodb_ss_globalLock_currentQueue substitui a versão _total

Reorganiza layout em quatro seções: Status Geral, Memória e Rede,
Documentos e Cursores, Logs.
@diego64 diego64 merged commit 94effee into main Jun 7, 2026
10 checks passed
@diego64 diego64 deleted the fix/dashboard-mongodb-queries-labels branch June 7, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant