diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 01d87b1eb75..adaa343b91d 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -31,7 +31,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/internal/docs" "github.com/jaegertracing/jaeger/cmd/internal/flags" "github.com/jaegertracing/jaeger/cmd/internal/status" - "github.com/jaegertracing/jaeger/internal/metrics/expvar" "github.com/jaegertracing/jaeger/internal/metrics/fork" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" @@ -62,9 +61,9 @@ func main() { Namespace(metrics.NSOptions{Name: "jaeger"}). Namespace(metrics.NSOptions{Name: "agent"}) mFactory := fork.New("internal", - expvar.NewFactory(10), // backend for internal opts - baseFactory) - version.NewInfoMetrics(mFactory) + baseFactory, + baseFactory) // No expvar functionality + version.NewInfoMetrics(mFactory) rOpts := new(reporter.Options).InitFromViper(v, logger) grpcBuilder, err := grpc.NewConnBuilder().InitFromViper(v) diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index 08ac4313dff..8e7f6d9d3d0 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -40,8 +40,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/internal/status" queryApp "github.com/jaegertracing/jaeger/cmd/query/app" "github.com/jaegertracing/jaeger/cmd/query/app/querysvc" - "github.com/jaegertracing/jaeger/internal/metrics/expvar" - "github.com/jaegertracing/jaeger/internal/metrics/fork" + "github.com/jaegertracing/jaeger/internal/metrics/prometheus" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/pkg/metrics" @@ -96,9 +95,7 @@ by default uses only in-memory database.`, return err } logger := svc.Logger // shortcut - baseFactory := fork.New("internal", - expvar.NewFactory(10), // backend for internal opts - svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})) + baseFactory := prometheus.New() // Use Prometheus as the default backend metric version.NewInfoMetrics(baseFactory) agentMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "agent"}) collectorMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "collector"}) diff --git a/cmd/collector/main.go b/cmd/collector/main.go index e8f1ca4db95..c8e93ddccf8 100644 --- a/cmd/collector/main.go +++ b/cmd/collector/main.go @@ -33,8 +33,6 @@ import ( cmdFlags "github.com/jaegertracing/jaeger/cmd/internal/flags" "github.com/jaegertracing/jaeger/cmd/internal/printconfig" "github.com/jaegertracing/jaeger/cmd/internal/status" - "github.com/jaegertracing/jaeger/internal/metrics/expvar" - "github.com/jaegertracing/jaeger/internal/metrics/fork" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/pkg/tenancy" @@ -73,9 +71,7 @@ func main() { } logger := svc.Logger // shortcut baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"}) - metricsFactory := fork.New("internal", - expvar.NewFactory(10), // backend for internal opts - baseFactory.Namespace(metrics.NSOptions{Name: "collector"})) + metricsFactory := baseFactory // No expvar functionality version.NewInfoMetrics(metricsFactory) storageFactory.InitFromViper(v, logger) diff --git a/examples/hotrod/cmd/flags.go b/examples/hotrod/cmd/flags.go index e2c22847992..f3e76598eb6 100644 --- a/examples/hotrod/cmd/flags.go +++ b/examples/hotrod/cmd/flags.go @@ -40,6 +40,8 @@ var ( // used by root command func addFlags(cmd *cobra.Command) { + cmd.PersistentFlags().StringVarP(&metricsBackend, "metrics", "m", "prometheus", "Metrics backend to use (prometheus)") + cmd.PersistentFlags().StringVarP(&otelExporter, "otel-exporter", "x", "otlp", "OpenTelemetry exporter (otlp|stdout)") cmd.PersistentFlags().DurationVarP(&fixDBConnDelay, "fix-db-query-delay", "D", 300*time.Millisecond, "Average latency of MySQL DB query") diff --git a/examples/hotrod/cmd/root.go b/examples/hotrod/cmd/root.go index ccdb066be2d..345b0f80cf6 100644 --- a/examples/hotrod/cmd/root.go +++ b/examples/hotrod/cmd/root.go @@ -70,8 +70,14 @@ func onInitialize() { jaegerclientenv2otel.MapJaegerToOtelEnvVars(logger) // Only configure Prometheus as the metrics backend - metricsFactory = prometheus.New().Namespace(metrics.NSOptions{Name: "hotrod", Tags: nil}) - logger.Info("Using Prometheus as the metrics backend") + switch metricsBackend { + case "prometheus": + metricsFactory = prometheus.New().Namespace(metrics.NSOptions{Name: "hotrod", Tags: nil}) + logger.Info("Using Prometheus as metrics backend") + default: + logger.Fatal("Unsupported metrics backend " + metricsBackend) + } + if config.MySQLGetDelay != fixDBConnDelay { logger.Info("fix: overriding MySQL query delay", zap.Duration("old", config.MySQLGetDelay), zap.Duration("new", fixDBConnDelay)) config.MySQLGetDelay = fixDBConnDelay diff --git a/internal/metrics/expvar/cache.go b/internal/metrics/expvar/cache.go deleted file mode 100644 index f25ddba563b..00000000000 --- a/internal/metrics/expvar/cache.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// Copyright (c) 2018 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "sync" - - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -type cache struct { - lock sync.Mutex - counters map[string]metrics.Counter - gauges map[string]metrics.Gauge - timers map[string]metrics.Timer - histograms map[string]metrics.Histogram -} - -func newCache() *cache { - return &cache{ - counters: make(map[string]metrics.Counter), - gauges: make(map[string]metrics.Gauge), - timers: make(map[string]metrics.Timer), - histograms: make(map[string]metrics.Histogram), - } -} - -func (r *cache) getOrSetCounter(name string, create func() metrics.Counter) metrics.Counter { - r.lock.Lock() - defer r.lock.Unlock() - c, ok := r.counters[name] - if !ok { - c = create() - r.counters[name] = c - } - return c -} - -func (r *cache) getOrSetGauge(name string, create func() metrics.Gauge) metrics.Gauge { - r.lock.Lock() - defer r.lock.Unlock() - g, ok := r.gauges[name] - if !ok { - g = create() - r.gauges[name] = g - } - return g -} - -func (r *cache) getOrSetTimer(name string, create func() metrics.Timer) metrics.Timer { - r.lock.Lock() - defer r.lock.Unlock() - t, ok := r.timers[name] - if !ok { - t = create() - r.timers[name] = t - } - return t -} - -func (r *cache) getOrSetHistogram(name string, create func() metrics.Histogram) metrics.Histogram { - r.lock.Lock() - defer r.lock.Unlock() - t, ok := r.histograms[name] - if !ok { - t = create() - r.histograms[name] = t - } - return t -} diff --git a/internal/metrics/expvar/cache_test.go b/internal/metrics/expvar/cache_test.go deleted file mode 100644 index ce35202a819..00000000000 --- a/internal/metrics/expvar/cache_test.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// Copyright (c) 2018 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/jaegertracing/jaeger/internal/metricstest" - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -func TestCache(t *testing.T) { - f := metricstest.NewFactory(100 * time.Second) - defer f.Stop() - c1 := f.Counter(metrics.Options{Name: "x"}) - g1 := f.Gauge(metrics.Options{Name: "y"}) - t1 := f.Timer(metrics.TimerOptions{Name: "z"}) - h1 := f.Histogram(metrics.HistogramOptions{Name: "h"}) - - c := newCache() - - c2 := c.getOrSetCounter("x", func() metrics.Counter { return c1 }) - assert.Equal(t, c1, c2) - g2 := c.getOrSetGauge("y", func() metrics.Gauge { return g1 }) - assert.Equal(t, g1, g2) - t2 := c.getOrSetTimer("z", func() metrics.Timer { return t1 }) - assert.Equal(t, t1, t2) - h2 := c.getOrSetHistogram("h", func() metrics.Histogram { return h1 }) - assert.Equal(t, h1, h2) - - c3 := c.getOrSetCounter("x", func() metrics.Counter { panic("c1") }) - assert.Equal(t, c1, c3) - g3 := c.getOrSetGauge("y", func() metrics.Gauge { panic("g1") }) - assert.Equal(t, g1, g3) - t3 := c.getOrSetTimer("z", func() metrics.Timer { panic("t1") }) - assert.Equal(t, t1, t3) - h3 := c.getOrSetHistogram("h", func() metrics.Histogram { panic("h1") }) - assert.Equal(t, h1, h3) -} diff --git a/internal/metrics/expvar/factory.go b/internal/metrics/expvar/factory.go deleted file mode 100644 index 6ce562e5ef1..00000000000 --- a/internal/metrics/expvar/factory.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// Copyright (c) 2018 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "sort" - - kexpvar "github.com/go-kit/kit/metrics/expvar" - - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -// NewFactory creates a new metrics factory using go-kit expvar package. -// buckets is the number of buckets to be used in histograms. -// Custom buckets passed via options are not supported. -func NewFactory(buckets int) metrics.Factory { - return &factory{ - buckets: buckets, - scope: "", - scopeSep: ".", - tagsSep: ".", - tagKVSep: "_", - cache: newCache(), - } -} - -type factory struct { - buckets int - - scope string - tags map[string]string - scopeSep string - tagsSep string - tagKVSep string - cache *cache -} - -var _ metrics.Factory = (*factory)(nil) - -func (f *factory) subScope(name string) string { - if f.scope == "" { - return name - } - if name == "" { - return f.scope - } - return f.scope + f.scopeSep + name -} - -func (f *factory) mergeTags(tags map[string]string) map[string]string { - ret := make(map[string]string, len(f.tags)+len(tags)) - for k, v := range f.tags { - ret[k] = v - } - for k, v := range tags { - ret[k] = v - } - return ret -} - -func (f *factory) getKey(name string, tags map[string]string) string { - fullName := f.subScope(name) - fullTags := f.mergeTags(tags) - return makeKey(fullName, fullTags, f.tagsSep, f.tagKVSep) -} - -// getKey converts name+tags into a single string of the form -// "name|tag1=value1|...|tagN=valueN", where tag names are -// sorted alphabetically. -func makeKey(name string, tags map[string]string, tagsSep string, tagKVSep string) string { - keys := make([]string, 0, len(tags)) - for k := range tags { - keys = append(keys, k) - } - sort.Strings(keys) - key := name - for _, k := range keys { - key = key + tagsSep + k + tagKVSep + tags[k] - } - return key -} - -func (f *factory) Counter(options metrics.Options) metrics.Counter { - key := f.getKey(options.Name, options.Tags) - return f.cache.getOrSetCounter(key, func() metrics.Counter { - return NewCounter(kexpvar.NewCounter(key)) - }) -} - -func (f *factory) Gauge(options metrics.Options) metrics.Gauge { - key := f.getKey(options.Name, options.Tags) - return f.cache.getOrSetGauge(key, func() metrics.Gauge { - return NewGauge(kexpvar.NewGauge(key)) - }) -} - -func (f *factory) Timer(options metrics.TimerOptions) metrics.Timer { - key := f.getKey(options.Name, options.Tags) - return f.cache.getOrSetTimer(key, func() metrics.Timer { - return NewTimer(kexpvar.NewHistogram(key, f.buckets)) - }) -} - -func (f *factory) Histogram(options metrics.HistogramOptions) metrics.Histogram { - key := f.getKey(options.Name, options.Tags) - return f.cache.getOrSetHistogram(key, func() metrics.Histogram { - return NewHistogram(kexpvar.NewHistogram(key, f.buckets)) - }) -} - -func (f *factory) Namespace(options metrics.NSOptions) metrics.Factory { - return &factory{ - buckets: f.buckets, - scope: f.subScope(options.Name), - tags: f.mergeTags(options.Tags), - scopeSep: f.scopeSep, - tagsSep: f.tagsSep, - tagKVSep: f.tagKVSep, - cache: f.cache, - } -} diff --git a/internal/metrics/expvar/factory_test.go b/internal/metrics/expvar/factory_test.go deleted file mode 100644 index 5486a6ac81f..00000000000 --- a/internal/metrics/expvar/factory_test.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// Copyright (c) 2018 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "expvar" - "fmt" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -var ( - id = time.Now().UnixNano() - prefix = fmt.Sprintf("test_%d", id) - counterPrefix = prefix + "_counter_" - gaugePrefix = prefix + "_gauge_" - timerPrefix = prefix + "_timer_" - histogramPrefix = prefix + "_histogram_" - - tagsA = map[string]string{"a": "b"} - tagsX = map[string]string{"x": "y"} -) - -func TestFactory(t *testing.T) { - buckets := []float64{10, 20, 30, 40, 50, 60} - testCases := []struct { - name string - tags map[string]string - buckets []float64 - durationBuckets []time.Duration - namespace string - nsTags map[string]string - fullName string - expectedCounter string - }{ - {name: "x", fullName: "%sx", buckets: buckets}, - {tags: tagsX, fullName: "%s.x_y", buckets: buckets}, - {name: "x", tags: tagsA, fullName: "%sx.a_b", buckets: buckets}, - {namespace: "y", fullName: "y.%s", buckets: buckets}, - {nsTags: tagsA, fullName: "%s.a_b", buckets: buckets}, - {namespace: "y", nsTags: tagsX, fullName: "y.%s.x_y", buckets: buckets}, - {name: "x", namespace: "y", nsTags: tagsX, fullName: "y.%sx.x_y", buckets: buckets}, - {name: "x", tags: tagsX, namespace: "y", nsTags: tagsX, fullName: "y.%sx.x_y", expectedCounter: "84", buckets: buckets}, - {name: "x", tags: tagsA, namespace: "y", nsTags: tagsX, fullName: "y.%sx.a_b.x_y", buckets: buckets}, - {name: "x", tags: tagsX, namespace: "y", nsTags: tagsA, fullName: "y.%sx.a_b.x_y", expectedCounter: "84", buckets: buckets}, - } - f := NewFactory(2) - for _, testCase := range testCases { - t.Run("", func(t *testing.T) { - if testCase.expectedCounter == "" { - testCase.expectedCounter = "42" - } - ff := f - if testCase.namespace != "" || testCase.nsTags != nil { - ff = f.Namespace(metrics.NSOptions{ - Name: testCase.namespace, - Tags: testCase.nsTags, - }) - } - counter := ff.Counter(metrics.Options{ - Name: counterPrefix + testCase.name, - Tags: testCase.tags, - }) - gauge := ff.Gauge(metrics.Options{ - Name: gaugePrefix + testCase.name, - Tags: testCase.tags, - }) - timer := ff.Timer(metrics.TimerOptions{ - Name: timerPrefix + testCase.name, - Tags: testCase.tags, - Buckets: testCase.durationBuckets, - }) - histogram := ff.Histogram(metrics.HistogramOptions{ - Name: histogramPrefix + testCase.name, - Tags: testCase.tags, - Buckets: testCase.buckets, - }) - - // register second time, should not panic - ff.Counter(metrics.Options{ - Name: counterPrefix + testCase.name, - Tags: testCase.tags, - }) - ff.Gauge(metrics.Options{ - Name: gaugePrefix + testCase.name, - Tags: testCase.tags, - }) - ff.Timer(metrics.TimerOptions{ - Name: timerPrefix + testCase.name, - Tags: testCase.tags, - Buckets: testCase.durationBuckets, - }) - ff.Histogram(metrics.HistogramOptions{ - Name: histogramPrefix + testCase.name, - Tags: testCase.tags, - Buckets: testCase.buckets, - }) - - counter.Inc(42) - gauge.Update(42) - timer.Record(42 * time.Millisecond) - histogram.Record(42) - - assertExpvar(t, fmt.Sprintf(testCase.fullName, counterPrefix), testCase.expectedCounter) - assertExpvar(t, fmt.Sprintf(testCase.fullName, gaugePrefix), "42") - assertExpvar(t, fmt.Sprintf(testCase.fullName, timerPrefix)+".p99", "0.042") - assertExpvar(t, fmt.Sprintf(testCase.fullName, histogramPrefix)+".p99", "42") - }) - } -} - -func assertExpvar(t *testing.T, fullName string, value string) { - var found expvar.KeyValue - expvar.Do(func(kv expvar.KeyValue) { - if kv.Key == fullName { - found = kv - } - }) - if !assert.Equal(t, fullName, found.Key) { - expvar.Do(func(kv expvar.KeyValue) { - if strings.HasPrefix(kv.Key, prefix) { - t.Log(kv) - } - }) - return - } - assert.Equal(t, value, found.Value.String(), fullName) -} diff --git a/internal/metrics/expvar/metrics.go b/internal/metrics/expvar/metrics.go deleted file mode 100644 index f3cbf740b1a..00000000000 --- a/internal/metrics/expvar/metrics.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "time" - - kit "github.com/go-kit/kit/metrics" -) - -// Counter is an adapter from go-kit Counter to jaeger-lib Counter -type Counter struct { - counter kit.Counter -} - -// NewCounter creates a new Counter -func NewCounter(counter kit.Counter) *Counter { - return &Counter{counter: counter} -} - -// Inc adds the given value to the counter. -func (c *Counter) Inc(delta int64) { - c.counter.Add(float64(delta)) -} - -// Gauge is an adapter from go-kit Gauge to jaeger-lib Gauge -type Gauge struct { - gauge kit.Gauge -} - -// NewGauge creates a new Gauge -func NewGauge(gauge kit.Gauge) *Gauge { - return &Gauge{gauge: gauge} -} - -// Update the gauge to the value passed in. -func (g *Gauge) Update(value int64) { - g.gauge.Set(float64(value)) -} - -// Timer is an adapter from go-kit Histogram to jaeger-lib Timer -type Timer struct { - hist kit.Histogram -} - -// NewTimer creates a new Timer -func NewTimer(hist kit.Histogram) *Timer { - return &Timer{hist: hist} -} - -// Record saves the time passed in. -func (t *Timer) Record(delta time.Duration) { - t.hist.Observe(delta.Seconds()) -} - -// Histogram is an adapter from go-kit Histogram to jaeger-lib Histogram -type Histogram struct { - hist kit.Histogram -} - -// NewHistogram creates a new Histogram -func NewHistogram(hist kit.Histogram) *Histogram { - return &Histogram{hist: hist} -} - -// Record saves the value passed in. -func (t *Histogram) Record(value float64) { - t.hist.Observe(value) -} diff --git a/internal/metrics/expvar/metrics_test.go b/internal/metrics/expvar/metrics_test.go deleted file mode 100644 index ca98480f3b5..00000000000 --- a/internal/metrics/expvar/metrics_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar_test - -import ( - "testing" - "time" - - "github.com/go-kit/kit/metrics/generic" - "github.com/stretchr/testify/assert" - - "github.com/jaegertracing/jaeger/internal/metrics/expvar" - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -func TestCounter(t *testing.T) { - kitCounter := generic.NewCounter("abc") - var counter metrics.Counter = expvar.NewCounter(kitCounter) - counter.Inc(123) - assert.EqualValues(t, 123, kitCounter.Value()) -} - -func TestGauge(t *testing.T) { - kitGauge := generic.NewGauge("abc") - var gauge metrics.Gauge = expvar.NewGauge(kitGauge) - gauge.Update(123) - assert.EqualValues(t, 123, kitGauge.Value()) -} - -func TestTimer(t *testing.T) { - kitHist := generic.NewHistogram("abc", 10) - var timer metrics.Timer = expvar.NewTimer(kitHist) - timer.Record(100*time.Millisecond + 500*time.Microsecond) // 100.5 milliseconds - assert.EqualValues(t, 0.1005, kitHist.Quantile(0.9)) -} - -func TestHistogram(t *testing.T) { - kitHist := generic.NewHistogram("abc", 10) - var histogram metrics.Histogram = expvar.NewHistogram(kitHist) - histogram.Record(100) - assert.EqualValues(t, 100, kitHist.Quantile(0.9)) -} diff --git a/internal/metrics/expvar/package_test.go b/internal/metrics/expvar/package_test.go deleted file mode 100644 index dabfdda4fce..00000000000 --- a/internal/metrics/expvar/package_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2023 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package expvar - -import ( - "testing" - - "github.com/jaegertracing/jaeger/pkg/testutils" -) - -func TestMain(m *testing.M) { - testutils.VerifyGoLeaks(m) -} diff --git a/internal/metrics/metricsbuilder/builder.go b/internal/metrics/metricsbuilder/builder.go index a546afdc0de..ed010324e24 100644 --- a/internal/metrics/metricsbuilder/builder.go +++ b/internal/metrics/metricsbuilder/builder.go @@ -44,8 +44,6 @@ type Builder struct { handler http.Handler } -// const expvarDepr = "(deprecated, will be removed after 2024-01-01 or in release v1.53.0, whichever is later) " - // AddFlags adds flags for Builder. func AddFlags(flags *flag.FlagSet) { flags.String(