mirror of
https://github.com/bitmagnet-io/bitmagnet.git
synced 2026-07-20 03:05:20 -04:00
29 lines
601 B
Go
29 lines
601 B
Go
package prometheus
|
|
|
|
import (
|
|
"github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy"
|
|
"github.com/bitmagnet-io/bitmagnet/internal/queue/redis"
|
|
"github.com/hibiken/asynq"
|
|
"github.com/hibiken/asynq/x/metrics"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
type Params struct {
|
|
fx.In
|
|
Redis lazy.Lazy[*redis.Client]
|
|
}
|
|
|
|
type Result struct {
|
|
fx.Out
|
|
Collector prometheus.Collector `group:"prometheus_collectors"`
|
|
}
|
|
|
|
func New(p Params) Result {
|
|
return Result{
|
|
Collector: metrics.NewQueueMetricsCollector(
|
|
asynq.NewInspector(redis.Wrapper{Redis: p.Redis}),
|
|
),
|
|
}
|
|
}
|