diff --git a/cmd/balance-worker/wire.go b/cmd/balance-worker/wire.go index 3394eff7f..1209d1ecc 100644 --- a/cmd/balance-worker/wire.go +++ b/cmd/balance-worker/wire.go @@ -36,6 +36,7 @@ type Application struct { func initializeApplication(ctx context.Context, conf config.Configuration, logger *slog.Logger) (Application, func(), error) { wire.Build( + app.Config, NewOtelResource, app.Telemetry, NewMeter, @@ -52,7 +53,7 @@ func initializeApplication(ctx context.Context, conf config.Configuration, logge // TODO: is this necessary? Do we need a logger first? func initializeLogger(conf config.Configuration) *slog.Logger { - wire.Build(NewOtelResource, app.Logger) + wire.Build(app.Config, NewOtelResource, app.Logger) return new(slog.Logger) } diff --git a/cmd/notification-service/wire.go b/cmd/notification-service/wire.go index 3394eff7f..1209d1ecc 100644 --- a/cmd/notification-service/wire.go +++ b/cmd/notification-service/wire.go @@ -36,6 +36,7 @@ type Application struct { func initializeApplication(ctx context.Context, conf config.Configuration, logger *slog.Logger) (Application, func(), error) { wire.Build( + app.Config, NewOtelResource, app.Telemetry, NewMeter, @@ -52,7 +53,7 @@ func initializeApplication(ctx context.Context, conf config.Configuration, logge // TODO: is this necessary? Do we need a logger first? func initializeLogger(conf config.Configuration) *slog.Logger { - wire.Build(NewOtelResource, app.Logger) + wire.Build(app.Config, NewOtelResource, app.Logger) return new(slog.Logger) } diff --git a/cmd/server/wire.go b/cmd/server/wire.go index 911eb3a11..19ecf6aa9 100644 --- a/cmd/server/wire.go +++ b/cmd/server/wire.go @@ -48,6 +48,7 @@ type Application struct { func initializeApplication(ctx context.Context, conf config.Configuration, logger *slog.Logger) (Application, func(), error) { wire.Build( + app.Config, NewOtelResource, app.Telemetry, NewMeter, @@ -65,7 +66,7 @@ func initializeApplication(ctx context.Context, conf config.Configuration, logge // TODO: is this necessary? Do we need a logger first? func initializeLogger(conf config.Configuration) *slog.Logger { - wire.Build(NewOtelResource, app.Logger) + wire.Build(app.Config, NewOtelResource, app.Logger) return new(slog.Logger) } diff --git a/cmd/sink-worker/wire.go b/cmd/sink-worker/wire.go index 1ddabab37..7805f9c08 100644 --- a/cmd/sink-worker/wire.go +++ b/cmd/sink-worker/wire.go @@ -33,6 +33,7 @@ type Application struct { func initializeApplication(ctx context.Context, conf config.Configuration, logger *slog.Logger) (Application, func(), error) { wire.Build( + app.Config, NewOtelResource, app.Telemetry, NewMeter, @@ -44,8 +45,7 @@ func initializeApplication(ctx context.Context, conf config.Configuration, logge // TODO: is this necessary? Do we need a logger first? func initializeLogger(conf config.Configuration) *slog.Logger { - // wire.Build(NewOtelResource, app.Logger) - wire.Build(NewOtelResource, NewLogger) + wire.Build(app.Config, NewOtelResource, app.Logger) return new(slog.Logger) } diff --git a/cmd/sink-worker/wire_gen.go b/cmd/sink-worker/wire_gen.go index bf63545f7..569524a57 100644 --- a/cmd/sink-worker/wire_gen.go +++ b/cmd/sink-worker/wire_gen.go @@ -60,8 +60,10 @@ func initializeApplication(ctx context.Context, conf config.Configuration, logge // TODO: is this necessary? Do we need a logger first? func initializeLogger(conf config.Configuration) *slog.Logger { + telemetryConfig := conf.Telemetry + logTelemetryConfiguration := telemetryConfig.Log resource := NewOtelResource(conf) - logger := NewLogger(conf, resource) + logger := app.NewLogger(logTelemetryConfiguration, resource) return logger } diff --git a/openmeter/app/wire.go b/openmeter/app/wire.go index 99d26b50f..86a864d56 100644 --- a/openmeter/app/wire.go +++ b/openmeter/app/wire.go @@ -14,16 +14,30 @@ import ( "github.com/openmeterio/openmeter/openmeter/streaming/clickhouse_connector" ) -var ClickHouse = wire.NewSet( +var Config = wire.NewSet( wire.FieldsOf(new(config.Configuration), "Aggregation"), wire.FieldsOf(new(config.AggregationConfiguration), "ClickHouse"), + wire.FieldsOf(new(config.Configuration), "Postgres"), + + wire.FieldsOf(new(config.Configuration), "Telemetry"), + TelemetryConfig, + + wire.FieldsOf(new(config.Configuration), "Meters"), + wire.FieldsOf(new(config.Configuration), "Namespace"), +) + +var TelemetryConfig = wire.NewSet( + wire.FieldsOf(new(config.TelemetryConfig), "Metrics"), + wire.FieldsOf(new(config.TelemetryConfig), "Trace"), + wire.FieldsOf(new(config.TelemetryConfig), "Log"), +) + +var ClickHouse = wire.NewSet( NewClickHouse, ) var Database = wire.NewSet( - wire.FieldsOf(new(config.Configuration), "Postgres"), - NewPostgresDriver, NewDB, NewEntPostgresDriver, @@ -39,10 +53,6 @@ var Kafka = wire.NewSet( ) var Telemetry = wire.NewSet( - wire.FieldsOf(new(config.Configuration), "Telemetry"), - wire.FieldsOf(new(config.TelemetryConfig), "Metrics"), - wire.FieldsOf(new(config.TelemetryConfig), "Trace"), - NewMeterProvider, wire.Bind(new(metric.MeterProvider), new(*sdkmetric.MeterProvider)), NewTracerProvider, @@ -55,15 +65,10 @@ var Telemetry = wire.NewSet( ) var Logger = wire.NewSet( - wire.FieldsOf(new(config.Configuration), "Telemetry"), - wire.FieldsOf(new(config.TelemetryConfig), "Log"), - NewLogger, ) var OpenMeter = wire.NewSet( - wire.FieldsOf(new(config.Configuration), "Meters"), - NewMeterRepository, wire.Bind(new(meter.Repository), new(*meter.InMemoryRepository)), @@ -77,7 +82,6 @@ var OpenMeter = wire.NewSet( NewKafkaNamespaceHandler, NewIngestCollector, - wire.FieldsOf(new(config.Configuration), "Namespace"), NewNamespaceHandlers, NewNamespaceManager, )