diff --git a/internal/controller/ledger/controller_with_traces.go b/internal/controller/ledger/controller_with_traces.go index 214e415a5..b95bb13f0 100644 --- a/internal/controller/ledger/controller_with_traces.go +++ b/internal/controller/ledger/controller_with_traces.go @@ -5,6 +5,7 @@ import ( "database/sql" "github.com/formancehq/go-libs/v2/migrations" "github.com/formancehq/ledger/internal/tracing" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" "github.com/formancehq/go-libs/v2/bun/bunpaginate" @@ -14,163 +15,434 @@ import ( type ControllerWithTraces struct { underlying Controller tracer trace.Tracer + + beginTxHistogram metric.Int64Histogram + commitHistogram metric.Int64Histogram + rollbackHistogram metric.Int64Histogram + listTransactionsHistogram metric.Int64Histogram + countTransactionsHistogram metric.Int64Histogram + getTransactionHistogram metric.Int64Histogram + countAccountsHistogram metric.Int64Histogram + listAccountsHistogram metric.Int64Histogram + getAccountHistogram metric.Int64Histogram + getAggregatedBalancesHistogram metric.Int64Histogram + listLogsHistogram metric.Int64Histogram + importHistogram metric.Int64Histogram + exportHistogram metric.Int64Histogram + isDatabaseUpToDateHistogram metric.Int64Histogram + getVolumesWithBalancesHistogram metric.Int64Histogram + getStatsHistogram metric.Int64Histogram + createTransactionHistogram metric.Int64Histogram + revertTransactionHistogram metric.Int64Histogram + saveTransactionMetadataHistogram metric.Int64Histogram + saveAccountMetadataHistogram metric.Int64Histogram + deleteTransactionMetadataHistogram metric.Int64Histogram + deleteAccountMetadataHistogram metric.Int64Histogram } -func NewControllerWithTraces(underlying Controller, tracer trace.Tracer) *ControllerWithTraces { - return &ControllerWithTraces{ +func NewControllerWithTraces(underlying Controller, tracer trace.Tracer, meter metric.Meter) *ControllerWithTraces { + ret := &ControllerWithTraces{ underlying: underlying, tracer: tracer, } + + var err error + ret.beginTxHistogram, err = meter.Int64Histogram("BeginTX") + if err != nil { + panic(err) + } + ret.listTransactionsHistogram, err = meter.Int64Histogram("ListTransactions") + if err != nil { + panic(err) + } + ret.commitHistogram, err = meter.Int64Histogram("Commit") + if err != nil { + panic(err) + } + ret.rollbackHistogram, err = meter.Int64Histogram("Rollback") + if err != nil { + panic(err) + } + ret.countTransactionsHistogram, err = meter.Int64Histogram("CountTransactions") + if err != nil { + panic(err) + } + ret.getTransactionHistogram, err = meter.Int64Histogram("GetTransaction") + if err != nil { + panic(err) + } + ret.countAccountsHistogram, err = meter.Int64Histogram("CountAccounts") + if err != nil { + panic(err) + } + ret.listAccountsHistogram, err = meter.Int64Histogram("ListAccounts") + if err != nil { + panic(err) + } + ret.getAccountHistogram, err = meter.Int64Histogram("GetAccount") + if err != nil { + panic(err) + } + ret.getAggregatedBalancesHistogram, err = meter.Int64Histogram("GetAggregatedBalances") + if err != nil { + panic(err) + } + ret.listLogsHistogram, err = meter.Int64Histogram("ListLogs") + if err != nil { + panic(err) + } + ret.importHistogram, err = meter.Int64Histogram("Import") + if err != nil { + panic(err) + } + ret.exportHistogram, err = meter.Int64Histogram("Export") + if err != nil { + panic(err) + } + ret.isDatabaseUpToDateHistogram, err = meter.Int64Histogram("IsDatabaseUpToDate") + if err != nil { + panic(err) + } + ret.getVolumesWithBalancesHistogram, err = meter.Int64Histogram("GetVolumesWithBalances") + if err != nil { + panic(err) + } + ret.getStatsHistogram, err = meter.Int64Histogram("GetStats") + if err != nil { + panic(err) + } + ret.createTransactionHistogram, err = meter.Int64Histogram("CreateTransaction") + if err != nil { + panic(err) + } + ret.revertTransactionHistogram, err = meter.Int64Histogram("RevertTransaction") + if err != nil { + panic(err) + } + ret.saveTransactionMetadataHistogram, err = meter.Int64Histogram("SaveTransactionMetadata") + if err != nil { + panic(err) + } + ret.saveAccountMetadataHistogram, err = meter.Int64Histogram("SaveAccountMetadata") + if err != nil { + panic(err) + } + ret.deleteTransactionMetadataHistogram, err = meter.Int64Histogram("DeleteTransactionMetadata") + if err != nil { + panic(err) + } + ret.deleteAccountMetadataHistogram, err = meter.Int64Histogram("DeleteAccountMetadata") + if err != nil { + panic(err) + } + + return ret } func (c *ControllerWithTraces) BeginTX(ctx context.Context, options *sql.TxOptions) (Controller, error) { - return tracing.Trace(ctx, c.tracer, "BeginTX", func(ctx context.Context) (Controller, error) { - ctrl, err := c.underlying.BeginTX(ctx, options) - if err != nil { - return nil, err - } - - return &ControllerWithTraces{ - underlying: ctrl, - tracer: c.tracer, - }, nil - }) + return tracing.TraceWithMetric( + ctx, + "BeginTX", + c.tracer, + c.beginTxHistogram, + func(ctx context.Context) (Controller, error) { + ctrl, err := c.underlying.BeginTX(ctx, options) + if err != nil { + return nil, err + } + + ret := *c + ret.underlying = ctrl + + return &ret, nil + }, + ) } func (c *ControllerWithTraces) Commit(ctx context.Context) error { - return tracing.SkipResult(tracing.Trace(ctx, c.tracer, "BeginTX", tracing.NoResult(func(ctx context.Context) error { - return c.underlying.Commit(ctx) - }))) + return tracing.SkipResult(tracing.TraceWithMetric( + ctx, + "Commit", + c.tracer, + c.commitHistogram, + tracing.NoResult(func(ctx context.Context) error { + return c.underlying.Commit(ctx) + }), + )) } func (c *ControllerWithTraces) Rollback(ctx context.Context) error { - return tracing.SkipResult(tracing.Trace(ctx, c.tracer, "BeginTX", tracing.NoResult(func(ctx context.Context) error { - return c.underlying.Rollback(ctx) - }))) + return tracing.SkipResult(tracing.TraceWithMetric( + ctx, + "Rollback", + c.tracer, + c.rollbackHistogram, + tracing.NoResult(func(ctx context.Context) error { + return c.underlying.Rollback(ctx) + }), + )) } func (c *ControllerWithTraces) GetMigrationsInfo(ctx context.Context) ([]migrations.Info, error) { - return c.underlying.GetMigrationsInfo(ctx) + return tracing.TraceWithMetric( + ctx, + "GetMigrationsInfo", + c.tracer, + c.listTransactionsHistogram, + func(ctx context.Context) ([]migrations.Info, error) { + return c.underlying.GetMigrationsInfo(ctx) + }, + ) } func (c *ControllerWithTraces) ListTransactions(ctx context.Context, q ListTransactionsQuery) (*bunpaginate.Cursor[ledger.Transaction], error) { - return tracing.Trace(ctx, c.tracer, "ListTransactions", func(ctx context.Context) (*bunpaginate.Cursor[ledger.Transaction], error) { - return c.underlying.ListTransactions(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "ListTransactions", + c.tracer, + c.listTransactionsHistogram, + func(ctx context.Context) (*bunpaginate.Cursor[ledger.Transaction], error) { + return c.underlying.ListTransactions(ctx, q) + }, + ) } func (c *ControllerWithTraces) CountTransactions(ctx context.Context, q ListTransactionsQuery) (int, error) { - return tracing.Trace(ctx, c.tracer, "CountTransactions", func(ctx context.Context) (int, error) { - return c.underlying.CountTransactions(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "CountTransactions", + c.tracer, + c.countTransactionsHistogram, + func(ctx context.Context) (int, error) { + return c.underlying.CountTransactions(ctx, q) + }, + ) } func (c *ControllerWithTraces) GetTransaction(ctx context.Context, query GetTransactionQuery) (*ledger.Transaction, error) { - return tracing.Trace(ctx, c.tracer, "GetTransaction", func(ctx context.Context) (*ledger.Transaction, error) { - return c.underlying.GetTransaction(ctx, query) - }) + return tracing.TraceWithMetric( + ctx, + "GetTransaction", + c.tracer, + c.getTransactionHistogram, + func(ctx context.Context) (*ledger.Transaction, error) { + return c.underlying.GetTransaction(ctx, query) + }, + ) } func (c *ControllerWithTraces) CountAccounts(ctx context.Context, a ListAccountsQuery) (int, error) { - return tracing.Trace(ctx, c.tracer, "CountAccounts", func(ctx context.Context) (int, error) { - return c.underlying.CountAccounts(ctx, a) - }) + return tracing.TraceWithMetric( + ctx, + "CountAccounts", + c.tracer, + c.countAccountsHistogram, + func(ctx context.Context) (int, error) { + return c.underlying.CountAccounts(ctx, a) + }, + ) } func (c *ControllerWithTraces) ListAccounts(ctx context.Context, a ListAccountsQuery) (*bunpaginate.Cursor[ledger.Account], error) { - return tracing.Trace(ctx, c.tracer, "ListAccounts", func(ctx context.Context) (*bunpaginate.Cursor[ledger.Account], error) { - return c.underlying.ListAccounts(ctx, a) - }) + return tracing.TraceWithMetric( + ctx, + "ListAccounts", + c.tracer, + c.listAccountsHistogram, + func(ctx context.Context) (*bunpaginate.Cursor[ledger.Account], error) { + return c.underlying.ListAccounts(ctx, a) + }, + ) } func (c *ControllerWithTraces) GetAccount(ctx context.Context, q GetAccountQuery) (*ledger.Account, error) { - return tracing.Trace(ctx, c.tracer, "GetAccount", func(ctx context.Context) (*ledger.Account, error) { - return c.underlying.GetAccount(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "GetAccount", + c.tracer, + c.getAccountHistogram, + func(ctx context.Context) (*ledger.Account, error) { + return c.underlying.GetAccount(ctx, q) + }, + ) } func (c *ControllerWithTraces) GetAggregatedBalances(ctx context.Context, q GetAggregatedBalanceQuery) (ledger.BalancesByAssets, error) { - return tracing.Trace(ctx, c.tracer, "GetAggregatedBalances", func(ctx context.Context) (ledger.BalancesByAssets, error) { - return c.underlying.GetAggregatedBalances(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "GetAggregatedBalances", + c.tracer, + c.getAggregatedBalancesHistogram, + func(ctx context.Context) (ledger.BalancesByAssets, error) { + return c.underlying.GetAggregatedBalances(ctx, q) + }, + ) } func (c *ControllerWithTraces) ListLogs(ctx context.Context, q GetLogsQuery) (*bunpaginate.Cursor[ledger.Log], error) { - return tracing.Trace(ctx, c.tracer, "ListLogs", func(ctx context.Context) (*bunpaginate.Cursor[ledger.Log], error) { - return c.underlying.ListLogs(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "ListLogs", + c.tracer, + c.listLogsHistogram, + func(ctx context.Context) (*bunpaginate.Cursor[ledger.Log], error) { + return c.underlying.ListLogs(ctx, q) + }, + ) } func (c *ControllerWithTraces) Import(ctx context.Context, stream chan ledger.Log) error { - return tracing.SkipResult(tracing.Trace(ctx, c.tracer, "Import", tracing.NoResult(func(ctx context.Context) error { - return c.underlying.Import(ctx, stream) - }))) + return tracing.SkipResult(tracing.TraceWithMetric( + ctx, + "Import", + c.tracer, + c.importHistogram, + tracing.NoResult(func(ctx context.Context) error { + return c.underlying.Import(ctx, stream) + }), + )) } func (c *ControllerWithTraces) Export(ctx context.Context, w ExportWriter) error { - return tracing.SkipResult(tracing.Trace(ctx, c.tracer, "Export", tracing.NoResult(func(ctx context.Context) error { - return c.underlying.Export(ctx, w) - }))) + return tracing.SkipResult(tracing.TraceWithMetric( + ctx, + "Export", + c.tracer, + c.exportHistogram, + tracing.NoResult(func(ctx context.Context) error { + return c.underlying.Export(ctx, w) + }), + )) } func (c *ControllerWithTraces) IsDatabaseUpToDate(ctx context.Context) (bool, error) { - return tracing.Trace(ctx, c.tracer, "IsDatabaseUpToDate", func(ctx context.Context) (bool, error) { - return c.underlying.IsDatabaseUpToDate(ctx) - }) + return tracing.TraceWithMetric( + ctx, + "IsDatabaseUpToDate", + c.tracer, + c.isDatabaseUpToDateHistogram, + func(ctx context.Context) (bool, error) { + return c.underlying.IsDatabaseUpToDate(ctx) + }, + ) } func (c *ControllerWithTraces) GetVolumesWithBalances(ctx context.Context, q GetVolumesWithBalancesQuery) (*bunpaginate.Cursor[ledger.VolumesWithBalanceByAssetByAccount], error) { - return tracing.Trace(ctx, c.tracer, "GetVolumesWithBalances", func(ctx context.Context) (*bunpaginate.Cursor[ledger.VolumesWithBalanceByAssetByAccount], error) { - return c.underlying.GetVolumesWithBalances(ctx, q) - }) + return tracing.TraceWithMetric( + ctx, + "GetVolumesWithBalances", + c.tracer, + c.getVolumesWithBalancesHistogram, + func(ctx context.Context) (*bunpaginate.Cursor[ledger.VolumesWithBalanceByAssetByAccount], error) { + return c.underlying.GetVolumesWithBalances(ctx, q) + }, + ) } func (c *ControllerWithTraces) CreateTransaction(ctx context.Context, parameters Parameters[RunScript]) (*ledger.Log, *ledger.CreatedTransaction, error) { - ctx, span := c.tracer.Start(ctx, "CreateTransaction") - defer span.End() + var ( + createdTransaction *ledger.CreatedTransaction + log *ledger.Log + err error + ) + _, err = tracing.TraceWithMetric( + ctx, + "CreateTransaction", + c.tracer, + c.createTransactionHistogram, + func(ctx context.Context) (any, error) { + log, createdTransaction, err = c.underlying.CreateTransaction(ctx, parameters) + return nil, err + }, + ) + if err != nil { + return nil, nil, err + } - return c.underlying.CreateTransaction(ctx, parameters) + return log, createdTransaction, nil } func (c *ControllerWithTraces) RevertTransaction(ctx context.Context, parameters Parameters[RevertTransaction]) (*ledger.Log, *ledger.RevertedTransaction, error) { - ctx, span := c.tracer.Start(ctx, "RevertTransaction") - defer span.End() + var ( + revertedTransaction *ledger.RevertedTransaction + log *ledger.Log + err error + ) + _, err = tracing.TraceWithMetric( + ctx, + "RevertTransaction", + c.tracer, + c.revertTransactionHistogram, + func(ctx context.Context) (any, error) { + log, revertedTransaction, err = c.underlying.RevertTransaction(ctx, parameters) + return nil, err + }, + ) + if err != nil { + return nil, nil, err + } - return c.underlying.RevertTransaction(ctx, parameters) + return log, revertedTransaction, nil } func (c *ControllerWithTraces) SaveTransactionMetadata(ctx context.Context, parameters Parameters[SaveTransactionMetadata]) (*ledger.Log, error) { - ctx, span := c.tracer.Start(ctx, "SaveTransactionMetadata") - defer span.End() - - return c.underlying.SaveTransactionMetadata(ctx, parameters) + return tracing.TraceWithMetric( + ctx, + "SaveTransactionMetadata", + c.tracer, + c.saveTransactionMetadataHistogram, + func(ctx context.Context) (*ledger.Log, error) { + return c.underlying.SaveTransactionMetadata(ctx, parameters) + }, + ) } func (c *ControllerWithTraces) SaveAccountMetadata(ctx context.Context, parameters Parameters[SaveAccountMetadata]) (*ledger.Log, error) { - ctx, span := c.tracer.Start(ctx, "SaveAccountMetadata") - defer span.End() - - return c.underlying.SaveAccountMetadata(ctx, parameters) + return tracing.TraceWithMetric( + ctx, + "SaveAccountMetadata", + c.tracer, + c.saveAccountMetadataHistogram, + func(ctx context.Context) (*ledger.Log, error) { + return c.underlying.SaveAccountMetadata(ctx, parameters) + }, + ) } func (c *ControllerWithTraces) DeleteTransactionMetadata(ctx context.Context, parameters Parameters[DeleteTransactionMetadata]) (*ledger.Log, error) { - ctx, span := c.tracer.Start(ctx, "DeleteTransactionMetadata") - defer span.End() - - return c.underlying.DeleteTransactionMetadata(ctx, parameters) + return tracing.TraceWithMetric( + ctx, + "DeleteTransactionMetadata", + c.tracer, + c.deleteTransactionMetadataHistogram, + func(ctx context.Context) (*ledger.Log, error) { + return c.underlying.DeleteTransactionMetadata(ctx, parameters) + }, + ) } func (c *ControllerWithTraces) DeleteAccountMetadata(ctx context.Context, parameters Parameters[DeleteAccountMetadata]) (*ledger.Log, error) { - ctx, span := c.tracer.Start(ctx, "DeleteAccountMetadata") - defer span.End() - - return c.underlying.DeleteAccountMetadata(ctx, parameters) + return tracing.TraceWithMetric( + ctx, + "DeleteAccountMetadata", + c.tracer, + c.deleteAccountMetadataHistogram, + func(ctx context.Context) (*ledger.Log, error) { + return c.underlying.DeleteAccountMetadata(ctx, parameters) + }, + ) } func (c *ControllerWithTraces) GetStats(ctx context.Context) (Stats, error) { - return tracing.Trace(ctx, c.tracer, "GetStats", func(ctx context.Context) (Stats, error) { - return c.underlying.GetStats(ctx) - }) + return tracing.TraceWithMetric( + ctx, + "GetStats", + c.tracer, + c.getStatsHistogram, + func(ctx context.Context) (Stats, error) { + return c.underlying.GetStats(ctx) + }, + ) } var _ Controller = (*ControllerWithTraces)(nil) diff --git a/internal/controller/system/controller.go b/internal/controller/system/controller.go index 44265079f..ca2f836c0 100644 --- a/internal/controller/system/controller.go +++ b/internal/controller/system/controller.go @@ -3,6 +3,7 @@ package system import ( "context" "github.com/formancehq/ledger/pkg/features" + "go.opentelemetry.io/otel/attribute" "reflect" "time" @@ -38,29 +39,40 @@ type DefaultController struct { registry *ledgercontroller.StateRegistry databaseRetryConfiguration DatabaseRetryConfiguration - tracer trace.Tracer - meter metric.Meter + tracerProvider trace.TracerProvider + meterProvider metric.MeterProvider enableFeatures bool } func (ctrl *DefaultController) GetLedgerController(ctx context.Context, name string) (ledgercontroller.Controller, error) { - return tracing.Trace(ctx, ctrl.tracer, "GetLedgerController", func(ctx context.Context) (ledgercontroller.Controller, error) { + return tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "GetLedgerController", func(ctx context.Context) (ledgercontroller.Controller, error) { store, l, err := ctrl.store.OpenLedger(ctx, name) if err != nil { return nil, err } + instrumentationAttributes := []attribute.KeyValue{ + attribute.String("ledger", name), + } + + meter := ctrl.meterProvider.Meter("ledger", metric.WithInstrumentationAttributes( + instrumentationAttributes..., + )) + tracer := ctrl.tracerProvider.Tracer("ledger", trace.WithInstrumentationAttributes( + instrumentationAttributes..., + )) + var ledgerController ledgercontroller.Controller = ledgercontroller.NewDefaultController( *l, store, ctrl.parser, - ledgercontroller.WithMeter(ctrl.meter), + ledgercontroller.WithMeter(meter), ) // Add too many client error handling ledgerController = ledgercontroller.NewControllerWithTooManyClientHandling( ledgerController, - ctrl.tracer, + tracer, ledgercontroller.DelayCalculatorFn(func(i int) time.Duration { if i < ctrl.databaseRetryConfiguration.MaxRetry { return time.Duration(i+1) * ctrl.databaseRetryConfiguration.Delay @@ -74,7 +86,7 @@ func (ctrl *DefaultController) GetLedgerController(ctx context.Context, name str ledgerController = ledgercontroller.NewControllerWithCache(*l, ledgerController, ctrl.registry) // Add traces - ledgerController = ledgercontroller.NewControllerWithTraces(ledgerController, ctrl.tracer) + ledgerController = ledgercontroller.NewControllerWithTraces(ledgerController, tracer, meter) // Add events listener if ctrl.listener != nil { @@ -86,7 +98,7 @@ func (ctrl *DefaultController) GetLedgerController(ctx context.Context, name str } func (ctrl *DefaultController) CreateLedger(ctx context.Context, name string, configuration ledger.Configuration) error { - return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracer, "CreateLedger", tracing.NoResult(func(ctx context.Context) error { + return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "CreateLedger", tracing.NoResult(func(ctx context.Context) error { configuration.SetDefaults() if !ctrl.enableFeatures { @@ -105,25 +117,25 @@ func (ctrl *DefaultController) CreateLedger(ctx context.Context, name string, co } func (ctrl *DefaultController) GetLedger(ctx context.Context, name string) (*ledger.Ledger, error) { - return tracing.Trace(ctx, ctrl.tracer, "GetLedger", func(ctx context.Context) (*ledger.Ledger, error) { + return tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "GetLedger", func(ctx context.Context) (*ledger.Ledger, error) { return ctrl.store.GetLedger(ctx, name) }) } func (ctrl *DefaultController) ListLedgers(ctx context.Context, query ledgercontroller.ListLedgersQuery) (*bunpaginate.Cursor[ledger.Ledger], error) { - return tracing.Trace(ctx, ctrl.tracer, "ListLedgers", func(ctx context.Context) (*bunpaginate.Cursor[ledger.Ledger], error) { + return tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "ListLedgers", func(ctx context.Context) (*bunpaginate.Cursor[ledger.Ledger], error) { return ctrl.store.ListLedgers(ctx, query) }) } func (ctrl *DefaultController) UpdateLedgerMetadata(ctx context.Context, name string, m map[string]string) error { - return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracer, "UpdateLedgerMetadata", tracing.NoResult(func(ctx context.Context) error { + return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "UpdateLedgerMetadata", tracing.NoResult(func(ctx context.Context) error { return ctrl.store.UpdateLedgerMetadata(ctx, name, m) }))) } func (ctrl *DefaultController) DeleteLedgerMetadata(ctx context.Context, param string, key string) error { - return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracer, "DeleteLedgerMetadata", tracing.NoResult(func(ctx context.Context) error { + return tracing.SkipResult(tracing.Trace(ctx, ctrl.tracerProvider.Tracer("system"), "DeleteLedgerMetadata", tracing.NoResult(func(ctx context.Context) error { return ctrl.store.DeleteLedgerMetadata(ctx, param, key) }))) } @@ -155,15 +167,15 @@ func WithDatabaseRetryConfiguration(configuration DatabaseRetryConfiguration) Op } } -func WithMeter(m metric.Meter) Option { +func WithMeterProvider(mp metric.MeterProvider) Option { return func(ctrl *DefaultController) { - ctrl.meter = m + ctrl.meterProvider = mp } } -func WithTracer(t trace.Tracer) Option { +func WithTracerProvider(t trace.TracerProvider) Option { return func(ctrl *DefaultController) { - ctrl.tracer = t + ctrl.tracerProvider = t } } @@ -174,6 +186,6 @@ func WithEnableFeatures(v bool) Option { } var defaultOptions = []Option{ - WithMeter(noopmetrics.Meter{}), - WithTracer(nooptracer.Tracer{}), + WithMeterProvider(noopmetrics.MeterProvider{}), + WithTracerProvider(nooptracer.TracerProvider{}), } diff --git a/internal/controller/system/module.go b/internal/controller/system/module.go index b8d4b5691..694c7bed0 100644 --- a/internal/controller/system/module.go +++ b/internal/controller/system/module.go @@ -48,8 +48,8 @@ func NewFXModule(configuration ModuleConfiguration) fx.Option { listener, WithParser(parser), WithDatabaseRetryConfiguration(configuration.DatabaseRetryConfiguration), - WithMeter(meterProvider.Meter("core")), - WithTracer(tracerProvider.Tracer("core")), + WithMeterProvider(meterProvider), + WithTracerProvider(tracerProvider), WithEnableFeatures(configuration.EnableFeatures), ) }),