Skip to content

Commit

Permalink
Support for Subsystem in counter and histogram metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohit Saini committed Sep 15, 2023
1 parent 4679fb1 commit b836385
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions providers/prometheus/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ func WithConstLabels(labels prometheus.Labels) CounterOption {
}
}

// WithSubsystem allows you to add Subsytem to Counter metrics.
func WithSubsystem(subsystem string) CounterOption {
return func(o *prometheus.CounterOpts) {
o.Subsystem = subsystem
}
}

// A HistogramOption lets you add options to Histogram metrics using With*
// funcs.
type HistogramOption func(*prometheus.HistogramOpts)
Expand Down Expand Up @@ -81,6 +88,13 @@ func WithHistogramConstLabels(labels prometheus.Labels) HistogramOption {
}
}

// WithHistogramSubsystem allows you to add Subsytem to histograms metrics.
func WithHistogramSubsystem(subsystem string) HistogramOption {
return func(o *prometheus.HistogramOpts) {
o.Subsystem = subsystem
}
}

func typeFromMethodInfo(mInfo *grpc.MethodInfo) grpcType {
if !mInfo.IsClientStream && !mInfo.IsServerStream {
return Unary
Expand Down

0 comments on commit b836385

Please sign in to comment.