Repository: jaegertracing/jaeger

Issue:
Remove dependency on jaeger-lib
There are several issues with the dependency on jaeger-lib:
  * it is shared with jaeger-client-go, which is now deprecated, so the library does not need to be standalone
  * library does not use go modules, migrating it to `go mod` is non-trivial because it's already v2
  * because it cannot be migrated to go modules, it cannot be upgraded to later versions of go-kit. The older 0.11 version of go-kit has dependencies with known vulnerabilities
  * there's not much need to depend on go-kit in the first place, we're only using it for its expvar package, which is relatively trivial to implement (especially without the histograms)

There are two directions we can take:
  1. migrate to OpenTelemetry instead. This is preferable, but will involve non-trivial amount of work. Good news is that work can likely be done piecemeal.
  2. Keep using jaeger-lib API for metrics and pull it inside this repo as `internal`.
    * unfortunately, this does not fully remove dependency on jaeger-lib because we're still using jaeger-client-go (cf. #3381, #3380)
  3. Keep using jaeger-lib API for metrics but implement it with OpenTelemetry SDK. This seems like the least resistance path (need to prototype it to test viability).

(Update 2023-01-29) Current plan:
  * [x] Clone jaeger-lib into Jaeger repo (done in #3767, #3772)
  * [x] Upgrade HotROD to use OTEL SDK (via OT bridge), which removes the need for uber/jaeger-lib (done in #4187)
  * [x] Upgrade tracegen to use OTEL SDK (done in #4189)
  * [x] Upgrade collector/query/all-in-one to use OTEL SDK (via OT bridge)
  * [x] Fix crossdock (maybe we don't need SDK testing there anymore)

Discussion:

Solution patch:
diff --git a/cmd/agent/app/builder.go b/cmd/agent/app/builder.go
index e9ee7831..e7696179 100644
--- a/cmd/agent/app/builder.go
+++ b/cmd/agent/app/builder.go
@@ -22,7 +22,6 @@ import (
 	"strconv"
 
 	"github.com/apache/thrift/lib/go/thrift"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
@@ -31,6 +30,7 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/ports"
 	agentThrift "github.com/jaegertracing/jaeger/thrift-gen/agent"
 )
diff --git a/cmd/agent/app/configmanager/metrics.go b/cmd/agent/app/configmanager/metrics.go
index 1046af95..1c46124d 100644
--- a/cmd/agent/app/configmanager/metrics.go
+++ b/cmd/agent/app/configmanager/metrics.go
@@ -17,8 +17,7 @@ package configmanager
 import (
 	"context"
 
-	"github.com/uber/jaeger-lib/metrics"
-
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/thrift-gen/baggage"
 	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
 )
diff --git a/cmd/agent/app/httpserver/srv.go b/cmd/agent/app/httpserver/srv.go
index 227be0bb..7d4bbaae 100644
--- a/cmd/agent/app/httpserver/srv.go
+++ b/cmd/agent/app/httpserver/srv.go
@@ -19,12 +19,12 @@ import (
 	"net/http"
 
 	"github.com/gorilla/mux"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
 	"github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // NewHTTPServer creates a new server that hosts an HTTP/JSON endpoint for clients
diff --git a/cmd/agent/app/processors/thrift_processor.go b/cmd/agent/app/processors/thrift_processor.go
index ea4c8958..8856aa5a 100644
--- a/cmd/agent/app/processors/thrift_processor.go
+++ b/cmd/agent/app/processors/thrift_processor.go
@@ -21,11 +21,11 @@ import (
 	"sync"
 
 	"github.com/apache/thrift/lib/go/thrift"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/customtransport"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // ThriftProcessor is a server that processes spans using a TBuffered Server
diff --git a/cmd/agent/app/reporter/client_metrics.go b/cmd/agent/app/reporter/client_metrics.go
index efbaa8c6..1bfd8d82 100644
--- a/cmd/agent/app/reporter/client_metrics.go
+++ b/cmd/agent/app/reporter/client_metrics.go
@@ -19,10 +19,10 @@ import (
 	"sync"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/atomic"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
 )
diff --git a/cmd/agent/app/reporter/connect_metrics.go b/cmd/agent/app/reporter/connect_metrics.go
index 2c416ffb..7af947ea 100644
--- a/cmd/agent/app/reporter/connect_metrics.go
+++ b/cmd/agent/app/reporter/connect_metrics.go
@@ -17,7 +17,7 @@ package reporter
 import (
 	"expvar"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type connectMetrics struct {
diff --git a/cmd/agent/app/reporter/grpc/builder.go b/cmd/agent/app/reporter/grpc/builder.go
index dfc3f6f4..ccc2a071 100644
--- a/cmd/agent/app/reporter/grpc/builder.go
+++ b/cmd/agent/app/reporter/grpc/builder.go
@@ -21,7 +21,6 @@ import (
 	"strings"
 
 	grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/connectivity"
@@ -34,6 +33,7 @@ import (
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/discovery"
 	"github.com/jaegertracing/jaeger/pkg/discovery/grpcresolver"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // ConnBuilder Struct to hold configurations
diff --git a/cmd/agent/app/reporter/grpc/collector_proxy.go b/cmd/agent/app/reporter/grpc/collector_proxy.go
index 2d9dc947..d9628102 100644
--- a/cmd/agent/app/reporter/grpc/collector_proxy.go
+++ b/cmd/agent/app/reporter/grpc/collector_proxy.go
@@ -17,13 +17,13 @@ package grpc
 import (
 	"io"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
 	grpcManager "github.com/jaegertracing/jaeger/cmd/agent/app/configmanager/grpc"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/multicloser"
 )
 
diff --git a/cmd/agent/app/reporter/metrics.go b/cmd/agent/app/reporter/metrics.go
index 6b0f0225..a1edaca3 100644
--- a/cmd/agent/app/reporter/metrics.go
+++ b/cmd/agent/app/reporter/metrics.go
@@ -17,8 +17,7 @@ package reporter
 import (
 	"context"
 
-	"github.com/uber/jaeger-lib/metrics"
-
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
 )
diff --git a/cmd/agent/app/servers/tbuffered_server.go b/cmd/agent/app/servers/tbuffered_server.go
index c4764cfe..6a9d49b4 100644
--- a/cmd/agent/app/servers/tbuffered_server.go
+++ b/cmd/agent/app/servers/tbuffered_server.go
@@ -20,7 +20,7 @@ import (
 	"sync"
 	"sync/atomic"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // ThriftTransport is a subset of thrift.TTransport methods, for easier mocking.
diff --git a/cmd/agent/main.go b/cmd/agent/main.go
index 5b22ab73..f88572ac 100644
--- a/cmd/agent/main.go
+++ b/cmd/agent/main.go
@@ -21,9 +21,7 @@ import (
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
-	"github.com/uber/jaeger-lib/metrics/fork"
 	_ "go.uber.org/automaxprocs"
 	"go.uber.org/zap"
 
@@ -33,7 +31,9 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/docs"
 	"github.com/jaegertracing/jaeger/cmd/flags"
 	"github.com/jaegertracing/jaeger/cmd/status"
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/version"
 	"github.com/jaegertracing/jaeger/ports"
 )
@@ -56,7 +56,7 @@ func main() {
 				Namespace(metrics.NSOptions{Name: "jaeger"}).
 				Namespace(metrics.NSOptions{Name: "agent"})
 			mFactory := fork.New("internal",
-				jexpvar.NewFactory(10), // backend for internal opts
+				metrics.NewJLibAdapter(jexpvar.NewFactory(10)), // backend for internal opts
 				baseFactory)
 			version.NewInfoMetrics(mFactory)
 
diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go
index 216936f3..32daf8d1 100644
--- a/cmd/all-in-one/main.go
+++ b/cmd/all-in-one/main.go
@@ -26,9 +26,8 @@ import (
 	"github.com/spf13/viper"
 	jaegerClientConfig "github.com/uber/jaeger-client-go/config"
 	jaegerClientZapLog "github.com/uber/jaeger-client-go/log/zap"
-	"github.com/uber/jaeger-lib/metrics"
+	jlibmetrics "github.com/uber/jaeger-lib/metrics"
 	jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
-	"github.com/uber/jaeger-lib/metrics/fork"
 	_ "go.uber.org/automaxprocs"
 	"go.uber.org/zap"
 
@@ -44,7 +43,9 @@ import (
 	queryApp "github.com/jaegertracing/jaeger/cmd/query/app"
 	"github.com/jaegertracing/jaeger/cmd/query/app/querysvc"
 	"github.com/jaegertracing/jaeger/cmd/status"
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/version"
 	metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics"
 	ss "github.com/jaegertracing/jaeger/plugin/sampling/strategystore"
@@ -97,11 +98,11 @@ by default uses only in-memory database.`,
 			logger := svc.Logger                     // shortcut
 			rootMetricsFactory := svc.MetricsFactory // shortcut
 			metricsFactory := fork.New("internal",
-				jexpvar.NewFactory(10), // backend for internal opts
+				metrics.NewJLibAdapter(jexpvar.NewFactory(10)), // backend for internal opts
 				rootMetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"}))
 			version.NewInfoMetrics(metricsFactory)
 
-			tracerCloser := initTracer(rootMetricsFactory, svc.Logger)
+			tracerCloser := initTracer(svc.JLibMetricsFactory, svc.Logger)
 
 			storageFactory.InitFromViper(v, logger)
 			if err := storageFactory.Initialize(metricsFactory, logger); err != nil {
@@ -283,7 +284,7 @@ func startQuery(
 	return server
 }
 
-func initTracer(metricsFactory metrics.Factory, logger *zap.Logger) io.Closer {
+func initTracer(metricsFactory jlibmetrics.Factory, logger *zap.Logger) io.Closer {
 	traceCfg := &jaegerClientConfig.Configuration{
 		ServiceName: "jaeger-query",
 		Sampler: &jaegerClientConfig.SamplerConfig{
diff --git a/cmd/collector/app/collector.go b/cmd/collector/app/collector.go
index 64dd3963..a81213d4 100644
--- a/cmd/collector/app/collector.go
+++ b/cmd/collector/app/collector.go
@@ -21,7 +21,6 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.opentelemetry.io/collector/component"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
@@ -32,6 +31,7 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/server"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
 
diff --git a/cmd/collector/app/metrics.go b/cmd/collector/app/metrics.go
index 89d75355..c7b5d551 100644
--- a/cmd/collector/app/metrics.go
+++ b/cmd/collector/app/metrics.go
@@ -19,10 +19,9 @@ import (
 	"strings"
 	"sync"
 
-	"github.com/uber/jaeger-lib/metrics"
-
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/normalizer"
 )
 
diff --git a/cmd/collector/app/options.go b/cmd/collector/app/options.go
index 9847d8e7..3be6c2b0 100644
--- a/cmd/collector/app/options.go
+++ b/cmd/collector/app/options.go
@@ -16,13 +16,13 @@
 package app
 
 import (
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer"
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type options struct {
diff --git a/cmd/collector/app/sampling/strategystore/factory.go b/cmd/collector/app/sampling/strategystore/factory.go
index bd9f33b7..e47bd310 100644
--- a/cmd/collector/app/sampling/strategystore/factory.go
+++ b/cmd/collector/app/sampling/strategystore/factory.go
@@ -15,9 +15,9 @@
 package strategystore
 
 import (
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 )
 
diff --git a/cmd/collector/app/server/http.go b/cmd/collector/app/server/http.go
index 09edb742..ab5e67e1 100644
--- a/cmd/collector/app/server/http.go
+++ b/cmd/collector/app/server/http.go
@@ -19,7 +19,6 @@ import (
 	"net/http"
 
 	"github.com/gorilla/mux"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 
@@ -29,6 +28,7 @@ import (
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
 	"github.com/jaegertracing/jaeger/pkg/httpmetrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/recoveryhandler"
 )
 
diff --git a/cmd/collector/app/server/zipkin.go b/cmd/collector/app/server/zipkin.go
index 49432a76..c7f7fcef 100644
--- a/cmd/collector/app/server/zipkin.go
+++ b/cmd/collector/app/server/zipkin.go
@@ -21,7 +21,6 @@ import (
 
 	"github.com/gorilla/mux"
 	"github.com/rs/cors"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 
@@ -30,6 +29,7 @@ import (
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
 	"github.com/jaegertracing/jaeger/pkg/httpmetrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/recoveryhandler"
 )
 
diff --git a/cmd/collector/app/span_handler_builder.go b/cmd/collector/app/span_handler_builder.go
index 6ba46da3..440aaaf6 100644
--- a/cmd/collector/app/span_handler_builder.go
+++ b/cmd/collector/app/span_handler_builder.go
@@ -18,7 +18,6 @@ package app
 import (
 	"os"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
@@ -27,6 +26,7 @@ import (
 	zs "github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer/zipkin"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/config/tenancy"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
 
diff --git a/cmd/collector/main.go b/cmd/collector/main.go
index 7cf7b025..ce70a3f2 100644
--- a/cmd/collector/main.go
+++ b/cmd/collector/main.go
@@ -23,9 +23,7 @@ import (
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	jexpvar "github.com/uber/jaeger-lib/metrics/expvar"
-	"github.com/uber/jaeger-lib/metrics/fork"
 	_ "go.uber.org/automaxprocs"
 	"go.uber.org/zap"
 
@@ -35,7 +33,9 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/env"
 	cmdFlags "github.com/jaegertracing/jaeger/cmd/flags"
 	"github.com/jaegertracing/jaeger/cmd/status"
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/version"
 	ss "github.com/jaegertracing/jaeger/plugin/sampling/strategystore"
 	"github.com/jaegertracing/jaeger/plugin/storage"
@@ -72,7 +72,7 @@ func main() {
 			logger := svc.Logger // shortcut
 			baseFactory := svc.MetricsFactory.Namespace(metrics.NSOptions{Name: "jaeger"})
 			metricsFactory := fork.New("internal",
-				jexpvar.NewFactory(10), // backend for internal opts
+				metrics.NewJLibAdapter(jexpvar.NewFactory(10)), // backend for internal opts
 				baseFactory.Namespace(metrics.NSOptions{Name: "collector"}))
 			version.NewInfoMetrics(metricsFactory)
 
diff --git a/cmd/flags/service.go b/cmd/flags/service.go
index f2ee9ba2..d079adc0 100644
--- a/cmd/flags/service.go
+++ b/cmd/flags/service.go
@@ -24,11 +24,11 @@ import (
 
 	grpcZap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
+	jlibmetrics "github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
-	pMetrics "github.com/jaegertracing/jaeger/pkg/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/ports"
 )
 
@@ -49,6 +49,8 @@ type Service struct {
 	// MetricsFactory is the root factory without a namespace.
 	MetricsFactory metrics.Factory
 
+	JLibMetricsFactory jlibmetrics.Factory
+
 	signalsChannel chan os.Signal
 
 	hcStatusChannel chan healthcheck.Status
@@ -75,7 +77,7 @@ func (s *Service) AddFlags(flagSet *flag.FlagSet) {
 	} else {
 		AddFlags(flagSet)
 	}
-	pMetrics.AddFlags(flagSet)
+	metrics.AddFlags(flagSet)
 	s.Admin.AddFlags(flagSet)
 }
 
@@ -104,12 +106,17 @@ func (s *Service) Start(v *viper.Viper) error {
 		return fmt.Errorf("cannot create logger: %w", err)
 	}
 
-	metricsBuilder := new(pMetrics.Builder).InitFromViper(v)
+	metricsBuilder := new(metrics.Builder).InitFromViper(v)
 	metricsFactory, err := metricsBuilder.CreateMetricsFactory("")
 	if err != nil {
 		return fmt.Errorf("cannot create metrics factory: %w", err)
 	}
 	s.MetricsFactory = metricsFactory
+	if jlib, ok := metricsFactory.(*metrics.JLibAdapter); ok {
+		s.JLibMetricsFactory = jlib.Unwrap()
+	} else {
+		s.JLibMetricsFactory = jlibmetrics.NullFactory
+	}
 
 	if err = s.Admin.initFromViper(v, s.Logger); err != nil {
 		return fmt.Errorf("cannot initialize admin server: %w", err)
diff --git a/cmd/ingester/app/builder/builder.go b/cmd/ingester/app/builder/builder.go
index d5cd0efc..d984b5dc 100644
--- a/cmd/ingester/app/builder/builder.go
+++ b/cmd/ingester/app/builder/builder.go
@@ -18,13 +18,13 @@ import (
 	"fmt"
 	"strings"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/consumer"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
 	kafkaConsumer "github.com/jaegertracing/jaeger/pkg/kafka/consumer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/kafka"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/cmd/ingester/app/consumer/consumer.go b/cmd/ingester/app/consumer/consumer.go
index 85633623..ab0d8be8 100644
--- a/cmd/ingester/app/consumer/consumer.go
+++ b/cmd/ingester/app/consumer/consumer.go
@@ -20,11 +20,11 @@ import (
 
 	"github.com/Shopify/sarama"
 	sc "github.com/bsm/sarama-cluster"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
 	"github.com/jaegertracing/jaeger/pkg/kafka/consumer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // Params are the parameters of a Consumer
diff --git a/cmd/ingester/app/consumer/consumer_metrics.go b/cmd/ingester/app/consumer/consumer_metrics.go
index 34b2c8e8..c744c24e 100644
--- a/cmd/ingester/app/consumer/consumer_metrics.go
+++ b/cmd/ingester/app/consumer/consumer_metrics.go
@@ -17,7 +17,7 @@ package consumer
 import (
 	"strconv"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 const consumerNamespace = "sarama-consumer"
diff --git a/cmd/ingester/app/consumer/deadlock_detector.go b/cmd/ingester/app/consumer/deadlock_detector.go
index 13e932ab..bac160f7 100644
--- a/cmd/ingester/app/consumer/deadlock_detector.go
+++ b/cmd/ingester/app/consumer/deadlock_detector.go
@@ -19,8 +19,9 @@ import (
 	"sync/atomic"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
+
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // deadlockDetector monitors the messages consumed and wither signals for the partition to be closed by sending a
diff --git a/cmd/ingester/app/consumer/offset/manager.go b/cmd/ingester/app/consumer/offset/manager.go
index 63f46aba..a9e39be8 100644
--- a/cmd/ingester/app/consumer/offset/manager.go
+++ b/cmd/ingester/app/consumer/offset/manager.go
@@ -19,7 +19,7 @@ import (
 	"sync"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 const (
diff --git a/cmd/ingester/app/consumer/processor_factory.go b/cmd/ingester/app/consumer/processor_factory.go
index abec3daa..3bef57b8 100644
--- a/cmd/ingester/app/consumer/processor_factory.go
+++ b/cmd/ingester/app/consumer/processor_factory.go
@@ -17,13 +17,13 @@ package consumer
 import (
 	"io"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/consumer/offset"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor/decorator"
 	"github.com/jaegertracing/jaeger/pkg/kafka/consumer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // ProcessorFactoryParams are the parameters of a ProcessorFactory
diff --git a/cmd/ingester/app/processor/decorator/retry.go b/cmd/ingester/app/processor/decorator/retry.go
index e5551792..70733d0f 100644
--- a/cmd/ingester/app/processor/decorator/retry.go
+++ b/cmd/ingester/app/processor/decorator/retry.go
@@ -19,9 +19,8 @@ import (
 	"math/rand"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
-
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type retryDecorator struct {
diff --git a/cmd/ingester/app/processor/metrics_decorator.go b/cmd/ingester/app/processor/metrics_decorator.go
index 40d52003..2983d2f6 100644
--- a/cmd/ingester/app/processor/metrics_decorator.go
+++ b/cmd/ingester/app/processor/metrics_decorator.go
@@ -18,7 +18,7 @@ import (
 	"io"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type metricsDecorator struct {
diff --git a/cmd/ingester/main.go b/cmd/ingester/main.go
index 6a9364f0..b8cce567 100644
--- a/cmd/ingester/main.go
+++ b/cmd/ingester/main.go
@@ -22,7 +22,6 @@ import (
 
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	_ "go.uber.org/automaxprocs"
 	"go.uber.org/zap"
 
@@ -33,6 +32,7 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/builder"
 	"github.com/jaegertracing/jaeger/cmd/status"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/version"
 	"github.com/jaegertracing/jaeger/plugin/storage"
 	"github.com/jaegertracing/jaeger/ports"
diff --git a/cmd/query/app/mocks/Watcher.go b/cmd/query/app/mocks/Watcher.go
index 37b1c9b8..1cd05b0d 100644
--- a/cmd/query/app/mocks/Watcher.go
+++ b/cmd/query/app/mocks/Watcher.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/cmd/query/main.go b/cmd/query/main.go
index ea40dcf9..30c6b178 100644
--- a/cmd/query/main.go
+++ b/cmd/query/main.go
@@ -25,7 +25,6 @@ import (
 	"github.com/spf13/viper"
 	jaegerClientConfig "github.com/uber/jaeger-client-go/config"
 	jaegerClientZapLog "github.com/uber/jaeger-client-go/log/zap"
-	"github.com/uber/jaeger-lib/metrics"
 	_ "go.uber.org/automaxprocs"
 	"go.uber.org/zap"
 
@@ -37,6 +36,7 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/status"
 	"github.com/jaegertracing/jaeger/pkg/bearertoken"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/version"
 	metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage"
@@ -86,7 +86,7 @@ func main() {
 				logger.Fatal("Failed to read tracer configuration", zap.Error(err))
 			}
 			tracer, closer, err := traceCfg.NewTracer(
-				jaegerClientConfig.Metrics(svc.MetricsFactory),
+				jaegerClientConfig.Metrics(svc.JLibMetricsFactory),
 				jaegerClientConfig.Logger(jaegerClientZapLog.NewLogger(logger)),
 			)
 			if err != nil {
diff --git a/internal/metrics/fork/fork.go b/internal/metrics/fork/fork.go
new file mode 100644
index 00000000..4940f47e
--- /dev/null
+++ b/internal/metrics/fork/fork.go
@@ -0,0 +1,67 @@
+// Copyright (c) 2020 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 fork
+
+import "github.com/jaegertracing/jaeger/pkg/metrics"
+
+// Factory represents a metrics factory that delegates metrics with
+// forkNamespace to forkFactory otherwise - defaultFactory is used.
+type Factory struct {
+	forkNamespace  string
+	forkFactory    metrics.Factory
+	defaultFactory metrics.Factory
+}
+
+// New creates new fork.Factory.
+func New(forkNamespace string, forkFactory, defaultFactory metrics.Factory) metrics.Factory {
+	return &Factory{
+		forkNamespace:  forkNamespace,
+		forkFactory:    forkFactory,
+		defaultFactory: defaultFactory,
+	}
+}
+
+// Gauge implements metrics.Factory interface.
+func (f *Factory) Gauge(options metrics.Options) metrics.Gauge {
+	return f.defaultFactory.Gauge(options)
+}
+
+// Counter implements metrics.Factory interface.
+func (f *Factory) Counter(metric metrics.Options) metrics.Counter {
+	return f.defaultFactory.Counter(metric)
+}
+
+// Timer implements metrics.Factory interface.
+func (f *Factory) Timer(metric metrics.TimerOptions) metrics.Timer {
+	return f.defaultFactory.Timer(metric)
+}
+
+// Histogram implements metrics.Factory interface.
+func (f *Factory) Histogram(metric metrics.HistogramOptions) metrics.Histogram {
+	return f.defaultFactory.Histogram(metric)
+}
+
+// Namespace implements metrics.Factory interface.
+func (f *Factory) Namespace(scope metrics.NSOptions) metrics.Factory {
+	if scope.Name == f.forkNamespace {
+		return f.forkFactory.Namespace(scope)
+	}
+
+	return &Factory{
+		forkNamespace:  f.forkNamespace,
+		forkFactory:    f.forkFactory.Namespace(scope),
+		defaultFactory: f.defaultFactory.Namespace(scope),
+	}
+}
diff --git a/pkg/cassandra/metrics/table.go b/pkg/cassandra/metrics/table.go
index c1e2e7ab..6df40c0c 100644
--- a/pkg/cassandra/metrics/table.go
+++ b/pkg/cassandra/metrics/table.go
@@ -19,10 +19,10 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
 )
 
diff --git a/pkg/clientcfg/clientcfghttp/handler.go b/pkg/clientcfg/clientcfghttp/handler.go
index af2ebe1a..53b8e52f 100644
--- a/pkg/clientcfg/clientcfghttp/handler.go
+++ b/pkg/clientcfg/clientcfghttp/handler.go
@@ -23,9 +23,9 @@ import (
 	"strings"
 
 	"github.com/gorilla/mux"
-	"github.com/uber/jaeger-lib/metrics"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	tSampling "github.com/jaegertracing/jaeger/thrift-gen/sampling"
 )
 
diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go
index df6bfaa5..e6f7909d 100644
--- a/pkg/es/config/config.go
+++ b/pkg/es/config/config.go
@@ -30,7 +30,6 @@ import (
 	"time"
 
 	"github.com/olivere/elastic"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 	"go.uber.org/zap/zapgrpc"
@@ -39,6 +38,7 @@ import (
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/es"
 	eswrapper "github.com/jaegertracing/jaeger/pkg/es/wrapper"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
 )
 
diff --git a/pkg/es/mocks/Client.go b/pkg/es/mocks/Client.go
index 75c8a1c4..9ea6a668 100644
--- a/pkg/es/mocks/Client.go
+++ b/pkg/es/mocks/Client.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/ClusterAPI.go b/pkg/es/mocks/ClusterAPI.go
index c3686bc4..9efe8d92 100644
--- a/pkg/es/mocks/ClusterAPI.go
+++ b/pkg/es/mocks/ClusterAPI.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import mock "github.com/stretchr/testify/mock"
diff --git a/pkg/es/mocks/IndexAPI.go b/pkg/es/mocks/IndexAPI.go
index f0a09c49..199bc07d 100644
--- a/pkg/es/mocks/IndexAPI.go
+++ b/pkg/es/mocks/IndexAPI.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/IndexManagementLifecycleAPI.go b/pkg/es/mocks/IndexManagementLifecycleAPI.go
index 378c4cac..9823d56f 100644
--- a/pkg/es/mocks/IndexManagementLifecycleAPI.go
+++ b/pkg/es/mocks/IndexManagementLifecycleAPI.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import mock "github.com/stretchr/testify/mock"
diff --git a/pkg/es/mocks/IndexService.go b/pkg/es/mocks/IndexService.go
index 5ecd4e69..d9672d55 100644
--- a/pkg/es/mocks/IndexService.go
+++ b/pkg/es/mocks/IndexService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/IndicesCreateService.go b/pkg/es/mocks/IndicesCreateService.go
index 5971db09..4f379a08 100644
--- a/pkg/es/mocks/IndicesCreateService.go
+++ b/pkg/es/mocks/IndicesCreateService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/IndicesExistsService.go b/pkg/es/mocks/IndicesExistsService.go
index 0639710b..255c2ed8 100644
--- a/pkg/es/mocks/IndicesExistsService.go
+++ b/pkg/es/mocks/IndicesExistsService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/MultiSearchService.go b/pkg/es/mocks/MultiSearchService.go
index 3e4c9ab5..66b16158 100644
--- a/pkg/es/mocks/MultiSearchService.go
+++ b/pkg/es/mocks/MultiSearchService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/SearchService.go b/pkg/es/mocks/SearchService.go
index 66c385e2..6e97df17 100644
--- a/pkg/es/mocks/SearchService.go
+++ b/pkg/es/mocks/SearchService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/TemplateApplier.go b/pkg/es/mocks/TemplateApplier.go
index 5deaaefb..8b678e3c 100644
--- a/pkg/es/mocks/TemplateApplier.go
+++ b/pkg/es/mocks/TemplateApplier.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/TemplateBuilder.go b/pkg/es/mocks/TemplateBuilder.go
index b8f1ab45..5c4b43b0 100644
--- a/pkg/es/mocks/TemplateBuilder.go
+++ b/pkg/es/mocks/TemplateBuilder.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/es/mocks/TemplateCreateService.go b/pkg/es/mocks/TemplateCreateService.go
index cdcb1571..b9c55813 100644
--- a/pkg/es/mocks/TemplateCreateService.go
+++ b/pkg/es/mocks/TemplateCreateService.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/pkg/httpmetrics/metrics.go b/pkg/httpmetrics/metrics.go
index d26d5ad9..1c13a16e 100644
--- a/pkg/httpmetrics/metrics.go
+++ b/pkg/httpmetrics/metrics.go
@@ -20,7 +20,7 @@ import (
 	"sync"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type statusRecorder struct {
diff --git a/pkg/metrics/builder.go b/pkg/metrics/builder.go
index ce5dc08a..16a6672b 100644
--- a/pkg/metrics/builder.go
+++ b/pkg/metrics/builder.go
@@ -67,19 +67,19 @@ func (b *Builder) InitFromViper(v *viper.Viper) *Builder {
 // CreateMetricsFactory creates a metrics factory based on the configured type of the backend.
 // If the metrics backend supports HTTP endpoint for scraping, it is stored in the builder and
 // can be later added by RegisterHandler function.
-func (b *Builder) CreateMetricsFactory(namespace string) (metrics.Factory, error) {
+func (b *Builder) CreateMetricsFactory(namespace string) (Factory, error) {
 	if b.Backend == "prometheus" {
 		metricsFactory := jprom.New().Namespace(metrics.NSOptions{Name: namespace, Tags: nil})
 		b.handler = promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{DisableCompression: true})
-		return metricsFactory, nil
+		return NewJLibAdapter(metricsFactory), nil
 	}
 	if b.Backend == "expvar" {
 		metricsFactory := jexpvar.NewFactory(10).Namespace(metrics.NSOptions{Name: namespace, Tags: nil})
 		b.handler = expvar.Handler()
-		return metricsFactory, nil
+		return NewJLibAdapter(metricsFactory), nil
 	}
 	if b.Backend == "none" || b.Backend == "" {
-		return metrics.NullFactory, nil
+		return NullFactory, nil
 	}
 	return nil, errUnknownBackend
 }
@@ -88,3 +88,60 @@ func (b *Builder) CreateMetricsFactory(namespace string) (metrics.Factory, error
 func (b *Builder) Handler() http.Handler {
 	return b.handler
 }
+
+// JLibAdapter is temporary type used to bridge metrics API in this package
+// with that of jaeger-lib.
+type JLibAdapter struct {
+	f metrics.Factory
+}
+
+var _ Factory = (*JLibAdapter)(nil)
+
+func NewJLibAdapter(f metrics.Factory) *JLibAdapter {
+	return &JLibAdapter{f: f}
+}
+
+func (a *JLibAdapter) Counter(opts Options) Counter {
+	return a.f.Counter(metrics.Options{
+		Name: opts.Name,
+		Tags: opts.Tags,
+		Help: opts.Help,
+	})
+}
+
+func (a *JLibAdapter) Timer(opts TimerOptions) Timer {
+	return a.f.Timer(metrics.TimerOptions{
+		Name:    opts.Name,
+		Tags:    opts.Tags,
+		Help:    opts.Help,
+		Buckets: opts.Buckets,
+	})
+}
+
+func (a *JLibAdapter) Gauge(opts Options) Gauge {
+	return a.f.Gauge(metrics.Options{
+		Name: opts.Name,
+		Tags: opts.Tags,
+		Help: opts.Help,
+	})
+}
+
+func (a *JLibAdapter) Histogram(opts HistogramOptions) Histogram {
+	return a.f.Histogram(metrics.HistogramOptions{
+		Name:    opts.Name,
+		Tags:    opts.Tags,
+		Help:    opts.Help,
+		Buckets: opts.Buckets,
+	})
+}
+
+func (a *JLibAdapter) Namespace(opts NSOptions) Factory {
+	return &JLibAdapter{f: a.f.Namespace(metrics.NSOptions{
+		Name: opts.Name,
+		Tags: opts.Tags,
+	})}
+}
+
+func (a *JLibAdapter) Unwrap() metrics.Factory {
+	return a.f
+}
diff --git a/pkg/metrics/counter.go b/pkg/metrics/counter.go
new file mode 100644
index 00000000..e5949408
--- /dev/null
+++ b/pkg/metrics/counter.go
@@ -0,0 +1,29 @@
+// 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 metrics
+
+// Counter tracks the number of times an event has occurred
+type Counter interface {
+	// Inc adds the given value to the counter.
+	Inc(int64)
+}
+
+// NullCounter counter that does nothing
+var NullCounter Counter = nullCounter{}
+
+type nullCounter struct{}
+
+func (nullCounter) Inc(int64) {}
diff --git a/pkg/metrics/factory.go b/pkg/metrics/factory.go
new file mode 100644
index 00000000..e7725712
--- /dev/null
+++ b/pkg/metrics/factory.go
@@ -0,0 +1,82 @@
+// 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 metrics
+
+import (
+	"time"
+)
+
+// NSOptions defines the name and tags map associated with a factory namespace
+type NSOptions struct {
+	Name string
+	Tags map[string]string
+}
+
+// Options defines the information associated with a metric
+type Options struct {
+	Name string
+	Tags map[string]string
+	Help string
+}
+
+// TimerOptions defines the information associated with a metric
+type TimerOptions struct {
+	Name    string
+	Tags    map[string]string
+	Help    string
+	Buckets []time.Duration
+}
+
+// HistogramOptions defines the information associated with a metric
+type HistogramOptions struct {
+	Name    string
+	Tags    map[string]string
+	Help    string
+	Buckets []float64
+}
+
+// Factory creates new metrics
+type Factory interface {
+	Counter(metric Options) Counter
+	Timer(metric TimerOptions) Timer
+	Gauge(metric Options) Gauge
+	Histogram(metric HistogramOptions) Histogram
+
+	// Namespace returns a nested metrics factory.
+	Namespace(scope NSOptions) Factory
+}
+
+// NullFactory is a metrics factory that returns NullCounter, NullTimer, and NullGauge.
+var NullFactory Factory = nullFactory{}
+
+type nullFactory struct{}
+
+func (nullFactory) Counter(options Options) Counter {
+	return NullCounter
+}
+
+func (nullFactory) Timer(options TimerOptions) Timer {
+	return NullTimer
+}
+
+func (nullFactory) Gauge(options Options) Gauge {
+	return NullGauge
+}
+
+func (nullFactory) Histogram(options HistogramOptions) Histogram {
+	return NullHistogram
+}
+func (nullFactory) Namespace(scope NSOptions) Factory { return NullFactory }
diff --git a/pkg/metrics/gauge.go b/pkg/metrics/gauge.go
new file mode 100644
index 00000000..53631d45
--- /dev/null
+++ b/pkg/metrics/gauge.go
@@ -0,0 +1,29 @@
+// 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 metrics
+
+// Gauge returns instantaneous measurements of something as an int64 value
+type Gauge interface {
+	// Update the gauge to the value passed in.
+	Update(int64)
+}
+
+// NullGauge gauge that does nothing
+var NullGauge Gauge = nullGauge{}
+
+type nullGauge struct{}
+
+func (nullGauge) Update(int64) {}
diff --git a/pkg/metrics/histogram.go b/pkg/metrics/histogram.go
new file mode 100644
index 00000000..d3bd6174
--- /dev/null
+++ b/pkg/metrics/histogram.go
@@ -0,0 +1,28 @@
+// Copyright (c) 2018 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 metrics
+
+// Histogram that keeps track of a distribution of values.
+type Histogram interface {
+	// Records the value passed in.
+	Record(float64)
+}
+
+// NullHistogram that does nothing
+var NullHistogram Histogram = nullHistogram{}
+
+type nullHistogram struct{}
+
+func (nullHistogram) Record(float64) {}
diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go
new file mode 100644
index 00000000..1012cbf9
--- /dev/null
+++ b/pkg/metrics/metrics.go
@@ -0,0 +1,138 @@
+// 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 metrics
+
+import (
+	"fmt"
+	"reflect"
+	"strconv"
+	"strings"
+)
+
+// MustInit initializes the passed in metrics and initializes its fields using the passed in factory.
+//
+// It uses reflection to initialize a struct containing metrics fields
+// by assigning new Counter/Gauge/Timer values with the metric name retrieved
+// from the `metric` tag and stats tags retrieved from the `tags` tag.
+//
+// Note: all fields of the struct must be exported, have a `metric` tag, and be
+// of type Counter or Gauge or Timer.
+//
+// Errors during Init lead to a panic.
+func MustInit(metrics interface{}, factory Factory, globalTags map[string]string) {
+	if err := Init(metrics, factory, globalTags); err != nil {
+		panic(err.Error())
+	}
+}
+
+// Init does the same as MustInit, but returns an error instead of
+// panicking.
+func Init(m interface{}, factory Factory, globalTags map[string]string) error {
+	// Allow user to opt out of reporting metrics by passing in nil.
+	if factory == nil {
+		factory = NullFactory
+	}
+
+	counterPtrType := reflect.TypeOf((*Counter)(nil)).Elem()
+	gaugePtrType := reflect.TypeOf((*Gauge)(nil)).Elem()
+	timerPtrType := reflect.TypeOf((*Timer)(nil)).Elem()
+	histogramPtrType := reflect.TypeOf((*Histogram)(nil)).Elem()
+
+	v := reflect.ValueOf(m).Elem()
+	t := v.Type()
+	for i := 0; i < t.NumField(); i++ {
+		tags := make(map[string]string)
+		for k, v := range globalTags {
+			tags[k] = v
+		}
+		var buckets []float64
+		field := t.Field(i)
+		metric := field.Tag.Get("metric")
+		if metric == "" {
+			return fmt.Errorf("Field %s is missing a tag 'metric'", field.Name)
+		}
+		if tagString := field.Tag.Get("tags"); tagString != "" {
+			tagPairs := strings.Split(tagString, ",")
+			for _, tagPair := range tagPairs {
+				tag := strings.Split(tagPair, "=")
+				if len(tag) != 2 {
+					return fmt.Errorf(
+						"Field [%s]: Tag [%s] is not of the form key=value in 'tags' string [%s]",
+						field.Name, tagPair, tagString)
+				}
+				tags[tag[0]] = tag[1]
+			}
+		}
+		if bucketString := field.Tag.Get("buckets"); bucketString != "" {
+			if field.Type.AssignableTo(timerPtrType) {
+				// TODO: Parse timer duration buckets
+				return fmt.Errorf(
+					"Field [%s]: Buckets are not currently initialized for timer metrics",
+					field.Name)
+			} else if field.Type.AssignableTo(histogramPtrType) {
+				bucketValues := strings.Split(bucketString, ",")
+				for _, bucket := range bucketValues {
+					b, err := strconv.ParseFloat(bucket, 64)
+					if err != nil {
+						return fmt.Errorf(
+							"Field [%s]: Bucket [%s] could not be converted to float64 in 'buckets' string [%s]",
+							field.Name, bucket, bucketString)
+					}
+					buckets = append(buckets, b)
+				}
+			} else {
+				return fmt.Errorf(
+					"Field [%s]: Buckets should only be defined for Timer and Histogram metric types",
+					field.Name)
+			}
+		}
+		help := field.Tag.Get("help")
+		var obj interface{}
+		if field.Type.AssignableTo(counterPtrType) {
+			obj = factory.Counter(Options{
+				Name: metric,
+				Tags: tags,
+				Help: help,
+			})
+		} else if field.Type.AssignableTo(gaugePtrType) {
+			obj = factory.Gauge(Options{
+				Name: metric,
+				Tags: tags,
+				Help: help,
+			})
+		} else if field.Type.AssignableTo(timerPtrType) {
+			// TODO: Add buckets once parsed (see TODO above)
+			obj = factory.Timer(TimerOptions{
+				Name: metric,
+				Tags: tags,
+				Help: help,
+			})
+		} else if field.Type.AssignableTo(histogramPtrType) {
+			obj = factory.Histogram(HistogramOptions{
+				Name:    metric,
+				Tags:    tags,
+				Help:    help,
+				Buckets: buckets,
+			})
+		} else {
+			return fmt.Errorf(
+				"Field %s is not a pointer to timer, gauge, or counter",
+				field.Name)
+		}
+		v.Field(i).Set(reflect.ValueOf(obj))
+	}
+	return nil
+}
diff --git a/pkg/metrics/package.go b/pkg/metrics/package.go
index 7bcb53d1..9764382d 100644
--- a/pkg/metrics/package.go
+++ b/pkg/metrics/package.go
@@ -13,5 +13,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// Package metrics provides command line flags for configuring the metrics backend.
+// Package metrics provides an internal abstraction for metrics API,
+// and command line flags for configuring the metrics backend.
 package metrics
diff --git a/pkg/metrics/stopwatch.go b/pkg/metrics/stopwatch.go
new file mode 100644
index 00000000..0ca70979
--- /dev/null
+++ b/pkg/metrics/stopwatch.go
@@ -0,0 +1,44 @@
+// 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 metrics
+
+import (
+	"time"
+)
+
+// StartStopwatch begins recording the executing time of an event, returning
+// a Stopwatch that should be used to stop the recording the time for
+// that event.  Multiple events can be occurring simultaneously each
+// represented by different active Stopwatches
+func StartStopwatch(timer Timer) Stopwatch {
+	return Stopwatch{t: timer, start: time.Now()}
+}
+
+// A Stopwatch tracks the execution time of a specific event
+type Stopwatch struct {
+	t     Timer
+	start time.Time
+}
+
+// Stop stops executing of the stopwatch and records the amount of elapsed time
+func (s Stopwatch) Stop() {
+	s.t.Record(s.ElapsedTime())
+}
+
+// ElapsedTime returns the amount of elapsed time (in time.Duration)
+func (s Stopwatch) ElapsedTime() time.Duration {
+	return time.Since(s.start)
+}
diff --git a/pkg/metrics/timer.go b/pkg/metrics/timer.go
new file mode 100644
index 00000000..75df952d
--- /dev/null
+++ b/pkg/metrics/timer.go
@@ -0,0 +1,34 @@
+// 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 metrics
+
+import (
+	"time"
+)
+
+// Timer accumulates observations about how long some operation took,
+// and also maintains a historgam of percentiles.
+type Timer interface {
+	// Records the time passed in.
+	Record(time.Duration)
+}
+
+// NullTimer timer that does nothing
+var NullTimer Timer = nullTimer{}
+
+type nullTimer struct{}
+
+func (nullTimer) Record(time.Duration) {}
diff --git a/pkg/queue/bounded_queue.go b/pkg/queue/bounded_queue.go
index 0ade4b02..7d95ef14 100644
--- a/pkg/queue/bounded_queue.go
+++ b/pkg/queue/bounded_queue.go
@@ -21,8 +21,9 @@ import (
 	"time"
 	"unsafe"
 
-	"github.com/uber/jaeger-lib/metrics"
 	uatomic "go.uber.org/atomic"
+
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // Consumer consumes data from a bounded queue
diff --git a/pkg/version/build.go b/pkg/version/build.go
index 5d9f2621..33438e23 100644
--- a/pkg/version/build.go
+++ b/pkg/version/build.go
@@ -14,7 +14,7 @@
 
 package version
 
-import "github.com/uber/jaeger-lib/metrics"
+import "github.com/jaegertracing/jaeger/pkg/metrics"
 
 var (
 	// commitFromGit is a constant representing the source version that
diff --git a/plugin/sampling/strategystore/adaptive/aggregator.go b/plugin/sampling/strategystore/adaptive/aggregator.go
index 26cc3c5e..2b76a3c7 100644
--- a/plugin/sampling/strategystore/adaptive/aggregator.go
+++ b/plugin/sampling/strategystore/adaptive/aggregator.go
@@ -19,10 +19,10 @@ import (
 	"time"
 
 	"github.com/uber/jaeger-client-go"
-	"github.com/uber/jaeger-lib/metrics"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
 )
 
diff --git a/plugin/sampling/strategystore/adaptive/factory.go b/plugin/sampling/strategystore/adaptive/factory.go
index 01d1f0fe..d45f8e61 100644
--- a/plugin/sampling/strategystore/adaptive/factory.go
+++ b/plugin/sampling/strategystore/adaptive/factory.go
@@ -19,11 +19,11 @@ import (
 	"flag"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/plugin/sampling/strategystore/adaptive/processor.go b/plugin/sampling/strategystore/adaptive/processor.go
index 119af6b3..2eb84a8a 100644
--- a/plugin/sampling/strategystore/adaptive/processor.go
+++ b/plugin/sampling/strategystore/adaptive/processor.go
@@ -22,10 +22,10 @@ import (
 	"sync"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/sampling/calculationstrategy"
 	"github.com/jaegertracing/jaeger/plugin/sampling/leaderelection"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/plugin/sampling/strategystore/adaptive/strategy_store.go b/plugin/sampling/strategystore/adaptive/strategy_store.go
index c47e01aa..76d2b9f5 100644
--- a/plugin/sampling/strategystore/adaptive/strategy_store.go
+++ b/plugin/sampling/strategystore/adaptive/strategy_store.go
@@ -15,11 +15,11 @@
 package adaptive
 
 import (
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
 	"github.com/jaegertracing/jaeger/pkg/hostname"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/sampling/leaderelection"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
 )
diff --git a/plugin/sampling/strategystore/factory.go b/plugin/sampling/strategystore/factory.go
index 5cd9716a..9cc2693e 100644
--- a/plugin/sampling/strategystore/factory.go
+++ b/plugin/sampling/strategystore/factory.go
@@ -19,10 +19,10 @@ import (
 	"fmt"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/plugin/sampling/strategystore/adaptive"
 	"github.com/jaegertracing/jaeger/plugin/sampling/strategystore/static"
diff --git a/plugin/sampling/strategystore/static/factory.go b/plugin/sampling/strategystore/static/factory.go
index 01dc0d94..91aa46e6 100644
--- a/plugin/sampling/strategystore/static/factory.go
+++ b/plugin/sampling/strategystore/static/factory.go
@@ -18,10 +18,10 @@ import (
 	"flag"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage"
 )
diff --git a/plugin/storage/badger/factory.go b/plugin/storage/badger/factory.go
index 598a9743..b5665e0b 100644
--- a/plugin/storage/badger/factory.go
+++ b/plugin/storage/badger/factory.go
@@ -24,9 +24,9 @@ import (
 
 	"github.com/dgraph-io/badger/v3"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	depStore "github.com/jaegertracing/jaeger/plugin/storage/badger/dependencystore"
 	badgerStore "github.com/jaegertracing/jaeger/plugin/storage/badger/spanstore"
diff --git a/plugin/storage/cassandra/dependencystore/storage.go b/plugin/storage/cassandra/dependencystore/storage.go
index 71e7d56d..7906f63c 100644
--- a/plugin/storage/cassandra/dependencystore/storage.go
+++ b/plugin/storage/cassandra/dependencystore/storage.go
@@ -21,12 +21,12 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // Version determines which version of the dependencies table to use.
diff --git a/plugin/storage/cassandra/factory.go b/plugin/storage/cassandra/factory.go
index 3cc28d39..507f847e 100644
--- a/plugin/storage/cassandra/factory.go
+++ b/plugin/storage/cassandra/factory.go
@@ -21,13 +21,13 @@ import (
 	"io"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/config"
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
 	"github.com/jaegertracing/jaeger/pkg/hostname"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	cLock "github.com/jaegertracing/jaeger/plugin/pkg/distributedlock/cassandra"
 	cDepStore "github.com/jaegertracing/jaeger/plugin/storage/cassandra/dependencystore"
diff --git a/plugin/storage/cassandra/samplingstore/storage.go b/plugin/storage/cassandra/samplingstore/storage.go
index 5c2d2b50..2ccdc846 100644
--- a/plugin/storage/cassandra/samplingstore/storage.go
+++ b/plugin/storage/cassandra/samplingstore/storage.go
@@ -25,12 +25,12 @@ import (
 	"time"
 
 	"github.com/gocql/gocql"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 const (
diff --git a/plugin/storage/cassandra/spanstore/operation_names.go b/plugin/storage/cassandra/spanstore/operation_names.go
index e3883b8a..167dcbd1 100644
--- a/plugin/storage/cassandra/spanstore/operation_names.go
+++ b/plugin/storage/cassandra/spanstore/operation_names.go
@@ -19,12 +19,12 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/cache"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/cassandra/spanstore/dbmodel"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/plugin/storage/cassandra/spanstore/reader.go b/plugin/storage/cassandra/spanstore/reader.go
index b080bb1b..621e327a 100644
--- a/plugin/storage/cassandra/spanstore/reader.go
+++ b/plugin/storage/cassandra/spanstore/reader.go
@@ -24,12 +24,12 @@ import (
 	"github.com/opentracing/opentracing-go"
 	ottag "github.com/opentracing/opentracing-go/ext"
 	otlog "github.com/opentracing/opentracing-go/log"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/cassandra/spanstore/dbmodel"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/plugin/storage/cassandra/spanstore/service_names.go b/plugin/storage/cassandra/spanstore/service_names.go
index 98dc192d..6013573d 100644
--- a/plugin/storage/cassandra/spanstore/service_names.go
+++ b/plugin/storage/cassandra/spanstore/service_names.go
@@ -19,12 +19,12 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/cache"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 const (
diff --git a/plugin/storage/cassandra/spanstore/writer.go b/plugin/storage/cassandra/spanstore/writer.go
index a8ac59fb..0dffc8de 100644
--- a/plugin/storage/cassandra/spanstore/writer.go
+++ b/plugin/storage/cassandra/spanstore/writer.go
@@ -23,12 +23,12 @@ import (
 	"time"
 	"unicode/utf8"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	casMetrics "github.com/jaegertracing/jaeger/pkg/cassandra/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/cassandra/spanstore/dbmodel"
 )
 
diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go
index 835311e7..cf98e692 100644
--- a/plugin/storage/es/factory.go
+++ b/plugin/storage/es/factory.go
@@ -21,11 +21,11 @@ import (
 	"io"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/es"
 	"github.com/jaegertracing/jaeger/pkg/es/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	esDepStore "github.com/jaegertracing/jaeger/plugin/storage/es/dependencystore"
 	"github.com/jaegertracing/jaeger/plugin/storage/es/mappings"
diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go
index af4c834c..0d6ccaa7 100644
--- a/plugin/storage/es/spanstore/reader.go
+++ b/plugin/storage/es/spanstore/reader.go
@@ -27,11 +27,11 @@ import (
 	"github.com/opentracing/opentracing-go"
 	ottag "github.com/opentracing/opentracing-go/ext"
 	otlog "github.com/opentracing/opentracing-go/log"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/es"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/plugin/storage/es/spanstore/writer.go b/plugin/storage/es/spanstore/writer.go
index bf69ae07..589e3464 100644
--- a/plugin/storage/es/spanstore/writer.go
+++ b/plugin/storage/es/spanstore/writer.go
@@ -20,12 +20,12 @@ import (
 	"strings"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cache"
 	"github.com/jaegertracing/jaeger/pkg/es"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel"
 	storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
 )
diff --git a/plugin/storage/factory.go b/plugin/storage/factory.go
index 61f68ebe..1e8c92b2 100644
--- a/plugin/storage/factory.go
+++ b/plugin/storage/factory.go
@@ -21,9 +21,9 @@ import (
 	"io"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/multierror"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/plugin/storage/badger"
diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go
index 5a28c2e3..32c7f24d 100644
--- a/plugin/storage/grpc/factory.go
+++ b/plugin/storage/grpc/factory.go
@@ -20,9 +20,9 @@ import (
 	"io"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/plugin/storage/grpc/config"
 	"github.com/jaegertracing/jaeger/plugin/storage/grpc/shared"
diff --git a/plugin/storage/kafka/factory.go b/plugin/storage/kafka/factory.go
index 1956ad75..8eb886fd 100644
--- a/plugin/storage/kafka/factory.go
+++ b/plugin/storage/kafka/factory.go
@@ -21,10 +21,10 @@ import (
 
 	"github.com/Shopify/sarama"
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/kafka/producer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
diff --git a/plugin/storage/kafka/writer.go b/plugin/storage/kafka/writer.go
index 03e23886..9be38926 100644
--- a/plugin/storage/kafka/writer.go
+++ b/plugin/storage/kafka/writer.go
@@ -18,10 +18,10 @@ import (
 	"context"
 
 	"github.com/Shopify/sarama"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type spanWriterMetrics struct {
diff --git a/plugin/storage/memory/factory.go b/plugin/storage/memory/factory.go
index a3f4f165..aa0282cb 100644
--- a/plugin/storage/memory/factory.go
+++ b/plugin/storage/memory/factory.go
@@ -19,10 +19,10 @@ import (
 	"flag"
 
 	"github.com/spf13/viper"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/storage/factory.go b/storage/factory.go
index dacdafce..50c99dc3 100644
--- a/storage/factory.go
+++ b/storage/factory.go
@@ -18,10 +18,10 @@ package storage
 import (
 	"errors"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	metricsstore "github.com/jaegertracing/jaeger/storage/metricsstore"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/storage/metricsstore/metrics/decorator.go b/storage/metricsstore/metrics/decorator.go
index 0bb3f3b8..3a2cca97 100644
--- a/storage/metricsstore/metrics/decorator.go
+++ b/storage/metricsstore/metrics/decorator.go
@@ -18,8 +18,7 @@ import (
 	"context"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
-
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	protometrics "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics"
 	"github.com/jaegertracing/jaeger/storage/metricsstore"
 )
diff --git a/storage/metricsstore/mocks/Reader.go b/storage/metricsstore/mocks/Reader.go
index 62faa95d..0814af84 100644
--- a/storage/metricsstore/mocks/Reader.go
+++ b/storage/metricsstore/mocks/Reader.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/storage/mocks/Factory.go b/storage/mocks/Factory.go
index 901f7546..8f2c713e 100644
--- a/storage/mocks/Factory.go
+++ b/storage/mocks/Factory.go
@@ -16,9 +16,9 @@ package mocks
 
 import (
 	mock "github.com/stretchr/testify/mock"
-	metrics "github.com/uber/jaeger-lib/metrics"
 	zap "go.uber.org/zap"
 
+	metrics "github.com/jaegertracing/jaeger/pkg/metrics"
 	storage "github.com/jaegertracing/jaeger/storage"
 	dependencystore "github.com/jaegertracing/jaeger/storage/dependencystore"
 	spanstore "github.com/jaegertracing/jaeger/storage/spanstore"
diff --git a/storage/spanstore/downsampling_writer.go b/storage/spanstore/downsampling_writer.go
index c00a5abc..dd354e4d 100644
--- a/storage/spanstore/downsampling_writer.go
+++ b/storage/spanstore/downsampling_writer.go
@@ -22,9 +22,8 @@ import (
 	"math/big"
 	"sync"
 
-	"github.com/uber/jaeger-lib/metrics"
-
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 const defaultHashSalt = "downsampling-default-salt"
diff --git a/storage/spanstore/metrics/decorator.go b/storage/spanstore/metrics/decorator.go
index 87a258d7..492c37bb 100644
--- a/storage/spanstore/metrics/decorator.go
+++ b/storage/spanstore/metrics/decorator.go
@@ -19,9 +19,8 @@ import (
 	"context"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
-
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
 
diff --git a/storage/spanstore/metrics/write_metrics.go b/storage/spanstore/metrics/write_metrics.go
index abf9ffa9..de56ed30 100644
--- a/storage/spanstore/metrics/write_metrics.go
+++ b/storage/spanstore/metrics/write_metrics.go
@@ -18,7 +18,7 @@ package metrics
 import (
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // WriteMetrics is a collection of metrics for write operations.
diff --git a/storage/spanstore/mocks/Reader.go b/storage/spanstore/mocks/Reader.go
index 98a5cf13..5c6f43ef 100644
--- a/storage/spanstore/mocks/Reader.go
+++ b/storage/spanstore/mocks/Reader.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (
diff --git a/storage/spanstore/mocks/Writer.go b/storage/spanstore/mocks/Writer.go
index ef9b2ba9..dda543f8 100644
--- a/storage/spanstore/mocks/Writer.go
+++ b/storage/spanstore/mocks/Writer.go
@@ -14,7 +14,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-
 package mocks
 
 import (



Test patch:
diff --git a/cmd/agent/app/agent_test.go b/cmd/agent/app/agent_test.go
index ee2ca6b2..9f1b709e 100644
--- a/cmd/agent/app/agent_test.go
+++ b/cmd/agent/app/agent_test.go
@@ -26,10 +26,10 @@ import (
 	"github.com/prometheus/client_golang/prometheus"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/fork"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	jmetrics "github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 )
diff --git a/cmd/agent/app/builder_test.go b/cmd/agent/app/builder_test.go
index 66179043..e02577ba 100644
--- a/cmd/agent/app/builder_test.go
+++ b/cmd/agent/app/builder_test.go
@@ -28,15 +28,15 @@ import (
 	"github.com/spf13/viper"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/fork"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 	yaml "gopkg.in/yaml.v2"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/configmanager"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/reporter/grpc"
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/thrift-gen/baggage"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
diff --git a/cmd/agent/app/configmanager/metrics_test.go b/cmd/agent/app/configmanager/metrics_test.go
index 2f179c22..df069166 100644
--- a/cmd/agent/app/configmanager/metrics_test.go
+++ b/cmd/agent/app/configmanager/metrics_test.go
@@ -22,8 +22,8 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/thrift-gen/baggage"
 	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
 )
diff --git a/cmd/agent/app/processors/thrift_processor_test.go b/cmd/agent/app/processors/thrift_processor_test.go
index e12ed2ee..37a030b7 100644
--- a/cmd/agent/app/processors/thrift_processor_test.go
+++ b/cmd/agent/app/processors/thrift_processor_test.go
@@ -24,8 +24,6 @@ import (
 	"github.com/apache/thrift/lib/go/thrift"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/credentials/insecure"
@@ -35,6 +33,8 @@ import (
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/testutils"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/thrift-gen/agent"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
diff --git a/cmd/agent/app/reporter/client_metrics_test.go b/cmd/agent/app/reporter/client_metrics_test.go
index 83a7ed03..e943aa33 100644
--- a/cmd/agent/app/reporter/client_metrics_test.go
+++ b/cmd/agent/app/reporter/client_metrics_test.go
@@ -22,11 +22,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zaptest/observer"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/testutils"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
 )
diff --git a/cmd/agent/app/reporter/connect_metrics_test.go b/cmd/agent/app/reporter/connect_metrics_test.go
index d5ff2007..524752c8 100644
--- a/cmd/agent/app/reporter/connect_metrics_test.go
+++ b/cmd/agent/app/reporter/connect_metrics_test.go
@@ -20,7 +20,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 )
 
 func TestConnectMetrics(t *testing.T) {
diff --git a/cmd/agent/app/reporter/grpc/builder_test.go b/cmd/agent/app/reporter/grpc/builder_test.go
index 4df5c395..0f792171 100644
--- a/cmd/agent/app/reporter/grpc/builder_test.go
+++ b/cmd/agent/app/reporter/grpc/builder_test.go
@@ -22,16 +22,16 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/connectivity"
 	"google.golang.org/grpc/credentials"
 	yaml "gopkg.in/yaml.v2"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/discovery"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/proto-gen/api_v2"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 )
diff --git a/cmd/agent/app/reporter/grpc/collector_proxy_test.go b/cmd/agent/app/reporter/grpc/collector_proxy_test.go
index 2d7ce678..b44a941b 100644
--- a/cmd/agent/app/reporter/grpc/collector_proxy_test.go
+++ b/cmd/agent/app/reporter/grpc/collector_proxy_test.go
@@ -23,10 +23,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 	"google.golang.org/grpc"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/proto-gen/api_v2"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 )
diff --git a/cmd/agent/app/reporter/metrics_test.go b/cmd/agent/app/reporter/metrics_test.go
index d1281fd2..59e5d890 100644
--- a/cmd/agent/app/reporter/metrics_test.go
+++ b/cmd/agent/app/reporter/metrics_test.go
@@ -21,8 +21,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
 )
diff --git a/cmd/agent/app/servers/tbuffered_server_test.go b/cmd/agent/app/servers/tbuffered_server_test.go
index e1d5459e..bf3df2d1 100644
--- a/cmd/agent/app/servers/tbuffered_server_test.go
+++ b/cmd/agent/app/servers/tbuffered_server_test.go
@@ -25,12 +25,12 @@ import (
 	"github.com/apache/thrift/lib/go/thrift"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/atomic"
 
 	"github.com/jaegertracing/jaeger/cmd/agent/app/customtransport"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp"
 	"github.com/jaegertracing/jaeger/cmd/agent/app/testutils"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/thrift-gen/agent"
 	"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
 )
diff --git a/cmd/collector/app/collector_test.go b/cmd/collector/app/collector_test.go
index 039e0fe1..06dc2fe7 100644
--- a/cmd/collector/app/collector_test.go
+++ b/cmd/collector/app/collector_test.go
@@ -22,12 +22,12 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/fork"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
 	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
diff --git a/cmd/collector/app/metrics_test.go b/cmd/collector/app/metrics_test.go
index 786d233c..41852f4d 100644
--- a/cmd/collector/app/metrics_test.go
+++ b/cmd/collector/app/metrics_test.go
@@ -20,11 +20,11 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	jaegerM "github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
+	jaegerM "github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestProcessorMetrics(t *testing.T) {
diff --git a/cmd/collector/app/options_test.go b/cmd/collector/app/options_test.go
index 6a92344b..1d4ba298 100644
--- a/cmd/collector/app/options_test.go
+++ b/cmd/collector/app/options_test.go
@@ -19,12 +19,12 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestAllOptionSet(t *testing.T) {
diff --git a/cmd/collector/app/server/http_test.go b/cmd/collector/app/server/http_test.go
index 49d49c48..5e9b571d 100644
--- a/cmd/collector/app/server/http_test.go
+++ b/cmd/collector/app/server/http_test.go
@@ -25,10 +25,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
 	"github.com/jaegertracing/jaeger/ports"
diff --git a/cmd/collector/app/server/zipkin_test.go b/cmd/collector/app/server/zipkin_test.go
index 7eb58c1e..73289360 100644
--- a/cmd/collector/app/server/zipkin_test.go
+++ b/cmd/collector/app/server/zipkin_test.go
@@ -25,10 +25,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
 	"github.com/jaegertracing/jaeger/ports"
diff --git a/cmd/collector/app/span_handler_builder_test.go b/cmd/collector/app/span_handler_builder_test.go
index 0130165a..ec02e0e4 100644
--- a/cmd/collector/app/span_handler_builder_test.go
+++ b/cmd/collector/app/span_handler_builder_test.go
@@ -20,12 +20,12 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/flags"
 	cmdFlags "github.com/jaegertracing/jaeger/cmd/flags"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/memory"
 )
 
diff --git a/cmd/collector/app/span_processor_test.go b/cmd/collector/app/span_processor_test.go
index 874760a4..228b9868 100644
--- a/cmd/collector/app/span_processor_test.go
+++ b/cmd/collector/app/span_processor_test.go
@@ -25,15 +25,15 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/atomic"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/handler"
 	"github.com/jaegertracing/jaeger/cmd/collector/app/processor"
 	zipkinSanitizer "github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer/zipkin"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/storage"
 	"github.com/jaegertracing/jaeger/thrift-gen/jaeger"
diff --git a/cmd/flags/service_test.go b/cmd/flags/service_test.go
index 7c7601f4..df495918 100644
--- a/cmd/flags/service_test.go
+++ b/cmd/flags/service_test.go
@@ -22,10 +22,12 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
+	jlibmetrics "github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/atomic"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
 	"github.com/jaegertracing/jaeger/pkg/healthcheck"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestAddFlags(t *testing.T) {
@@ -112,3 +114,15 @@ func waitForEqual(t *testing.T, expected interface{}, getter func() interface{})
 	}
 	assert.Equal(t, expected, getter())
 }
+
+func TestNullMetricsFactory(t *testing.T) {
+	v, cmd := config.Viperize(metrics.AddFlags)
+	err := cmd.ParseFlags([]string{
+		"--metrics-backend=none",
+	})
+	require.NoError(t, err)
+
+	s := NewService(0)
+	s.Start(v)
+	assert.IsType(t, jlibmetrics.NullFactory, s.JLibMetricsFactory)
+}
diff --git a/cmd/ingester/app/consumer/consumer_test.go b/cmd/ingester/app/consumer/consumer_test.go
index 4454e7de..731218b4 100644
--- a/cmd/ingester/app/consumer/consumer_test.go
+++ b/cmd/ingester/app/consumer/consumer_test.go
@@ -27,14 +27,14 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	kmocks "github.com/jaegertracing/jaeger/cmd/ingester/app/consumer/mocks"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
 	pmocks "github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/kafka/consumer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 //go:generate mockery -dir ../../../../pkg/kafka/config/ -name Consumer
diff --git a/cmd/ingester/app/consumer/deadlock_detector_test.go b/cmd/ingester/app/consumer/deadlock_detector_test.go
index 482c29d0..6cef1c00 100644
--- a/cmd/ingester/app/consumer/deadlock_detector_test.go
+++ b/cmd/ingester/app/consumer/deadlock_detector_test.go
@@ -21,8 +21,9 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 )
 
 func TestClosingSignalEmitted(t *testing.T) {
diff --git a/cmd/ingester/app/consumer/offset/manager_test.go b/cmd/ingester/app/consumer/offset/manager_test.go
index c29c8fd5..58a0a202 100644
--- a/cmd/ingester/app/consumer/offset/manager_test.go
+++ b/cmd/ingester/app/consumer/offset/manager_test.go
@@ -20,8 +20,9 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestHandleReset(t *testing.T) {
diff --git a/cmd/ingester/app/consumer/processor_factory_test.go b/cmd/ingester/app/consumer/processor_factory_test.go
index 9cbd0ecf..c2b47f9e 100644
--- a/cmd/ingester/app/consumer/processor_factory_test.go
+++ b/cmd/ingester/app/consumer/processor_factory_test.go
@@ -20,11 +20,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	kmocks "github.com/jaegertracing/jaeger/cmd/ingester/app/consumer/mocks"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func Test_NewFactory(t *testing.T) {
diff --git a/cmd/ingester/app/processor/decorator/retry_test.go b/cmd/ingester/app/processor/decorator/retry_test.go
index f59a0c8b..d2127b76 100644
--- a/cmd/ingester/app/processor/decorator/retry_test.go
+++ b/cmd/ingester/app/processor/decorator/retry_test.go
@@ -20,10 +20,10 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 type fakeMsg struct{}
diff --git a/cmd/ingester/app/processor/metrics_decorator_test.go b/cmd/ingester/app/processor/metrics_decorator_test.go
index d68d7941..70426967 100644
--- a/cmd/ingester/app/processor/metrics_decorator_test.go
+++ b/cmd/ingester/app/processor/metrics_decorator_test.go
@@ -19,10 +19,10 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/processor/mocks"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 )
 
 type fakeMsg struct{}
diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go
index 21b9851d..79e66253 100644
--- a/cmd/query/app/querysvc/query_service_test.go
+++ b/cmd/query/app/querysvc/query_service_test.go
@@ -22,11 +22,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/model/adjuster"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks"
diff --git a/internal/metrics/fork/fork_test.go b/internal/metrics/fork/fork_test.go
new file mode 100644
index 00000000..e1eb244b
--- /dev/null
+++ b/internal/metrics/fork/fork_test.go
@@ -0,0 +1,101 @@
+// Copyright (c) 2020 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 fork
+
+import (
+	"testing"
+	"time"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
+)
+
+var _ metrics.Factory = (*Factory)(nil)
+
+func TestForkFactory(t *testing.T) {
+	forkNamespace := "internal"
+	forkFactory := metricstest.NewFactory(time.Second)
+	defaultFactory := metricstest.NewFactory(time.Second)
+
+	// Create factory that will delegate namespaced metrics to forkFactory
+	// and add some metrics
+	ff := New(forkNamespace, forkFactory, defaultFactory)
+	ff.Gauge(metrics.Options{
+		Name: "somegauge",
+	}).Update(42)
+	ff.Counter(metrics.Options{
+		Name: "somecounter",
+	}).Inc(2)
+
+	// Check that metrics are presented in defaultFactory backend
+	defaultFactory.AssertCounterMetrics(t, metricstest.ExpectedMetric{
+		Name:  "somecounter",
+		Value: 2,
+	})
+	defaultFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
+		Name:  "somegauge",
+		Value: 42,
+	})
+
+	// Get default namespaced factory
+	defaultNamespacedFactory := ff.Namespace(metrics.NSOptions{
+		Name: "default",
+	})
+
+	// Add some metrics
+	defaultNamespacedFactory.Counter(metrics.Options{
+		Name: "somenamespacedcounter",
+	}).Inc(111)
+	defaultNamespacedFactory.Gauge(metrics.Options{
+		Name: "somenamespacedgauge",
+	}).Update(222)
+	defaultNamespacedFactory.Histogram(metrics.HistogramOptions{
+		Name: "somenamespacedhist",
+	}).Record(1)
+	defaultNamespacedFactory.Timer(metrics.TimerOptions{
+		Name: "somenamespacedtimer",
+	}).Record(time.Millisecond)
+
+	// Check values in default namespaced factory backend
+	defaultFactory.AssertCounterMetrics(t, metricstest.ExpectedMetric{
+		Name:  "default.somenamespacedcounter",
+		Value: 111,
+	})
+	defaultFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
+		Name:  "default.somenamespacedgauge",
+		Value: 222,
+	})
+
+	// Get factory with forkNamespace and add some metrics
+	internalFactory := ff.Namespace(metrics.NSOptions{
+		Name: forkNamespace,
+	})
+	internalFactory.Gauge(metrics.Options{
+		Name: "someinternalgauge",
+	}).Update(20)
+	internalFactory.Counter(metrics.Options{
+		Name: "someinternalcounter",
+	}).Inc(50)
+
+	// Check that metrics are presented in forkFactory backend
+	forkFactory.AssertGaugeMetrics(t, metricstest.ExpectedMetric{
+		Name:  "internal.someinternalgauge",
+		Value: 20,
+	})
+	forkFactory.AssertCounterMetrics(t, metricstest.ExpectedMetric{
+		Name:  "internal.someinternalcounter",
+		Value: 50,
+	})
+}
diff --git a/internal/metricstest/keys.go b/internal/metricstest/keys.go
new file mode 100644
index 00000000..7b7a2dfb
--- /dev/null
+++ b/internal/metricstest/keys.go
@@ -0,0 +1,36 @@
+// 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 metricstest
+
+import (
+	"sort"
+)
+
+// GetKey converts name+tags into a single string of the form
+// "name|tag1=value1|...|tagN=valueN", where tag names are
+// sorted alphabetically.
+func GetKey(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
+}
diff --git a/internal/metricstest/local.go b/internal/metricstest/local.go
new file mode 100644
index 00000000..4978a6d4
--- /dev/null
+++ b/internal/metricstest/local.go
@@ -0,0 +1,394 @@
+// 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 metricstest
+
+import (
+	"sync"
+	"sync/atomic"
+	"time"
+
+	"github.com/HdrHistogram/hdrhistogram-go"
+
+	"github.com/jaegertracing/jaeger/pkg/metrics"
+)
+
+// This is intentionally very similar to github.com/codahale/metrics, the
+// main difference being that counters/gauges are scoped to the provider
+// rather than being global (to facilitate testing).
+
+// A Backend is a metrics provider which aggregates data in-vm, and
+// allows exporting snapshots to shove the data into a remote collector
+type Backend struct {
+	cm         sync.Mutex
+	gm         sync.Mutex
+	tm         sync.Mutex
+	hm         sync.Mutex
+	counters   map[string]*int64
+	gauges     map[string]*int64
+	timers     map[string]*localBackendTimer
+	histograms map[string]*localBackendHistogram
+	stop       chan struct{}
+	wg         sync.WaitGroup
+	TagsSep    string
+	TagKVSep   string
+}
+
+// NewBackend returns a new Backend. The collectionInterval is the histogram
+// time window for each timer.
+func NewBackend(collectionInterval time.Duration) *Backend {
+	b := &Backend{
+		counters:   make(map[string]*int64),
+		gauges:     make(map[string]*int64),
+		timers:     make(map[string]*localBackendTimer),
+		histograms: make(map[string]*localBackendHistogram),
+		stop:       make(chan struct{}),
+		TagsSep:    "|",
+		TagKVSep:   "=",
+	}
+	if collectionInterval == 0 {
+		// Use one histogram time window for all timers
+		return b
+	}
+	b.wg.Add(1)
+	go b.runLoop(collectionInterval)
+	return b
+}
+
+// Clear discards accumulated stats
+func (b *Backend) Clear() {
+	b.cm.Lock()
+	defer b.cm.Unlock()
+	b.gm.Lock()
+	defer b.gm.Unlock()
+	b.tm.Lock()
+	defer b.tm.Unlock()
+	b.hm.Lock()
+	defer b.hm.Unlock()
+	b.counters = make(map[string]*int64)
+	b.gauges = make(map[string]*int64)
+	b.timers = make(map[string]*localBackendTimer)
+	b.histograms = make(map[string]*localBackendHistogram)
+}
+
+func (b *Backend) runLoop(collectionInterval time.Duration) {
+	defer b.wg.Done()
+	ticker := time.NewTicker(collectionInterval)
+	for {
+		select {
+		case <-ticker.C:
+			b.tm.Lock()
+			timers := make(map[string]*localBackendTimer, len(b.timers))
+			for timerName, timer := range b.timers {
+				timers[timerName] = timer
+			}
+			b.tm.Unlock()
+
+			for _, t := range timers {
+				t.Lock()
+				t.hist.Rotate()
+				t.Unlock()
+			}
+		case <-b.stop:
+			ticker.Stop()
+			return
+		}
+	}
+}
+
+// IncCounter increments a counter value
+func (b *Backend) IncCounter(name string, tags map[string]string, delta int64) {
+	name = GetKey(name, tags, b.TagsSep, b.TagKVSep)
+	b.cm.Lock()
+	defer b.cm.Unlock()
+	counter := b.counters[name]
+	if counter == nil {
+		b.counters[name] = new(int64)
+		*b.counters[name] = delta
+		return
+	}
+	atomic.AddInt64(counter, delta)
+}
+
+// UpdateGauge updates the value of a gauge
+func (b *Backend) UpdateGauge(name string, tags map[string]string, value int64) {
+	name = GetKey(name, tags, b.TagsSep, b.TagKVSep)
+	b.gm.Lock()
+	defer b.gm.Unlock()
+	gauge := b.gauges[name]
+	if gauge == nil {
+		b.gauges[name] = new(int64)
+		*b.gauges[name] = value
+		return
+	}
+	atomic.StoreInt64(gauge, value)
+}
+
+// RecordHistogram records a timing duration
+func (b *Backend) RecordHistogram(name string, tags map[string]string, v float64) {
+	name = GetKey(name, tags, b.TagsSep, b.TagKVSep)
+	histogram := b.findOrCreateHistogram(name)
+	histogram.Lock()
+	histogram.hist.Current.RecordValue(int64(v))
+	histogram.Unlock()
+}
+
+func (b *Backend) findOrCreateHistogram(name string) *localBackendHistogram {
+	b.hm.Lock()
+	defer b.hm.Unlock()
+	if t, ok := b.histograms[name]; ok {
+		return t
+	}
+
+	t := &localBackendHistogram{
+		hist: hdrhistogram.NewWindowed(5, 0, int64((5*time.Minute)/time.Millisecond), 1),
+	}
+	b.histograms[name] = t
+	return t
+}
+
+type localBackendHistogram struct {
+	sync.Mutex
+	hist *hdrhistogram.WindowedHistogram
+}
+
+// RecordTimer records a timing duration
+func (b *Backend) RecordTimer(name string, tags map[string]string, d time.Duration) {
+	name = GetKey(name, tags, b.TagsSep, b.TagKVSep)
+	timer := b.findOrCreateTimer(name)
+	timer.Lock()
+	timer.hist.Current.RecordValue(int64(d / time.Millisecond))
+	timer.Unlock()
+}
+
+func (b *Backend) findOrCreateTimer(name string) *localBackendTimer {
+	b.tm.Lock()
+	defer b.tm.Unlock()
+	if t, ok := b.timers[name]; ok {
+		return t
+	}
+
+	t := &localBackendTimer{
+		hist: hdrhistogram.NewWindowed(5, 0, int64((5*time.Minute)/time.Millisecond), 1),
+	}
+	b.timers[name] = t
+	return t
+}
+
+type localBackendTimer struct {
+	sync.Mutex
+	hist *hdrhistogram.WindowedHistogram
+}
+
+var percentiles = map[string]float64{
+	"P50":  50,
+	"P75":  75,
+	"P90":  90,
+	"P95":  95,
+	"P99":  99,
+	"P999": 99.9,
+}
+
+// Snapshot captures a snapshot of the current counter and gauge values
+func (b *Backend) Snapshot() (counters, gauges map[string]int64) {
+	b.cm.Lock()
+	defer b.cm.Unlock()
+
+	counters = make(map[string]int64, len(b.counters))
+	for name, value := range b.counters {
+		counters[name] = atomic.LoadInt64(value)
+	}
+
+	b.gm.Lock()
+	defer b.gm.Unlock()
+
+	gauges = make(map[string]int64, len(b.gauges))
+	for name, value := range b.gauges {
+		gauges[name] = atomic.LoadInt64(value)
+	}
+
+	b.tm.Lock()
+	timers := make(map[string]*localBackendTimer)
+	for timerName, timer := range b.timers {
+		timers[timerName] = timer
+	}
+	b.tm.Unlock()
+
+	for timerName, timer := range timers {
+		timer.Lock()
+		hist := timer.hist.Merge()
+		timer.Unlock()
+		for name, q := range percentiles {
+			gauges[timerName+"."+name] = hist.ValueAtQuantile(q)
+		}
+	}
+
+	b.hm.Lock()
+	histograms := make(map[string]*localBackendHistogram)
+	for histogramName, histogram := range b.histograms {
+		histograms[histogramName] = histogram
+	}
+	b.hm.Unlock()
+
+	for histogramName, histogram := range histograms {
+		histogram.Lock()
+		hist := histogram.hist.Merge()
+		histogram.Unlock()
+		for name, q := range percentiles {
+			gauges[histogramName+"."+name] = hist.ValueAtQuantile(q)
+		}
+	}
+
+	return
+}
+
+// Stop cleanly closes the background goroutine spawned by NewBackend.
+func (b *Backend) Stop() {
+	close(b.stop)
+	b.wg.Wait()
+}
+
+type stats struct {
+	name            string
+	tags            map[string]string
+	buckets         []float64
+	durationBuckets []time.Duration
+	localBackend    *Backend
+}
+
+type localTimer struct {
+	stats
+}
+
+func (l *localTimer) Record(d time.Duration) {
+	l.localBackend.RecordTimer(l.name, l.tags, d)
+}
+
+type localHistogram struct {
+	stats
+}
+
+func (l *localHistogram) Record(v float64) {
+	l.localBackend.RecordHistogram(l.name, l.tags, v)
+}
+
+type localCounter struct {
+	stats
+}
+
+func (l *localCounter) Inc(delta int64) {
+	l.localBackend.IncCounter(l.name, l.tags, delta)
+}
+
+type localGauge struct {
+	stats
+}
+
+func (l *localGauge) Update(value int64) {
+	l.localBackend.UpdateGauge(l.name, l.tags, value)
+}
+
+// Factory stats factory that creates metrics that are stored locally
+type Factory struct {
+	*Backend
+	namespace string
+	tags      map[string]string
+}
+
+// NewFactory returns a new LocalMetricsFactory
+func NewFactory(collectionInterval time.Duration) *Factory {
+	return &Factory{
+		Backend: NewBackend(collectionInterval),
+	}
+}
+
+// appendTags adds the tags to the namespace tags and returns a combined map.
+func (l *Factory) appendTags(tags map[string]string) map[string]string {
+	newTags := make(map[string]string)
+	for k, v := range l.tags {
+		newTags[k] = v
+	}
+	for k, v := range tags {
+		newTags[k] = v
+	}
+	return newTags
+}
+
+func (l *Factory) newNamespace(name string) string {
+	if l.namespace == "" {
+		return name
+	}
+
+	if name == "" {
+		return l.namespace
+	}
+
+	return l.namespace + "." + name
+}
+
+// Counter returns a local stats counter
+func (l *Factory) Counter(options metrics.Options) metrics.Counter {
+	return &localCounter{
+		stats{
+			name:         l.newNamespace(options.Name),
+			tags:         l.appendTags(options.Tags),
+			localBackend: l.Backend,
+		},
+	}
+}
+
+// Timer returns a local stats timer.
+func (l *Factory) Timer(options metrics.TimerOptions) metrics.Timer {
+	return &localTimer{
+		stats{
+			name:            l.newNamespace(options.Name),
+			tags:            l.appendTags(options.Tags),
+			durationBuckets: options.Buckets,
+			localBackend:    l.Backend,
+		},
+	}
+}
+
+// Gauge returns a local stats gauge.
+func (l *Factory) Gauge(options metrics.Options) metrics.Gauge {
+	return &localGauge{
+		stats{
+			name:         l.newNamespace(options.Name),
+			tags:         l.appendTags(options.Tags),
+			localBackend: l.Backend,
+		},
+	}
+}
+
+// Histogram returns a local stats histogram.
+func (l *Factory) Histogram(options metrics.HistogramOptions) metrics.Histogram {
+	return &localHistogram{
+		stats{
+			name:         l.newNamespace(options.Name),
+			tags:         l.appendTags(options.Tags),
+			buckets:      options.Buckets,
+			localBackend: l.Backend,
+		},
+	}
+}
+
+// Namespace returns a new namespace.
+func (l *Factory) Namespace(scope metrics.NSOptions) metrics.Factory {
+	return &Factory{
+		namespace: l.newNamespace(scope.Name),
+		tags:      l.appendTags(scope.Tags),
+		Backend:   l.Backend,
+	}
+}
diff --git a/internal/metricstest/local_test.go b/internal/metricstest/local_test.go
new file mode 100644
index 00000000..a99721dc
--- /dev/null
+++ b/internal/metricstest/local_test.go
@@ -0,0 +1,175 @@
+// 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 metricstest
+
+import (
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
+	"github.com/jaegertracing/jaeger/pkg/metrics"
+)
+
+func TestLocalMetrics(t *testing.T) {
+	tags := map[string]string{
+		"x": "y",
+	}
+
+	f := NewFactory(0)
+	defer f.Stop()
+	f.Counter(metrics.Options{
+		Name: "my-counter",
+		Tags: tags,
+	}).Inc(4)
+	f.Counter(metrics.Options{
+		Name: "my-counter",
+		Tags: tags,
+	}).Inc(6)
+	f.Counter(metrics.Options{
+		Name: "my-counter",
+	}).Inc(6)
+	f.Counter(metrics.Options{
+		Name: "other-counter",
+	}).Inc(8)
+	f.Gauge(metrics.Options{
+		Name: "my-gauge",
+	}).Update(25)
+	f.Gauge(metrics.Options{
+		Name: "my-gauge",
+	}).Update(43)
+	f.Gauge(metrics.Options{
+		Name: "other-gauge",
+	}).Update(74)
+	f.Namespace(metrics.NSOptions{
+		Name: "namespace",
+		Tags: tags,
+	}).Counter(metrics.Options{
+		Name: "my-counter",
+	}).Inc(7)
+	f.Namespace(metrics.NSOptions{
+		Name: "ns.subns",
+	}).Counter(metrics.Options{
+		Tags: map[string]string{"service": "a-service"},
+	}).Inc(9)
+
+	timings := map[string][]time.Duration{
+		"foo-latency": {
+			time.Second * 35,
+			time.Second * 6,
+			time.Millisecond * 576,
+			time.Second * 12,
+		},
+		"bar-latency": {
+			time.Minute*4 + time.Second*34,
+			time.Minute*7 + time.Second*12,
+			time.Second * 625,
+			time.Second * 12,
+		},
+	}
+
+	for metric, timing := range timings {
+		for _, d := range timing {
+			f.Timer(metrics.TimerOptions{
+				Name: metric,
+			}).Record(d)
+		}
+	}
+
+	histogram := f.Histogram(metrics.HistogramOptions{
+		Name: "my-histo",
+	})
+	histogram.Record(321)
+	histogram.Record(42)
+
+	c, g := f.Snapshot()
+	require.NotNil(t, c)
+	require.NotNil(t, g)
+
+	assert.Equal(t, map[string]int64{
+		"my-counter|x=y":             10,
+		"my-counter":                 6,
+		"other-counter":              8,
+		"namespace.my-counter|x=y":   7,
+		"ns.subns|service=a-service": 9,
+	}, c)
+
+	assert.Equal(t, map[string]int64{
+		"bar-latency.P50":  278527,
+		"bar-latency.P75":  278527,
+		"bar-latency.P90":  442367,
+		"bar-latency.P95":  442367,
+		"bar-latency.P99":  442367,
+		"bar-latency.P999": 442367,
+		"foo-latency.P50":  6143,
+		"foo-latency.P75":  12287,
+		"foo-latency.P90":  36863,
+		"foo-latency.P95":  36863,
+		"foo-latency.P99":  36863,
+		"foo-latency.P999": 36863,
+		"my-gauge":         43,
+		"my-histo.P50":     43,
+		"my-histo.P75":     335,
+		"my-histo.P90":     335,
+		"my-histo.P95":     335,
+		"my-histo.P99":     335,
+		"my-histo.P999":    335,
+		"other-gauge":      74,
+	}, g)
+
+	f.Clear()
+	c, g = f.Snapshot()
+	require.Empty(t, c)
+	require.Empty(t, g)
+}
+
+func TestLocalMetricsInterval(t *testing.T) {
+	refreshInterval := time.Millisecond
+	const relativeCheckFrequency = 5 // check 5 times per refreshInterval
+	const maxChecks = 2 * relativeCheckFrequency
+	checkInterval := (refreshInterval * relativeCheckFrequency) / maxChecks
+
+	f := NewFactory(refreshInterval)
+	defer f.Stop()
+
+	f.Timer(metrics.TimerOptions{
+		Name: "timer",
+	}).Record(1)
+
+	f.tm.Lock()
+	timer := f.timers["timer"]
+	f.tm.Unlock()
+	assert.NotNil(t, timer)
+
+	// timer.hist.Current is modified on every Rotate(), which is called by Backend after every refreshInterval
+	getCurr := func() interface{} {
+		timer.Lock()
+		defer timer.Unlock()
+		return timer.hist.Current
+	}
+
+	curr := getCurr()
+
+	// wait for twice as long as the refresh interval
+	for i := 0; i < maxChecks; i++ {
+		time.Sleep(checkInterval)
+
+		if getCurr() != curr {
+			return
+		}
+	}
+	t.Fail()
+}
diff --git a/internal/metricstest/metricstest.go b/internal/metricstest/metricstest.go
new file mode 100644
index 00000000..954dd44b
--- /dev/null
+++ b/internal/metricstest/metricstest.go
@@ -0,0 +1,54 @@
+// 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 metricstest
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+// ExpectedMetric contains metrics under test.
+type ExpectedMetric struct {
+	Name  string
+	Tags  map[string]string
+	Value int
+}
+
+// TODO do something similar for Timers
+
+// AssertCounterMetrics checks if counter metrics exist.
+func (f *Factory) AssertCounterMetrics(t *testing.T, expectedMetrics ...ExpectedMetric) {
+	counters, _ := f.Snapshot()
+	assertMetrics(t, counters, expectedMetrics...)
+}
+
+// AssertGaugeMetrics checks if gauge metrics exist.
+func (f *Factory) AssertGaugeMetrics(t *testing.T, expectedMetrics ...ExpectedMetric) {
+	_, gauges := f.Snapshot()
+	assertMetrics(t, gauges, expectedMetrics...)
+}
+
+func assertMetrics(t *testing.T, actualMetrics map[string]int64, expectedMetrics ...ExpectedMetric) {
+	for _, expected := range expectedMetrics {
+		key := GetKey(expected.Name, expected.Tags, "|", "=")
+		assert.EqualValues(t,
+			expected.Value,
+			actualMetrics[key],
+			"expected metric name: %s, tags: %+v", expected.Name, expected.Tags,
+		)
+	}
+}
diff --git a/internal/metricstest/metricstest_test.go b/internal/metricstest/metricstest_test.go
new file mode 100644
index 00000000..c2654a5e
--- /dev/null
+++ b/internal/metricstest/metricstest_test.go
@@ -0,0 +1,29 @@
+// 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 metricstest
+
+import (
+	"testing"
+)
+
+func TestAssertMetrics(t *testing.T) {
+	f := NewFactory(0)
+	tags := map[string]string{"key": "value"}
+	f.IncCounter("counter", tags, 1)
+	f.UpdateGauge("gauge", tags, 11)
+
+	f.AssertCounterMetrics(t, ExpectedMetric{Name: "counter", Tags: tags, Value: 1})
+	f.AssertGaugeMetrics(t, ExpectedMetric{Name: "gauge", Tags: tags, Value: 11})
+}
diff --git a/pkg/cassandra/metrics/table_test.go b/pkg/cassandra/metrics/table_test.go
index 70a82fb3..a41a92d6 100644
--- a/pkg/cassandra/metrics/table_test.go
+++ b/pkg/cassandra/metrics/table_test.go
@@ -21,8 +21,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 )
 
diff --git a/pkg/clientcfg/clientcfghttp/handler_test.go b/pkg/clientcfg/clientcfghttp/handler_test.go
index 4eb60701..a12aadd8 100644
--- a/pkg/clientcfg/clientcfghttp/handler_test.go
+++ b/pkg/clientcfg/clientcfghttp/handler_test.go
@@ -27,8 +27,8 @@ import (
 	"github.com/gorilla/mux"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	tSampling092 "github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp/thrift-0.9.2"
 	"github.com/jaegertracing/jaeger/thrift-gen/baggage"
 	"github.com/jaegertracing/jaeger/thrift-gen/sampling"
diff --git a/pkg/httpmetrics/metrics_test.go b/pkg/httpmetrics/metrics_test.go
index 544c9550..d0971246 100644
--- a/pkg/httpmetrics/metrics_test.go
+++ b/pkg/httpmetrics/metrics_test.go
@@ -21,7 +21,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 )
 
 func TestNewMetricsHandler(t *testing.T) {
diff --git a/pkg/metrics/builder_test.go b/pkg/metrics/builder_test.go
index 4e507ca6..df4c1ed0 100644
--- a/pkg/metrics/builder_test.go
+++ b/pkg/metrics/builder_test.go
@@ -114,7 +114,7 @@ func TestBuilder(t *testing.T) {
 			continue
 		}
 		require.NotNil(t, mf)
-		mf.Counter(metrics.Options{Name: "counter", Tags: nil}).Inc(1)
+		mf.Counter(Options{Name: "counter", Tags: nil}).Inc(1)
 		if testCase.assert != nil {
 			testCase.assert()
 		}
@@ -123,3 +123,13 @@ func TestBuilder(t *testing.T) {
 		}
 	}
 }
+
+func TestJLibAdapter(t *testing.T) {
+	f := NewJLibAdapter(metrics.NullFactory)
+	f.Counter(Options{})
+	f.Timer(TimerOptions{})
+	f.Gauge(Options{})
+	f.Histogram(HistogramOptions{})
+	f.Namespace(NSOptions{})
+	f.Unwrap()
+}
diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go
new file mode 100644
index 00000000..3a29bcaa
--- /dev/null
+++ b/pkg/metrics/metrics_test.go
@@ -0,0 +1,144 @@
+// 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.
+
+// Must use separate test package to break import cycle.
+package metrics_test
+
+import (
+	"testing"
+	"time"
+
+	"github.com/stretchr/testify/assert"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
+)
+
+func TestInitMetrics(t *testing.T) {
+	testMetrics := struct {
+		Gauge     metrics.Gauge     `metric:"gauge" tags:"1=one,2=two"`
+		Counter   metrics.Counter   `metric:"counter"`
+		Timer     metrics.Timer     `metric:"timer"`
+		Histogram metrics.Histogram `metric:"histogram" buckets:"20,40,60,80"`
+	}{}
+
+	f := metricstest.NewFactory(0)
+	defer f.Stop()
+
+	globalTags := map[string]string{"key": "value"}
+
+	err := metrics.Init(&testMetrics, f, globalTags)
+	assert.NoError(t, err)
+
+	testMetrics.Gauge.Update(10)
+	testMetrics.Counter.Inc(5)
+	testMetrics.Timer.Record(time.Duration(time.Second * 35))
+	testMetrics.Histogram.Record(42)
+
+	// wait for metrics
+	for i := 0; i < 1000; i++ {
+		c, _ := f.Snapshot()
+		if _, ok := c["counter"]; ok {
+			break
+		}
+		time.Sleep(1 * time.Millisecond)
+	}
+
+	c, g := f.Snapshot()
+
+	assert.EqualValues(t, 5, c["counter|key=value"])
+	assert.EqualValues(t, 10, g["gauge|1=one|2=two|key=value"])
+	assert.EqualValues(t, 36863, g["timer|key=value.P50"])
+	assert.EqualValues(t, 43, g["histogram|key=value.P50"])
+
+	stopwatch := metrics.StartStopwatch(testMetrics.Timer)
+	stopwatch.Stop()
+	assert.True(t, 0 < stopwatch.ElapsedTime())
+}
+
+var (
+	noMetricTag = struct {
+		NoMetricTag metrics.Counter
+	}{}
+
+	badTags = struct {
+		BadTags metrics.Counter `metric:"counter" tags:"1=one,noValue"`
+	}{}
+
+	invalidMetricType = struct {
+		InvalidMetricType int64 `metric:"counter"`
+	}{}
+
+	badHistogramBucket = struct {
+		BadHistogramBucket metrics.Histogram `metric:"histogram" buckets:"1,2,a,4"`
+	}{}
+
+	badTimerBucket = struct {
+		BadTimerBucket metrics.Timer `metric:"timer" buckets:"1"`
+	}{}
+
+	invalidBuckets = struct {
+		InvalidBuckets metrics.Counter `metric:"counter" buckets:"1"`
+	}{}
+)
+
+func TestInitMetricsFailures(t *testing.T) {
+	assert.EqualError(t, metrics.Init(&noMetricTag, nil, nil), "Field NoMetricTag is missing a tag 'metric'")
+
+	assert.EqualError(t, metrics.Init(&badTags, nil, nil),
+		"Field [BadTags]: Tag [noValue] is not of the form key=value in 'tags' string [1=one,noValue]")
+
+	assert.EqualError(t, metrics.Init(&invalidMetricType, nil, nil),
+		"Field InvalidMetricType is not a pointer to timer, gauge, or counter")
+
+	assert.EqualError(t, metrics.Init(&badHistogramBucket, nil, nil),
+		"Field [BadHistogramBucket]: Bucket [a] could not be converted to float64 in 'buckets' string [1,2,a,4]")
+
+	assert.EqualError(t, metrics.Init(&badTimerBucket, nil, nil),
+		"Field [BadTimerBucket]: Buckets are not currently initialized for timer metrics")
+
+	assert.EqualError(t, metrics.Init(&invalidBuckets, nil, nil),
+		"Field [InvalidBuckets]: Buckets should only be defined for Timer and Histogram metric types")
+}
+
+func TestInitPanic(t *testing.T) {
+	defer func() {
+		if r := recover(); r == nil {
+			t.Error("The code did not panic")
+		}
+	}()
+
+	metrics.MustInit(&noMetricTag, metrics.NullFactory, nil)
+}
+
+func TestNullMetrics(t *testing.T) {
+	// This test is just for cover
+	metrics.NullFactory.Timer(metrics.TimerOptions{
+		Name: "name",
+	}).Record(0)
+	metrics.NullFactory.Counter(metrics.Options{
+		Name: "name",
+	}).Inc(0)
+	metrics.NullFactory.Gauge(metrics.Options{
+		Name: "name",
+	}).Update(0)
+	metrics.NullFactory.Histogram(metrics.HistogramOptions{
+		Name: "name",
+	}).Record(0)
+	metrics.NullFactory.Namespace(metrics.NSOptions{
+		Name: "name",
+	}).Gauge(metrics.Options{
+		Name: "name2",
+	}).Update(0)
+}
diff --git a/pkg/queue/bounded_queue_test.go b/pkg/queue/bounded_queue_test.go
index 759ecc64..b852f166 100644
--- a/pkg/queue/bounded_queue_test.go
+++ b/pkg/queue/bounded_queue_test.go
@@ -25,9 +25,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	uatomic "go.uber.org/atomic"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // In this test we run a queue with capacity 1 and a single consumer.
diff --git a/plugin/sampling/strategystore/adaptive/aggregator_test.go b/plugin/sampling/strategystore/adaptive/aggregator_test.go
index cc7fe017..c2abee7e 100644
--- a/plugin/sampling/strategystore/adaptive/aggregator_test.go
+++ b/plugin/sampling/strategystore/adaptive/aggregator_test.go
@@ -20,8 +20,8 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/storage/samplingstore/mocks"
 )
 
diff --git a/plugin/sampling/strategystore/adaptive/factory_test.go b/plugin/sampling/strategystore/adaptive/factory_test.go
index 2f96aeb0..ff81118d 100644
--- a/plugin/sampling/strategystore/adaptive/factory_test.go
+++ b/plugin/sampling/strategystore/adaptive/factory_test.go
@@ -21,7 +21,6 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
@@ -29,6 +28,7 @@ import (
 	"github.com/jaegertracing/jaeger/pkg/config"
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
 	lmocks "github.com/jaegertracing/jaeger/pkg/distributedlock/mocks"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
 	smocks "github.com/jaegertracing/jaeger/storage/samplingstore/mocks"
diff --git a/plugin/sampling/strategystore/adaptive/processor_test.go b/plugin/sampling/strategystore/adaptive/processor_test.go
index 063627c6..eab2880b 100644
--- a/plugin/sampling/strategystore/adaptive/processor_test.go
+++ b/plugin/sampling/strategystore/adaptive/processor_test.go
@@ -23,11 +23,11 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/sampling/calculationstrategy"
 	epmocks "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection/mocks"
diff --git a/plugin/sampling/strategystore/factory_test.go b/plugin/sampling/strategystore/factory_test.go
index 874f5474..1bf2886f 100644
--- a/plugin/sampling/strategystore/factory_test.go
+++ b/plugin/sampling/strategystore/factory_test.go
@@ -24,11 +24,11 @@ import (
 	"github.com/spf13/viper"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
 	"github.com/jaegertracing/jaeger/pkg/distributedlock"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 	"github.com/jaegertracing/jaeger/storage"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/plugin/sampling/strategystore/static/factory_test.go b/plugin/sampling/strategystore/static/factory_test.go
index 1585d759..9a7be64a 100644
--- a/plugin/sampling/strategystore/static/factory_test.go
+++ b/plugin/sampling/strategystore/static/factory_test.go
@@ -18,11 +18,11 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	ss "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/strategystore"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin"
 )
 
diff --git a/plugin/storage/badger/dependencystore/storage_test.go b/plugin/storage/badger/dependencystore/storage_test.go
index 5042e6c4..b966b99b 100644
--- a/plugin/storage/badger/dependencystore/storage_test.go
+++ b/plugin/storage/badger/dependencystore/storage_test.go
@@ -22,11 +22,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/badger"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
diff --git a/plugin/storage/badger/factory_test.go b/plugin/storage/badger/factory_test.go
index 503919ef..9a78c0bb 100644
--- a/plugin/storage/badger/factory_test.go
+++ b/plugin/storage/badger/factory_test.go
@@ -23,11 +23,11 @@ import (
 	"time"
 
 	assert "github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestInitializationErrors(t *testing.T) {
diff --git a/plugin/storage/badger/spanstore/read_write_test.go b/plugin/storage/badger/spanstore/read_write_test.go
index 51800ae8..064419dd 100644
--- a/plugin/storage/badger/spanstore/read_write_test.go
+++ b/plugin/storage/badger/spanstore/read_write_test.go
@@ -27,11 +27,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/plugin/storage/badger"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/plugin/storage/badger/stats_linux_test.go b/plugin/storage/badger/stats_linux_test.go
index 9b27cb7f..09c49c70 100644
--- a/plugin/storage/badger/stats_linux_test.go
+++ b/plugin/storage/badger/stats_linux_test.go
@@ -18,9 +18,9 @@ import (
 	"testing"
 
 	assert "github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config"
 )
 
diff --git a/plugin/storage/badger/stats_test.go b/plugin/storage/badger/stats_test.go
index 680efd90..7a3a803b 100644
--- a/plugin/storage/badger/stats_test.go
+++ b/plugin/storage/badger/stats_test.go
@@ -21,10 +21,10 @@ import (
 	"testing"
 
 	assert "github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 func TestDiskStatisticsUpdate(t *testing.T) {
diff --git a/plugin/storage/cassandra/dependencystore/storage_test.go b/plugin/storage/cassandra/dependencystore/storage_test.go
index 93f5e0d3..305a1276 100644
--- a/plugin/storage/cassandra/dependencystore/storage_test.go
+++ b/plugin/storage/cassandra/dependencystore/storage_test.go
@@ -24,13 +24,13 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 )
diff --git a/plugin/storage/cassandra/factory_test.go b/plugin/storage/cassandra/factory_test.go
index dbe9111c..9108ed35 100644
--- a/plugin/storage/cassandra/factory_test.go
+++ b/plugin/storage/cassandra/factory_test.go
@@ -21,12 +21,12 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/storage"
 )
diff --git a/plugin/storage/cassandra/samplingstore/storage_test.go b/plugin/storage/cassandra/samplingstore/storage_test.go
index 54073daf..c6a21bb0 100644
--- a/plugin/storage/cassandra/samplingstore/storage_test.go
+++ b/plugin/storage/cassandra/samplingstore/storage_test.go
@@ -23,10 +23,10 @@ import (
 	"github.com/gocql/gocql"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/model"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/storage/samplingstore"
diff --git a/plugin/storage/cassandra/savetracetest/main.go b/plugin/storage/cassandra/savetracetest/main.go
index 0cdfab8e..8b28858b 100644
--- a/plugin/storage/cassandra/savetracetest/main.go
+++ b/plugin/storage/cassandra/savetracetest/main.go
@@ -19,11 +19,11 @@ import (
 	"context"
 	"time"
 
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	cascfg "github.com/jaegertracing/jaeger/pkg/cassandra/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	cSpanStore "github.com/jaegertracing/jaeger/plugin/storage/cassandra/spanstore"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 )
diff --git a/plugin/storage/cassandra/spanstore/operation_names_test.go b/plugin/storage/cassandra/spanstore/operation_names_test.go
index 8a3cfa5b..134d5015 100644
--- a/plugin/storage/cassandra/spanstore/operation_names_test.go
+++ b/plugin/storage/cassandra/spanstore/operation_names_test.go
@@ -23,9 +23,9 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/cassandra/spanstore/dbmodel"
diff --git a/plugin/storage/cassandra/spanstore/reader_test.go b/plugin/storage/cassandra/spanstore/reader_test.go
index 5372de6c..83e509f3 100644
--- a/plugin/storage/cassandra/spanstore/reader_test.go
+++ b/plugin/storage/cassandra/spanstore/reader_test.go
@@ -25,9 +25,9 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
diff --git a/plugin/storage/cassandra/spanstore/service_names_test.go b/plugin/storage/cassandra/spanstore/service_names_test.go
index 7345ea8e..442f6e11 100644
--- a/plugin/storage/cassandra/spanstore/service_names_test.go
+++ b/plugin/storage/cassandra/spanstore/service_names_test.go
@@ -23,9 +23,9 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 )
diff --git a/plugin/storage/cassandra/spanstore/writer_test.go b/plugin/storage/cassandra/spanstore/writer_test.go
index 8365daf4..8c901529 100644
--- a/plugin/storage/cassandra/spanstore/writer_test.go
+++ b/plugin/storage/cassandra/spanstore/writer_test.go
@@ -25,10 +25,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/atomic"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/cassandra/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
diff --git a/plugin/storage/es/factory_test.go b/plugin/storage/es/factory_test.go
index 57e696da..23087ef4 100644
--- a/plugin/storage/es/factory_test.go
+++ b/plugin/storage/es/factory_test.go
@@ -23,13 +23,13 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
 	"github.com/jaegertracing/jaeger/pkg/es"
 	escfg "github.com/jaegertracing/jaeger/pkg/es/config"
 	"github.com/jaegertracing/jaeger/pkg/es/mocks"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 )
 
diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go
index 7ae94baf..f5366b7a 100644
--- a/plugin/storage/es/spanstore/reader_test.go
+++ b/plugin/storage/es/spanstore/reader_test.go
@@ -29,9 +29,9 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/es/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
diff --git a/plugin/storage/es/spanstore/writer_test.go b/plugin/storage/es/spanstore/writer_test.go
index a0d972c4..69f1dea8 100644
--- a/plugin/storage/es/spanstore/writer_test.go
+++ b/plugin/storage/es/spanstore/writer_test.go
@@ -25,9 +25,9 @@ import (
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/es/mocks"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
diff --git a/plugin/storage/factory_test.go b/plugin/storage/factory_test.go
index e6556f96..66e6c086 100644
--- a/plugin/storage/factory_test.go
+++ b/plugin/storage/factory_test.go
@@ -28,12 +28,12 @@ import (
 	"github.com/spf13/viper"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/fork"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
 	depStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks"
diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go
index 2379f71b..d157fac1 100644
--- a/plugin/storage/grpc/factory_test.go
+++ b/plugin/storage/grpc/factory_test.go
@@ -21,10 +21,10 @@ import (
 	"github.com/spf13/viper"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	grpcConfig "github.com/jaegertracing/jaeger/plugin/storage/grpc/config"
 	"github.com/jaegertracing/jaeger/plugin/storage/grpc/mocks"
 	"github.com/jaegertracing/jaeger/plugin/storage/grpc/shared"
diff --git a/plugin/storage/integration/badgerstore_test.go b/plugin/storage/integration/badgerstore_test.go
index 3aeb2b05..2f37f9bf 100644
--- a/plugin/storage/integration/badgerstore_test.go
+++ b/plugin/storage/integration/badgerstore_test.go
@@ -20,9 +20,9 @@ import (
 	"testing"
 
 	assert "github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/badger"
 )
diff --git a/plugin/storage/integration/cassandra_test.go b/plugin/storage/integration/cassandra_test.go
index 76949d03..dd7c3e98 100644
--- a/plugin/storage/integration/cassandra_test.go
+++ b/plugin/storage/integration/cassandra_test.go
@@ -25,11 +25,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/cassandra"
 	"github.com/jaegertracing/jaeger/storage/dependencystore"
diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go
index 30ae0520..0258a18c 100644
--- a/plugin/storage/integration/elasticsearch_test.go
+++ b/plugin/storage/integration/elasticsearch_test.go
@@ -28,12 +28,12 @@ import (
 	"github.com/olivere/elastic"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/model"
 	estemplate "github.com/jaegertracing/jaeger/pkg/es"
 	eswrapper "github.com/jaegertracing/jaeger/pkg/es/wrapper"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/es/dependencystore"
 	"github.com/jaegertracing/jaeger/plugin/storage/es/mappings"
diff --git a/plugin/storage/integration/grpc_test.go b/plugin/storage/integration/grpc_test.go
index 53e5f821..5b650456 100644
--- a/plugin/storage/integration/grpc_test.go
+++ b/plugin/storage/integration/grpc_test.go
@@ -26,11 +26,11 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	googleGRPC "google.golang.org/grpc"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/grpc"
 	grpcMemory "github.com/jaegertracing/jaeger/plugin/storage/grpc/memory"
diff --git a/plugin/storage/integration/kafka_test.go b/plugin/storage/integration/kafka_test.go
index f515c7df..29f87a89 100644
--- a/plugin/storage/integration/kafka_test.go
+++ b/plugin/storage/integration/kafka_test.go
@@ -22,13 +22,13 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 
 	"github.com/jaegertracing/jaeger/cmd/ingester/app"
 	"github.com/jaegertracing/jaeger/cmd/ingester/app/builder"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/pkg/testutils"
 	"github.com/jaegertracing/jaeger/plugin/storage/kafka"
 	"github.com/jaegertracing/jaeger/plugin/storage/memory"
diff --git a/plugin/storage/kafka/factory_test.go b/plugin/storage/kafka/factory_test.go
index 25cce84e..b51cd8a5 100644
--- a/plugin/storage/kafka/factory_test.go
+++ b/plugin/storage/kafka/factory_test.go
@@ -23,12 +23,12 @@ import (
 	"github.com/Shopify/sarama/mocks"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
-	"github.com/uber/jaeger-lib/metrics"
 	"go.uber.org/zap"
 	"go.uber.org/zap/zapcore"
 
 	"github.com/jaegertracing/jaeger/pkg/config"
 	kafkaConfig "github.com/jaegertracing/jaeger/pkg/kafka/producer"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 )
 
diff --git a/plugin/storage/kafka/writer_test.go b/plugin/storage/kafka/writer_test.go
index a9e2a120..3c65b9d5 100644
--- a/plugin/storage/kafka/writer_test.go
+++ b/plugin/storage/kafka/writer_test.go
@@ -24,9 +24,9 @@ import (
 	saramaMocks "github.com/Shopify/sarama/mocks"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/mock"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/pkg/kafka/mocks"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
diff --git a/plugin/storage/memory/factory_test.go b/plugin/storage/memory/factory_test.go
index 2a604e6a..20f598ab 100644
--- a/plugin/storage/memory/factory_test.go
+++ b/plugin/storage/memory/factory_test.go
@@ -20,12 +20,12 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics"
-	"github.com/uber/jaeger-lib/metrics/fork"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 	"go.uber.org/zap"
 
+	"github.com/jaegertracing/jaeger/internal/metrics/fork"
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/pkg/config"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 	"github.com/jaegertracing/jaeger/storage"
 )
 
diff --git a/storage/metricsstore/metrics/decorator_test.go b/storage/metricsstore/metrics/decorator_test.go
index 39a02530..9cb4faaf 100644
--- a/storage/metricsstore/metrics/decorator_test.go
+++ b/storage/metricsstore/metrics/decorator_test.go
@@ -21,8 +21,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	protometrics "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics"
 	"github.com/jaegertracing/jaeger/storage/metricsstore"
 	. "github.com/jaegertracing/jaeger/storage/metricsstore/metrics"
diff --git a/storage/spanstore/downsampling_writer_benchmark_test.go b/storage/spanstore/downsampling_writer_benchmark_test.go
index bfc66c54..8ca05efc 100644
--- a/storage/spanstore/downsampling_writer_benchmark_test.go
+++ b/storage/spanstore/downsampling_writer_benchmark_test.go
@@ -21,9 +21,8 @@ import (
 	"math/rand"
 	"testing"
 
-	"github.com/uber/jaeger-lib/metrics"
-
 	"github.com/jaegertracing/jaeger/model"
+	"github.com/jaegertracing/jaeger/pkg/metrics"
 )
 
 // Benchmark result:
diff --git a/storage/spanstore/metrics/decorator_test.go b/storage/spanstore/metrics/decorator_test.go
index a534510d..13f61d20 100644
--- a/storage/spanstore/metrics/decorator_test.go
+++ b/storage/spanstore/metrics/decorator_test.go
@@ -21,8 +21,8 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
 
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 	"github.com/jaegertracing/jaeger/model"
 	"github.com/jaegertracing/jaeger/storage/spanstore"
 	. "github.com/jaegertracing/jaeger/storage/spanstore/metrics"
diff --git a/storage/spanstore/metrics/write_metrics_test.go b/storage/spanstore/metrics/write_metrics_test.go
index 752253b8..1be8ce8e 100644
--- a/storage/spanstore/metrics/write_metrics_test.go
+++ b/storage/spanstore/metrics/write_metrics_test.go
@@ -21,7 +21,8 @@ import (
 	"time"
 
 	"github.com/stretchr/testify/assert"
-	"github.com/uber/jaeger-lib/metrics/metricstest"
+
+	"github.com/jaegertracing/jaeger/internal/metricstest"
 )
 
 func TestTableEmit(t *testing.T) {