Skip to content

Commit

Permalink
Use real metrics factory instead of NullFactory (jaegertracing#6261)
Browse files Browse the repository at this point in the history
## 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]>
  • Loading branch information
yurishkuro authored Nov 26, 2024
1 parent 2a07dfb commit 16e964d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion cmd/jaeger/internal/extension/remotesampling/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling"
"github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy"
"github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage"
"github.com/jaegertracing/jaeger/internal/metrics/otelmetrics"
"github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp"
"github.com/jaegertracing/jaeger/pkg/metrics"
"github.com/jaegertracing/jaeger/plugin/sampling/leaderelection"
Expand Down Expand Up @@ -223,11 +224,13 @@ func (ext *rsExtension) startAdaptiveStrategyProvider(host component.Host) error
}

func (ext *rsExtension) startHTTPServer(ctx context.Context, host component.Host) error {
mf := otelmetrics.NewFactory(ext.telemetry.MeterProvider)
mf = mf.Namespace(metrics.NSOptions{Name: "jaeger_remote_sampling"})
handler := clientcfghttp.NewHTTPHandler(clientcfghttp.HTTPHandlerParams{
ConfigManager: &clientcfghttp.ConfigManager{
SamplingProvider: ext.strategyProvider,
},
MetricsFactory: metrics.NullFactory,
MetricsFactory: mf,

// In v1 the sampling endpoint in the collector was at /api/sampling, because
// the collector reused the same port for multiple services. In v2, the extension
Expand Down
9 changes: 4 additions & 5 deletions plugin/sampling/strategyprovider/adaptive/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ type Factory struct {
// NewFactory creates a new Factory.
func NewFactory() *Factory {
return &Factory{
options: &Options{},
logger: zap.NewNop(),
metricsFactory: metrics.NullFactory,
lock: nil,
store: nil,
options: &Options{},
logger: zap.NewNop(),
lock: nil,
store: nil,
}
}

Expand Down

0 comments on commit 16e964d

Please sign in to comment.