Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-09-14 13:24:22 +0300
committerJaime Martinez <jmartinez@gitlab.com>2020-09-15 07:49:29 +0300
commitd4c05e5ec0b9aeeed8693e72cdaa234d1b597df9 (patch)
tree6d69e253ba2d0180c778ec4eb30acc4e8553c3b9 /internal/httptransport
parent6fa2497adfcb2a3ce8b119b7caa6a1f0ff4a30f9 (diff)
Apply suggestions from feedback
Update metric name
Diffstat (limited to 'internal/httptransport')
-rw-r--r--internal/httptransport/transport.go21
1 files changed, 3 insertions, 18 deletions
diff --git a/internal/httptransport/transport.go b/internal/httptransport/transport.go
index 4f177914..8f8fa387 100644
--- a/internal/httptransport/transport.go
+++ b/internal/httptransport/transport.go
@@ -31,9 +31,6 @@ type meteredRoundTripper struct {
counter *prometheus.CounterVec
}
-// Option setting for metered round tripper
-type Option func(*meteredRoundTripper)
-
func newInternalTransport() *http.Transport {
return &http.Transport{
DialTLS: func(network, addr string) (net.Conn, error) {
@@ -49,25 +46,13 @@ func newInternalTransport() *http.Transport {
// NewTransportWithMetrics will create a custom http.RoundTripper that can be used with an http.Client.
// The RoundTripper will report metrics based on the collectors passed.
-func NewTransportWithMetrics(gaugeVec *prometheus.GaugeVec, counterVec *prometheus.CounterVec, options ...Option) http.RoundTripper {
- mtr := &meteredRoundTripper{
+func NewTransportWithMetrics(name string, gaugeVec *prometheus.GaugeVec, counterVec *prometheus.CounterVec) http.RoundTripper {
+ return &meteredRoundTripper{
next: InternalTransport,
+ name: name,
durations: gaugeVec,
counter: counterVec,
}
-
- for _, option := range options {
- option(mtr)
- }
-
- return mtr
-}
-
-// WithMeteredRoundTripperName adds a name to the meteredRoundTripper instance
-func WithMeteredRoundTripperName(name string) func(*meteredRoundTripper) {
- return func(tripper *meteredRoundTripper) {
- tripper.name = name
- }
}
// This is here because macOS does not support the SSL_CERT_FILE and