fix: expose pipeline health metrics

This commit is contained in:
2026-10-30 13:46:06 +03:00
parent 25c80a0072
commit c5b804426e
7 changed files with 889 additions and 559 deletions
+7 -2
View File
@@ -11,6 +11,11 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
requestDurationBuckets = []float64{0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 30}
uploadDurationBuckets = []float64{0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 30, 60}
)
type metrics struct {
requests *prometheus.CounterVec
duration *prometheus.HistogramVec
@@ -36,7 +41,7 @@ func newMetrics() *metrics {
Subsystem: "http",
Name: "request_duration_seconds",
Help: "HTTP request duration in seconds.",
Buckets: prometheus.DefBuckets,
Buckets: requestDurationBuckets,
}, []string{"method", "route"}),
inFlight: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "messenger",
@@ -59,7 +64,7 @@ func newMetrics() *metrics {
Namespace: "messenger",
Name: "attachment_upload_duration_seconds",
Help: "Attachment upload duration in seconds.",
Buckets: prometheus.DefBuckets,
Buckets: uploadDurationBuckets,
}),
attachmentBytes: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "messenger",
+2 -2
View File
@@ -90,8 +90,8 @@ func (s attachmentServiceStub) Metadata(context.Context, string, string) (model.
func (s attachmentServiceStub) Content(context.Context, string, string, string) (attachment.Content, error) {
return attachment.Content{
Attachment: s.uploaded,
Variant: model.Variant{ContentType: s.uploaded.ContentType, SizeBytes: s.uploaded.SizeBytes},
Body: io.NopCloser(strings.NewReader("content")),
Variant: model.Variant{ContentType: s.uploaded.ContentType, SizeBytes: s.uploaded.SizeBytes},
Body: io.NopCloser(strings.NewReader("content")),
}, s.err
}