cloudnative-pg / cloudnative-pg/plugin-barman-cloud

Sidecar metrics collection over plugin gRPC has no deadline — one stuck operation hangs the whole instance /metrics

オープン
#1,045 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Go
スター
191
フォーク
72
平均マージ
1日 16時間
マージ済み PR(30日)
18

説明

## Environment

CloudNativePG 1.30.0, plugin-barman-cloud v0.14.0, PostgreSQL 17/18 clusters, VersityGW (posix) S3 endpoint.

## What happens

The instance sidecar collects plugin metrics over the plugin gRPC with **no deadline on the collect path**. Consequence: if any plugin operation gets stuck (in my case a retention/catalog-maintenance run that never completes against a posix-backend S3 gateway — filed separately), the next scrape blocks on the collector and the **entire** `/metrics` endpoint of that instance hangs indefinitely. Prometheus marks the target down and every metric of that instance disappears, not just the plugin's own collectors.

Observed in production: the primary instance's exporter dark for 6.7 hours while the database itself was healthy — WAL-archiver and backup-staleness alerting was blind precisely on the instance where it matters.

## Expected

- A per-collect deadline (a few seconds) on the plugin metrics gRPC call.
- On timeout/error: return the rest of the metrics plus an error counter (e.g. `..._collector_errors_total`), instead of hanging the whole endpoint. A misbehaving plugin should degrade its own metrics, never the instance's.

## Reproduction sketch

1. ObjectStore against VersityGW (posix backend) with any `retentionPolicy` set.
2. Wait for a retention run to start (~30 min cadence) — it never completes against this backend.
3. Scrape the instance sidecar's metrics port: the request hangs until the client gives up; `up` goes to 0 for the instance.

Companion issue describes the retention hang itself; this one is about the missing deadline that turns any such hang into a full metrics outage.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

インスタンス sidecar の plugin gRPC メトリクスの collect パスを追跡し、plugin の処理が停止した状態で問題を再現してから、/metrics エンドポイントが collector のエラーをどのように処理するかを調べます。collect ごとのタイムアウトによって、plugin 呼び出しが停止した場合でもエンドポイントが残りのメトリクスを返し、エラーを記録できることを確認します。また、正常な plugin メトリクスが引き続き機能することも確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go, grpc
領域
backend, observability
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。