feat(metrics): allow red metrics to be more generic (#17678)
parent
179adb0e9b
commit
4728e36e1b
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
|
@ -18,7 +17,7 @@ type REDClient struct {
|
|||
}
|
||||
|
||||
// New creates a new REDClient.
|
||||
func New(reg *prom.Registry, service string) *REDClient {
|
||||
func New(reg prometheus.Registerer, service string) *REDClient {
|
||||
// MiddlewareMetrics is a metrics service middleware for the notification endpoint service.
|
||||
const namespace = "service"
|
||||
|
||||
|
|
|
@ -2,9 +2,10 @@ package tenant
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type BucketMetrics struct {
|
||||
|
@ -17,7 +18,7 @@ type BucketMetrics struct {
|
|||
var _ influxdb.BucketService = (*BucketMetrics)(nil)
|
||||
|
||||
// NewBucketMetrics returns a metrics service middleware for the Bucket Service.
|
||||
func NewBucketMetrics(reg *prom.Registry, s influxdb.BucketService, opts ...MetricsOption) *BucketMetrics {
|
||||
func NewBucketMetrics(reg prometheus.Registerer, s influxdb.BucketService, opts ...MetricsOption) *BucketMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &BucketMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("bucket")),
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var _ influxdb.OnboardingService = (*OnboardingMetrics)(nil)
|
||||
|
@ -18,7 +18,7 @@ type OnboardingMetrics struct {
|
|||
}
|
||||
|
||||
// NewOnboardingMetrics returns a metrics service middleware for the User Service.
|
||||
func NewOnboardingMetrics(reg *prom.Registry, s influxdb.OnboardingService, opts ...MetricsOption) *OnboardingMetrics {
|
||||
func NewOnboardingMetrics(reg prometheus.Registerer, s influxdb.OnboardingService, opts ...MetricsOption) *OnboardingMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &OnboardingMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("onboard")),
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type OrgMetrics struct {
|
||||
|
@ -18,7 +18,7 @@ type OrgMetrics struct {
|
|||
var _ influxdb.OrganizationService = (*OrgMetrics)(nil)
|
||||
|
||||
// NewOrgMetrics returns a metrics service middleware for the Organization Service.
|
||||
func NewOrgMetrics(reg *prom.Registry, s influxdb.OrganizationService, opts ...MetricsOption) *OrgMetrics {
|
||||
func NewOrgMetrics(reg prometheus.Registerer, s influxdb.OrganizationService, opts ...MetricsOption) *OrgMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &OrgMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("org")),
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type UrmMetrics struct {
|
||||
|
@ -18,7 +18,7 @@ type UrmMetrics struct {
|
|||
var _ influxdb.UserResourceMappingService = (*UrmMetrics)(nil)
|
||||
|
||||
// NewUrmMetrics returns a metrics service middleware for the User Resource Mapping Service.
|
||||
func NewUrmMetrics(reg *prom.Registry, s influxdb.UserResourceMappingService, opts ...MetricsOption) *UrmMetrics {
|
||||
func NewUrmMetrics(reg prometheus.Registerer, s influxdb.UserResourceMappingService, opts ...MetricsOption) *UrmMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &UrmMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("urm")),
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/influxdata/influxdb/v2"
|
||||
"github.com/influxdata/influxdb/v2/kit/metric"
|
||||
"github.com/influxdata/influxdb/v2/kit/prom"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
var _ influxdb.UserService = (*UserMetrics)(nil)
|
||||
|
@ -19,7 +19,7 @@ type UserMetrics struct {
|
|||
}
|
||||
|
||||
// NewUserMetrics returns a metrics service middleware for the User Service.
|
||||
func NewUserMetrics(reg *prom.Registry, s influxdb.UserService, opts ...MetricsOption) *UserMetrics {
|
||||
func NewUserMetrics(reg prometheus.Registerer, s influxdb.UserService, opts ...MetricsOption) *UserMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &UserMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("user")),
|
||||
|
@ -71,7 +71,7 @@ type PasswordMetrics struct {
|
|||
}
|
||||
|
||||
// NewPasswordMetrics returns a metrics service middleware for the Password Service.
|
||||
func NewPasswordMetrics(reg *prom.Registry, s influxdb.PasswordsService, opts ...MetricsOption) *PasswordMetrics {
|
||||
func NewPasswordMetrics(reg prometheus.Registerer, s influxdb.PasswordsService, opts ...MetricsOption) *PasswordMetrics {
|
||||
o := applyOpts(opts...)
|
||||
return &PasswordMetrics{
|
||||
rec: metric.New(reg, o.applySuffix("password")),
|
||||
|
|
Loading…
Reference in New Issue