openmeter / cmd /server /wire_gen.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 5)
b47934a verified
Raw
History Blame Contribute Delete
29.7 kB
// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"context"
kafka2 "github.com/confluentinc/confluent-kafka-go/v2/kafka"
"github.com/openmeterio/openmeter/app/common"
"github.com/openmeterio/openmeter/app/config"
"github.com/openmeterio/openmeter/openmeter/billing/creditgrant"
"github.com/openmeterio/openmeter/openmeter/cost"
"github.com/openmeterio/openmeter/openmeter/currencies"
"github.com/openmeterio/openmeter/openmeter/customer"
"github.com/openmeterio/openmeter/openmeter/ent/db"
"github.com/openmeterio/openmeter/openmeter/governance"
"github.com/openmeterio/openmeter/openmeter/ingest"
"github.com/openmeterio/openmeter/openmeter/ingest/kafkaingest"
"github.com/openmeterio/openmeter/openmeter/ledger"
"github.com/openmeterio/openmeter/openmeter/ledger/customerbalance"
"github.com/openmeterio/openmeter/openmeter/llmcost"
"github.com/openmeterio/openmeter/openmeter/meter"
"github.com/openmeterio/openmeter/openmeter/meterevent"
"github.com/openmeterio/openmeter/openmeter/namespace"
"github.com/openmeterio/openmeter/openmeter/notification"
"github.com/openmeterio/openmeter/openmeter/portal"
"github.com/openmeterio/openmeter/openmeter/productcatalog/addon"
"github.com/openmeterio/openmeter/openmeter/productcatalog/feature"
"github.com/openmeterio/openmeter/openmeter/productcatalog/featureresolver"
"github.com/openmeterio/openmeter/openmeter/productcatalog/plan"
"github.com/openmeterio/openmeter/openmeter/productcatalog/planaddon"
"github.com/openmeterio/openmeter/openmeter/progressmanager"
"github.com/openmeterio/openmeter/openmeter/registry"
"github.com/openmeterio/openmeter/openmeter/secret"
"github.com/openmeterio/openmeter/openmeter/server"
"github.com/openmeterio/openmeter/openmeter/streaming"
"github.com/openmeterio/openmeter/openmeter/subject"
"github.com/openmeterio/openmeter/openmeter/subject/service/hooks"
"github.com/openmeterio/openmeter/openmeter/taxcode"
"github.com/openmeterio/openmeter/openmeter/watermill/driver/kafka"
"github.com/openmeterio/openmeter/openmeter/watermill/eventbus"
"github.com/openmeterio/openmeter/pkg/featuregate"
"github.com/openmeterio/openmeter/pkg/ffx"
"github.com/openmeterio/openmeter/pkg/kafka/metrics"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
"log/slog"
)
// Injectors from wire.go:
func initializeApplication(ctx context.Context, conf config.Configuration) (Application, func(), error) {
telemetryConfig := conf.Telemetry
logTelemetryConfig := telemetryConfig.Log
commonMetadata := metadata(conf)
resource := common.NewTelemetryResource(commonMetadata)
loggerProvider, cleanup, err := common.NewLoggerProvider(ctx, logTelemetryConfig, resource)
if err != nil {
return Application{}, nil, err
}
v := common.TelemetryLoggerNoAdditionalMiddlewares()
logger := common.NewLogger(logTelemetryConfig, resource, loggerProvider, commonMetadata, v)
metricsTelemetryConfig := telemetryConfig.Metrics
meterProvider, cleanup2, err := common.NewMeterProvider(ctx, metricsTelemetryConfig, resource, logger)
if err != nil {
cleanup()
return Application{}, nil, err
}
traceTelemetryConfig := telemetryConfig.Trace
tracerProvider, cleanup3, err := common.NewTracerProvider(ctx, traceTelemetryConfig, resource, logger)
if err != nil {
cleanup2()
cleanup()
return Application{}, nil, err
}
textMapPropagator := common.NewDefaultTextMapPropagator()
globalInitializer := common.GlobalInitializer{
Logger: logger,
MeterProvider: meterProvider,
TracerProvider: tracerProvider,
TextMapPropagator: textMapPropagator,
}
postgresConfig := conf.Postgres
meter := common.NewMeter(meterProvider, commonMetadata)
driver, cleanup4, err := common.NewPostgresDriver(ctx, postgresConfig, meterProvider, meter, tracerProvider, logger)
if err != nil {
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
db := common.NewDB(driver)
entPostgresDriver, cleanup5 := common.NewEntPostgresDriver(db, logger)
client := common.NewEntClient(entPostgresDriver)
migrator := common.Migrator{
Config: postgresConfig,
Client: client,
Logger: logger,
}
adapter, err := common.NewMeterAdapter(logger, client)
if err != nil {
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
service := common.NewMeterService(adapter)
ingestConfiguration := conf.Ingest
kafkaIngestConfiguration := ingestConfiguration.Kafka
kafkaConfiguration := kafkaIngestConfiguration.KafkaConfiguration
brokerOptions := common.NewBrokerConfiguration(kafkaConfiguration, commonMetadata, logger, meter)
eventsConfiguration := conf.Events
v2 := common.ServerProvisionTopics(eventsConfiguration)
topicProvisionerConfig := kafkaIngestConfiguration.TopicProvisioner
topicProvisioner, err := common.NewKafkaTopicProvisioner(kafkaConfiguration, topicProvisionerConfig, logger, meter)
if err != nil {
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
publisherOptions := kafka.PublisherOptions{
Broker: brokerOptions,
ProvisionTopics: v2,
TopicProvisioner: topicProvisioner,
}
publisher, cleanup6, err := common.NewServerPublisher(ctx, publisherOptions, logger)
if err != nil {
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
eventbusPublisher, err := common.NewEventBusPublisher(publisher, eventsConfiguration, logger)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
featureConnector := common.NewFeatureConnector(logger, client, service, eventbusPublisher)
featureResolver, err := featureresolver.New(featureConnector)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
repository, err := common.NewTaxCodeAdapter(logger, client)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
taxcodeService, err := common.NewTaxCodeService(logger, repository)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
addonService, err := common.NewAddonService(logger, client, featureResolver, taxcodeService, eventbusPublisher)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appService, err := common.NewAppService(logger, client, eventbusPublisher)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appsConfiguration := conf.Apps
namespaceConfiguration := conf.Namespace
manager, err := common.NewNamespaceManager(namespaceConfiguration)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
billingAdapter, err := common.BillingAdapter(logger, client)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
unitConfigConfiguration := conf.UnitConfig
ratingService := common.NewBillingRatingService(unitConfigConfiguration)
customerService, err := common.NewCustomerService(logger, client, eventbusPublisher)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
aggregationConfiguration := conf.Aggregation
clickHouseAggregationConfiguration := aggregationConfiguration.ClickHouse
tracer := common.NewTracer(tracerProvider, commonMetadata)
v3, cleanup7, err := common.NewClickHouse(ctx, clickHouseAggregationConfiguration, tracer, meter, logger)
if err != nil {
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
progressManagerConfiguration := conf.ProgressManager
progressmanagerService, err := common.NewProgressManager(logger, progressManagerConfiguration)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
connector, err := common.NewStreamingConnector(ctx, aggregationConfiguration, v3, logger, progressmanagerService, manager)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
billingConfiguration := conf.Billing
entitlementsConfiguration := conf.Entitlements
locker, err := common.NewLocker(logger)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
entitlement, err := common.NewEntitlementRegistry(logger, client, tracer, entitlementsConfiguration, connector, service, eventbusPublisher, locker, customerService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
planService, err := common.NewPlanService(logger, client, featureResolver, taxcodeService, eventbusPublisher)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
planaddonService, err := common.NewPlanAddonService(logger, client, planService, addonService, eventbusPublisher)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
ffxService := ffx.NewContextService()
subscriptionServiceWithWorkflow, err := common.NewSubscriptionServices(logger, client, featureConnector, entitlement, customerService, planService, planaddonService, addonService, eventbusPublisher, locker, ffxService, taxcodeService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
billingFeatureSwitchesConfiguration := billingConfiguration.FeatureSwitches
creditsConfiguration := conf.Credits
repo := common.NewLedgerHistoricalRepo(client)
accountRepo := common.NewLedgerAccountRepo(client)
accountService := common.NewLedgerAccountService(creditsConfiguration, accountRepo, locker)
accountCatalog := common.NewLedgerAccountCatalog(accountService)
accountLocker := common.NewLedgerAccountLocker(accountService)
routingValidator := common.NewLedgerRoutingValidator()
ledgerReadWriter := common.NewLedgerHistoricalLedger(creditsConfiguration, repo, accountCatalog, accountLocker, routingValidator)
ledger := common.NewLedgerService(ledgerReadWriter)
balanceQuerier := common.NewLedgerBalanceQuerier(ledgerReadWriter)
customerAccountRepo := common.NewLedgerResolversRepo(client)
customerLedgerProvisioner := common.NewLedgerResolversService(creditsConfiguration, accountService, customerAccountRepo, locker)
accountResolver := common.NewLedgerAccountResolver(customerLedgerProvisioner)
breakageService, err := common.NewLedgerBreakageService(creditsConfiguration, client, balanceQuerier, accountResolver, accountService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
gate := featuregate.NewNoop()
featureGateConfiguration := conf.FeatureGate
featureGateChecker := common.NewFeatureGateChecker(gate, featureGateConfiguration, creditsConfiguration)
billingRegistry, err := common.NewBillingRegistry(logger, appService, billingAdapter, ratingService, customerService, featureConnector, service, meter, connector, eventbusPublisher, billingConfiguration, subscriptionServiceWithWorkflow, client, billingFeatureSwitchesConfiguration, creditsConfiguration, tracer, taxcodeService, locker, ledger, balanceQuerier, accountResolver, accountService, breakageService, featureGateChecker)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
factory, err := common.NewAppSandboxFactory(appsConfiguration, appService, billingRegistry)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appSandboxProvisioner, err := common.NewAppSandboxProvisioner(ctx, logger, appsConfiguration, appService, manager, billingRegistry, factory)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
secretserviceService, err := common.NewUnsafeSecretService(logger, client)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appstripeService, err := common.NewAppStripeService(logger, client, appsConfiguration, appService, customerService, secretserviceService, billingRegistry, eventbusPublisher)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appcustominvoicingService, err := common.NewAppCustomInvoicingService(logger, client, appsConfiguration, appService, customerService, secretserviceService, billingRegistry, eventbusPublisher)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
appRegistry := common.NewAppRegistry(appService, appSandboxProvisioner, appstripeService, appcustominvoicingService)
customerLedgerHook, err := common.NewCustomerLedgerServiceHook(creditsConfiguration, tracer, customerLedgerProvisioner, customerService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
customerConfiguration := conf.Customer
subjectAdapter, err := common.NewSubjectAdapter(client)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
subjectService, err := common.NewSubjectService(subjectAdapter)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
customerOverrideService := common.NewBillingCustomerOverrideService(billingRegistry)
customerSubjectHook, err := common.NewCustomerSubjectServiceHook(customerConfiguration, logger, tracer, subjectService, customerService, customerOverrideService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
customerEntitlementValidatorHook, err := common.NewCustomerEntitlementValidatorServiceHook(logger, entitlement, customerService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
currenciesRepository, err := common.NewCurrencyAdapter(client)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
currenciesService, err := common.NewCurrencyService(currenciesRepository)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
llmcostService, err := common.NewLLMCostService(logger, client)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
costService, err := common.NewCostService(featureConnector, service, connector, llmcostService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
creditvoidService, err := common.NewCreditVoidService(creditsConfiguration, client, ledger, balanceQuerier, accountResolver, accountService, breakageService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
creditgrantService, err := common.NewCreditGrantService(client, billingRegistry, customerService, creditvoidService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
customerbalanceService, err := common.NewCustomerBalanceService(creditsConfiguration, ledger, balanceQuerier, accountResolver, accountService, billingRegistry, breakageService, creditvoidService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
facade, err := common.NewCustomerBalanceFacade(customerbalanceService)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
governanceService, err := common.NewGovernanceService(customerService, entitlement, tracer, meter)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
dedupeConfiguration := conf.Dedupe
producer, err := common.NewKafkaProducer(kafkaIngestConfiguration, logger, commonMetadata)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
namespacedTopicResolver, err := common.NewNamespacedTopicResolver(kafkaIngestConfiguration)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
collector, err := common.NewKafkaIngestCollector(kafkaIngestConfiguration, producer, namespacedTopicResolver, topicProvisioner, logger, tracer)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
ingestCollector, cleanup8, err := common.NewIngestCollector(dedupeConfiguration, collector, logger, meter, tracer)
if err != nil {
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
ingestService, err := common.NewIngestService(ingestCollector, logger)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
metrics, err := common.NewKafkaMetrics(meter)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
namespaceHandler, err := common.NewKafkaIngestNamespaceHandler(namespacedTopicResolver, topicProvisioner, kafkaIngestConfiguration)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
handler := common.NewLedgerNamespaceHandler(accountResolver)
v4 := conf.Meters
v5 := conf.ReservedEventTypes
v6, err := common.NewReservedEventTypePatterns(v5)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
manageService := common.NewMeterManageService(adapter, manager, eventbusPublisher, v6)
v7 := common.NewMeterConfigInitializer(logger, v4, manageService, manager)
metereventService := common.NewMeterEventService(connector, customerService, service)
notificationRepository, err := common.NewNotificationAdapter(logger, client)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
notificationConfiguration := conf.Notification
webhookConfiguration := notificationConfiguration.Webhook
v8 := conf.Svix
svix, err := common.NewSvixAPIClient(v8, meterProvider, tracerProvider)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
webhookHandler, err := common.NewNotificationWebhookHandler(logger, tracer, webhookConfiguration, svix)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
notificationService, err := common.NewNotificationService(logger, notificationRepository, webhookHandler, featureConnector)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
eventHandler, err := common.NewNotificationEventHandler(notificationConfiguration, logger, tracer, notificationRepository, webhookHandler, driver)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
portalConfiguration := conf.Portal
portalService, err := common.NewPortalService(portalConfiguration)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
telemetryMiddlewareHook := common.NewTelemetryRouterHook(meterProvider, tracerProvider)
routerHooks := common.NewRouterHooks(telemetryMiddlewareHook)
productCatalogConfiguration := conf.ProductCatalog
subscriptionConfiguration := productCatalogConfiguration.Subscription
namespaceDecoder := common.NewStaticNamespaceDecoder(namespaceConfiguration)
ffxConfigContextMiddleware := common.NewFFXConfigContextMiddleware(subscriptionConfiguration, namespaceDecoder, logger)
postAuthMiddlewares := common.NewPostAuthMiddlewares(ffxConfigContextMiddleware)
v9, err := common.NewSubjectCustomerHook(subjectService, customerService, logger, tracer)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
taxCodeConfiguration := conf.TaxCode
taxcodeNamespaceHandler, err := common.NewTaxCodeNamespaceHandler(logger, taxcodeService, repository, taxCodeConfiguration)
if err != nil {
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
health := common.NewHealthChecker(logger)
telemetryHandler := common.NewTelemetryHandler(metricsTelemetryConfig, health, logger)
v10, cleanup9 := common.NewTelemetryServer(telemetryConfig, telemetryHandler)
terminationConfig := conf.Termination
terminationChecker, err := common.NewTerminationChecker(terminationConfig, health)
if err != nil {
cleanup9()
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
runtimeMetricsCollector, err := common.NewRuntimeMetricsCollector(meterProvider, logger)
if err != nil {
cleanup9()
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
serverConfig := conf.Server
clientIPMiddlewareConfig := serverConfig.ClientIPMiddleware
clientIPMiddleware, err := common.NewClientIPMiddleware(clientIPMiddlewareConfig)
if err != nil {
cleanup9()
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
return Application{}, nil, err
}
application := Application{
GlobalInitializer: globalInitializer,
Migrator: migrator,
Addon: addonService,
AppRegistry: appRegistry,
Customer: customerService,
CustomerLedgerHook: customerLedgerHook,
CustomerSubjectHook: customerSubjectHook,
CustomerEntitlementValidatorHook: customerEntitlementValidatorHook,
BillingRegistry: billingRegistry,
CurrencyService: currenciesService,
CostService: costService,
CreditGrantService: creditgrantService,
Ledger: ledger,
AccountResolver: accountResolver,
CustomerBalanceFacade: facade,
EntClient: client,
EventPublisher: eventbusPublisher,
EntitlementRegistry: entitlement,
FeatureConnector: featureConnector,
FeatureFlags: ffxService,
GovernanceService: governanceService,
IngestCollector: ingestCollector,
IngestService: ingestService,
KafkaProducer: producer,
KafkaMetrics: metrics,
KafkaIngestNamespaceHandler: namespaceHandler,
LedgerNamespaceHandler: handler,
LLMCostService: llmcostService,
Logger: logger,
MetricMeter: meter,
MeterConfigInitializer: v7,
MeterManageService: manageService,
MeterEventService: metereventService,
NamespaceManager: manager,
Notification: notificationService,
NotificationEventHandler: eventHandler,
Plan: planService,
PlanAddon: planaddonService,
Portal: portalService,
ProgressManager: progressmanagerService,
RouterHooks: routerHooks,
PostAuthMiddlewares: postAuthMiddlewares,
Secret: secretserviceService,
SubjectService: subjectService,
SubjectCustomerHook: v9,
Subscription: subscriptionServiceWithWorkflow,
StreamingConnector: connector,
TaxCodeNamespaceHandler: taxcodeNamespaceHandler,
TaxCodeService: taxcodeService,
TelemetryServer: v10,
TerminationChecker: terminationChecker,
RuntimeMetricsCollector: runtimeMetricsCollector,
Tracer: tracer,
FeatureGate: featureGateChecker,
ClientIPMiddleware: clientIPMiddleware,
}
return application, func() {
cleanup9()
cleanup8()
cleanup7()
cleanup6()
cleanup5()
cleanup4()
cleanup3()
cleanup2()
cleanup()
}, nil
}
// wire.go:
type Application struct {
common.GlobalInitializer
common.Migrator
Addon addon.Service
AppRegistry common.AppRegistry
Customer customer.Service
CustomerLedgerHook common.CustomerLedgerHook
CustomerSubjectHook common.CustomerSubjectHook
CustomerEntitlementValidatorHook common.CustomerEntitlementValidatorHook
BillingRegistry common.BillingRegistry
CurrencyService currencies.Service
CostService cost.Service
CreditGrantService creditgrant.Service
Ledger ledger.Ledger
AccountResolver ledger.AccountResolver
CustomerBalanceFacade *customerbalance.Facade
EntClient *db.Client
EventPublisher eventbus.Publisher
EntitlementRegistry *registry.Entitlement
FeatureConnector feature.FeatureConnector
FeatureFlags ffx.Service
GovernanceService governance.Service
IngestCollector ingest.Collector
IngestService ingest.Service
KafkaProducer *kafka2.Producer
KafkaMetrics *metrics.Metrics
KafkaIngestNamespaceHandler *kafkaingest.NamespaceHandler
LedgerNamespaceHandler namespace.Handler
LLMCostService llmcost.Service
Logger *slog.Logger
MetricMeter metric.Meter
MeterConfigInitializer common.MeterConfigInitializer
MeterManageService meter.ManageService
MeterEventService meterevent.Service
NamespaceManager *namespace.Manager
Notification notification.Service
NotificationEventHandler notification.EventHandler
Plan plan.Service
PlanAddon planaddon.Service
Portal portal.Service
ProgressManager progressmanager.Service
RouterHooks *server.RouterHooks
PostAuthMiddlewares server.PostAuthMiddlewares
Secret secret.Service
SubjectService subject.Service
SubjectCustomerHook hooks.CustomerSubjectHook
Subscription common.SubscriptionServiceWithWorkflow
StreamingConnector streaming.Connector
TaxCodeNamespaceHandler *taxcode.NamespaceHandler
TaxCodeService taxcode.Service
TelemetryServer common.TelemetryServer
TerminationChecker *common.TerminationChecker
RuntimeMetricsCollector common.RuntimeMetricsCollector
Tracer trace.Tracer
FeatureGate *featuregate.FeatureGateChecker
ClientIPMiddleware common.ClientIPMiddleware
}
func metadata(conf config.Configuration) common.Metadata {
return common.NewMetadata(conf, version, "backend")
}