update the as per the comment
This commit is contained in:
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/beckn-one/beckn-onix/pkg/telemetry"
|
||||
)
|
||||
|
||||
// MetricsProvider encapsulates initialization of OpenTelemetry metrics
|
||||
// OtelSetupMetricsProvider encapsulates initialization of OpenTelemetry metrics
|
||||
// providers. Implementations wire exporters and return a Provider that the core
|
||||
// application can manage.
|
||||
type MetricsProvider interface {
|
||||
type OtelSetupMetricsProvider interface {
|
||||
// New initializes a new telemetry provider instance with the given configuration.
|
||||
New(ctx context.Context, config map[string]string) (*telemetry.Provider, func() error, error)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/beckn-one/beckn-onix/pkg/telemetry"
|
||||
)
|
||||
|
||||
// metricsProvider implements the MetricsProvider interface for the otelsetup plugin.
|
||||
// metricsProvider implements the OtelSetupMetricsProvider interface for the otelsetup plugin.
|
||||
type metricsProvider struct {
|
||||
impl otelsetup.Setup
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
// Setup wires the telemetry provider. This is the concrete implementation
|
||||
// behind the MetricsProvider interface.
|
||||
// behind the OtelSetupMetricsProvider interface.
|
||||
type Setup struct{}
|
||||
|
||||
// Config represents OpenTelemetry related configuration.
|
||||
@@ -151,7 +151,8 @@ func (Setup) New(ctx context.Context, cfg *Config) (*telemetry.Provider, error)
|
||||
}()
|
||||
|
||||
return &telemetry.Provider{
|
||||
MeterProvider: meterProvider,
|
||||
MeterProvider: meterProvider,
|
||||
MetricsHandler: metricsHandler,
|
||||
Shutdown: func(shutdownCtx context.Context) error {
|
||||
log.Infof(ctx, "Shutting down metrics server...")
|
||||
// Shutdown the metrics server
|
||||
|
||||
@@ -206,7 +206,7 @@ func (m *Manager) OtelSetup(ctx context.Context, cfg *Config) (*telemetry.Provid
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
otp, err := provider[definition.MetricsProvider](m.plugins, cfg.ID)
|
||||
otp, err := provider[definition.OtelSetupMetricsProvider](m.plugins, cfg.ID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load provider for %s: %w", cfg.ID, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user