cloudnative-pg / cloudnative-pg/plugin-barman-cloud
Sidecar metrics collection over plugin gRPC has no deadline — one stuck operation hangs the whole instance /metrics
- Ngôn ngữ chính
- Go
- Star
- 192
- Fork
- 75
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 18
Mô tả
## 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Theo dõi đường dẫn collect metrics gRPC của plugin trong instance sidecar và tái hiện vấn đề với một thao tác plugin bị kẹt, sau đó kiểm tra cách endpoint /metrics xử lý lỗi của collector. Xác minh rằng timeout cho mỗi collect cho phép endpoint trả về các metrics còn lại và ghi nhận lỗi khi lệnh gọi plugin bị treo, trong khi các metrics plugin đang hoạt động bình thường vẫn tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- go, grpc
- Lĩnh vực
- backend, observability
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 55/100