Skip to content

Commit 3b61c3e

Browse files
committed
fix: address comment on checking configs
1 parent 55099f9 commit 3b61c3e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/otel/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func (p *OtelPlugin) HTTPTransportStreamChunkHook(ctx *schemas.BifrostContext, r
170170

171171
// ValidateConfig validates values of PluginConfig and set up defaults where needed.
172172
func ValidateConfig(config *Config) (*Config, error) {
173+
if config == nil {
174+
return nil, fmt.Errorf("config is required")
175+
}
173176
// Validating fields
174177
if config.ServiceName == "" {
175178
config.ServiceName = "bifrost"

plugins/otel/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func initOTELMeterProvider(ctx context.Context, serviceName string, config *Conf
7878
case ProtocolGRPC:
7979
exporter, exporterErr = initOTELGRPCExporter(ctx, config)
8080
default:
81-
exporterErr = errors.New(fmt.Sprintf("invalid protocol '%s'", string(config.MetricsProtocol)))
81+
exporterErr = fmt.Errorf("invalid protocol '%s'", string(config.MetricsProtocol))
8282
}
8383
if exporterErr != nil {
8484
return nil, errors.Wrap(exporterErr, "fail to init OTEL metrics exporter")

0 commit comments

Comments
 (0)