Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added OTEL MeterProvider in Telemetery Settings #6144

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ func (s *server) Start(ctx context.Context, host component.Host) error {
ReportStatus: func(event *componentstatus.Event) {
componentstatus.ReportStatus(host, event)
},
Host: host,
Host: host,
LeveledMeterProvider: s.telset.LeveledMeterProvider,
}

s.server, err = queryApp.NewServer(
Expand Down
10 changes: 6 additions & 4 deletions cmd/query/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/config/configtls"
noopmetric "go.opentelemetry.io/otel/metric/noop"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
"go.uber.org/zap"
Expand Down Expand Up @@ -49,10 +50,11 @@ var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata"

func initTelSet(logger *zap.Logger, tracerProvider *jtracer.JTracer, hc *healthcheck.HealthCheck) telemetery.Setting {
return telemetery.Setting{
Logger: logger,
TracerProvider: tracerProvider.OTEL,
ReportStatus: telemetery.HCAdapter(hc),
Host: componenttest.NewNopHost(),
Logger: logger,
TracerProvider: tracerProvider.OTEL,
ReportStatus: telemetery.HCAdapter(hc),
Host: componenttest.NewNopHost(),
LeveledMeterProvider: noopmetric.NewMeterProvider(),
}
}

Expand Down
13 changes: 8 additions & 5 deletions pkg/telemetery/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package telemetery
import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"

Expand All @@ -14,11 +16,12 @@ import (
)

type Setting struct {
Logger *zap.Logger
TracerProvider trace.TracerProvider
Metrics metrics.Factory
ReportStatus func(*componentstatus.Event)
Host component.Host
Logger *zap.Logger
TracerProvider trace.TracerProvider
Metrics metrics.Factory
ReportStatus func(*componentstatus.Event)
Host component.Host
LeveledMeterProvider func(_ configtelemetry.Level) metric.MeterProvider
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we've got this field available to us - we also want to be able to use it. For example, in the query server we currently hardcode the meter provider but now we can pass it from telset.

Copy link
Author

@shinigami-777 shinigami-777 Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed it in the query server.

}

func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) {
Expand Down