Skip to content

Commit

Permalink
httptransport: use less-verbose instrumentation construction
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Jul 22, 2022
1 parent 5111952 commit 8814911
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 94 deletions.
49 changes: 1 addition & 48 deletions httptransport/indexer_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"time"

"github.com/ldelossa/responserecorder"
"github.com/prometheus/client_golang/prometheus"
"github.com/quay/claircore"
"github.com/quay/zlog"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
Expand Down Expand Up @@ -297,50 +296,4 @@ func init() {
indexerv1wrapper.init("indexerv1")
}

var indexerv1wrapper = &wrapper{
RequestCount: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "indexerv1_request_total",
Help: "A total count of http requests for the given path",
},
[]string{"handler", "code", "method"},
),
RequestSize: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "indexerv1_request_size_bytes",
Help: "Distribution of request sizes for the given path",
},
[]string{"handler", "code", "method"},
),
ResponseSize: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "indexerv1_response_size_bytes",
Help: "Distribution of response sizes for the given path",
}, []string{"handler", "code", "method"},
),
RequestDuration: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "indexerv1_request_duration_seconds",
Help: "Distribution of request durations for the given path",
// These are roughly exponential from 0.5 to 300 seconds
Buckets: []float64{0.5, 0.7, 1.1, 1.7, 2.7, 4.2, 6.5, 10, 15, 23, 36, 54, 83, 128, 196, 300},
}, []string{"handler", "code", "method"},
),
InFlight: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "indexerv1_in_flight_requests",
Help: "Gauge of requests in flight",
},
[]string{"handler"},
),
}
var indexerv1wrapper wrapper
47 changes: 1 addition & 46 deletions httptransport/matcher_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/google/uuid"
"github.com/ldelossa/responserecorder"
"github.com/prometheus/client_golang/prometheus"
"github.com/quay/claircore"
"github.com/quay/claircore/libvuln/driver"
"github.com/quay/zlog"
Expand Down Expand Up @@ -265,48 +264,4 @@ func init() {
matcherv1wrapper.init("matcherv1")
}

var matcherv1wrapper = &wrapper{
RequestCount: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "matcherv1_request_total",
Help: "A total count of http requests for the given path",
},
[]string{"handler", "code", "method"},
),
RequestSize: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "matcherv1_request_size_bytes",
Help: "Distribution of request sizes for the given path",
},
[]string{"handler", "code", "method"},
),
ResponseSize: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "matcherv1_response_size_bytes",
Help: "Distribution of response sizes for the given path",
}, []string{"handler", "code", "method"},
),
RequestDuration: prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "matcherv1_request_duration_seconds",
Help: "Distribution of request durations for the given path",
}, []string{"handler", "code", "method"},
),
InFlight: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: metricNamespace,
Subsystem: metricSubsystem,
Name: "matcherv1_in_flight_requests",
Help: "Gauge of requests in flight",
},
[]string{"handler"},
),
}
var matcherv1wrapper wrapper

0 comments on commit 8814911

Please sign in to comment.