feat(metrics): expose server_name label on barman-cloud backup gauges
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- go, postgresql
- Domínio
- backend, observability
Direção de pesquisa
Start with Define() and Collect() in internal/cnpgi/instance/metrics.go, including the populated and zero-value paths; the issue says both CNPG-I and CloudNativePG support variable labels end to end. Check the existing gauge definitions and collection tests, if present. Done means all three barman cloud gauges include server_name populated from configuration.ServerName in both paths; maintainers still need to resolve the object_store and release compatibility questions.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Human
I came across this when wanting to alert on backups might have been accidentally deleted, and noticed I couldn't easily tell the difference in metrics. Having the server name on these would help :)
Problem
plugin-barman-cloud exposes three gauges on each CNPG instance pod (internal/cnpgi/instance/metrics.go):
barman_cloud_cloudnative_pg_io_first_recoverability_pointbarman_cloud_cloudnative_pg_io_last_available_backup_timestampbarman_cloud_cloudnative_pg_io_last_failed_backup_timestamp
None of them carry a server_name label, even though Collect() already looks up objectStore.Status.ServerRecoveryWindow[configuration.ServerName].
When a platform recreates a Cluster under the same name and namespace with a fresh serverName (for example a timestamped or UUID-suffixed server name, similar to the patterns in #1140 and #1253), the new cluster starts a fresh Barman archive while keeping the old archive intact. In Prometheus, the new cluster writes to the exact same metric series as the previous one. Alerts that track recoverability-window drops (comparing first_recoverability_point over a lookback window) see the restore window drop to zero and fire false positives for a normal recreation.
Proposal
Expose server_name as a variable label on the three barman_cloud_cloudnative_pg_io_* gauges, populated with configuration.ServerName in both the populated and zero-value paths of Collect().
Both cnpg-i (proto/metrics.proto) and CloudNativePG (internal/cnpi/plugin/client/metrics.go, pkg/management/postgres/metrics/collector.go) already support variable_labels end-to-end, so this only requires updating Define() and Collect() in internal/cnpgi/instance/metrics.go.
A couple of design questions for maintainers:
- Should
object_store(fromconfiguration.GetBarmanObjectKey().Name) also be included, or justserver_name? - Adding a label changes Prometheus series identity on upgrade (which splits range queries once across the upgrade boundary and can affect alerts using
without(...)or strict label matching). Is a release note in a minor version fine here, or would you prefer an opt-in flag?
Cardinality and alternatives
Cardinality stays low: one active server_name per cluster at any time, and identical to the cluster name when serverName is not overridden.
Today the workaround is injecting a synthetic label via PodMonitor metricRelabelings from an external controller (or putting it on pod labels with podTargetLabels, which splits every cnpg_* metric on the pod). Exposing server_name directly from the plugin keeps the archive identity with the backup metrics that actually depend on it.
Disclosure: Drafted with an AI assistant (Gemini), which also verified the cnpg-i and CloudNativePG metric collector references against source.
- Linguagem predominante
- Go
- Estrelas
- 214
- Forks
- 91
- Merge médio
- 2d 11h
- PRs com merge (30d)
- 38
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de cloudnative-pg/plugin-barman-cloud
-
Cluster never reconciles when created before its ObjectStore: requeue without RequeueAfter is droppedTalvez já em andamento @shanurwan assumiu há 17 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
cloudnative-pg/plugin-barman-cloud#1236 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
cloudnative-pg/plugin-barman-cloud#1117 · 1 reação ·
Mantenedores costumam responder em até 2 dias
-
Add RBAC aggregation labels to ObjectStore editor/viewer ClusterRolesTalvez já em andamento @stefanpeknik assumiu há 76 dias. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
cloudnative-pg/plugin-barman-cloud#1102 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 47/100
cloudnative-pg/plugin-barman-cloud#1268 ·
Mantenedores costumam responder em até 2 dias
-
WAL prefetch (`wal.maxParallel` > 1) names the wrong segments when the WAL segment size is not 16MBAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
cloudnative-pg/plugin-barman-cloud#1259 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de cloudnative-pg/plugin-barman-cloud
Issues semelhantes
-
[Bug]: Azure SAS signing uses local time instead of UTC, shifting validity window on non-UTC hostsTalvez já em andamento @huanghaoyuanhhy assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
zilliztech/milvus-backup#1418 ·
Mantenedores costumam responder em até 1 dia
-
good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
eugenioenko/ttt#1909 ·
Mantenedores costumam responder em até 1 dia
-
ColumnIndex max truncation returns a value smaller than the real max when the prefix is all 0xFFAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
parquet-go/parquet-go#819 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
-
feat(arithmetization): update `arithmetization` to ZkC version `v1.2.38`Talvez já em andamento @DavePearce assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
LFDT-Lineth/lineth-monorepo#4679 ·
Mantenedores costumam responder em até 1 dia