Skip to content

Commit 16e964d

Browse files
authored
Use real metrics factory instead of NullFactory (#6261)
## Which problem is this PR solving? - Some components were still using `metrics.NullFactory` ## Description of the changes - Create real factory from OTEL MetricsProvider ## How was this change tested? - CI Signed-off-by: Yuri Shkuro <[email protected]>
1 parent 2a07dfb commit 16e964d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

cmd/jaeger/internal/extension/remotesampling/extension.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
2323
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
2424
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
25+
"github.com/jaegertracing/jaeger/internal/metrics/otelmetrics"
2526
"github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp"
2627
"github.com/jaegertracing/jaeger/pkg/metrics"
2728
"github.com/jaegertracing/jaeger/plugin/sampling/leaderelection"
@@ -223,11 +224,13 @@ func (ext *rsExtension) startAdaptiveStrategyProvider(host component.Host) error
223224
}
224225

225226
func (ext *rsExtension) startHTTPServer(ctx context.Context, host component.Host) error {
227+
mf := otelmetrics.NewFactory(ext.telemetry.MeterProvider)
228+
mf = mf.Namespace(metrics.NSOptions{Name: "jaeger_remote_sampling"})
226229
handler := clientcfghttp.NewHTTPHandler(clientcfghttp.HTTPHandlerParams{
227230
ConfigManager: &clientcfghttp.ConfigManager{
228231
SamplingProvider: ext.strategyProvider,
229232
},
230-
MetricsFactory: metrics.NullFactory,
233+
MetricsFactory: mf,
231234

232235
// In v1 the sampling endpoint in the collector was at /api/sampling, because
233236
// the collector reused the same port for multiple services. In v2, the extension

plugin/sampling/strategyprovider/adaptive/factory.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ type Factory struct {
3737
// NewFactory creates a new Factory.
3838
func NewFactory() *Factory {
3939
return &Factory{
40-
options: &Options{},
41-
logger: zap.NewNop(),
42-
metricsFactory: metrics.NullFactory,
43-
lock: nil,
44-
store: nil,
40+
options: &Options{},
41+
logger: zap.NewNop(),
42+
lock: nil,
43+
store: nil,
4544
}
4645
}
4746

0 commit comments

Comments
 (0)