feat: OpenTelemetry configuration and BaseApp instrumentation (#25516)
Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
This commit is contained in:
co-authored by
Tyler
Alex | Cosmos Labs
parent
a15ac0b28d
commit
f2d4a98039
@@ -12,12 +12,12 @@ import (
|
||||
// BeginBlocker will persist the current header and validator set as a historical entry
|
||||
// and prune the oldest entry based on the HistoricalEntries parameter
|
||||
func (k *Keeper) BeginBlocker(ctx context.Context) error {
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker)
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyBeginBlocker) //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
return k.TrackHistoricalInfo(ctx)
|
||||
}
|
||||
|
||||
// EndBlocker called at every block, update validator set
|
||||
func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error) {
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyEndBlocker)
|
||||
defer telemetry.ModuleMeasureSince(types.ModuleName, telemetry.Now(), telemetry.MetricKeyEndBlocker) //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
return k.BlockValidatorUpdates(ctx)
|
||||
}
|
||||
|
||||
@@ -284,11 +284,11 @@ func (k msgServer) Delegate(ctx context.Context, msg *types.MsgDelegate) (*types
|
||||
|
||||
if msg.Amount.Amount.IsInt64() {
|
||||
defer func() {
|
||||
telemetry.IncrCounter(1, types.ModuleName, "delegate")
|
||||
telemetry.SetGaugeWithLabels(
|
||||
telemetry.IncrCounter(1, types.ModuleName, "delegate") //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
telemetry.SetGaugeWithLabels( //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
[]string{"tx", "msg", sdk.MsgTypeURL(msg)},
|
||||
float32(msg.Amount.Amount.Int64()),
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)},
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)}, //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
)
|
||||
}()
|
||||
}
|
||||
@@ -358,11 +358,11 @@ func (k msgServer) BeginRedelegate(ctx context.Context, msg *types.MsgBeginRedel
|
||||
|
||||
if msg.Amount.Amount.IsInt64() {
|
||||
defer func() {
|
||||
telemetry.IncrCounter(1, types.ModuleName, "redelegate")
|
||||
telemetry.SetGaugeWithLabels(
|
||||
telemetry.IncrCounter(1, types.ModuleName, "redelegate") //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
telemetry.SetGaugeWithLabels( //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
[]string{"tx", "msg", sdk.MsgTypeURL(msg)},
|
||||
float32(msg.Amount.Amount.Int64()),
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)},
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)}, //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
)
|
||||
}()
|
||||
}
|
||||
@@ -430,11 +430,11 @@ func (k msgServer) Undelegate(ctx context.Context, msg *types.MsgUndelegate) (*t
|
||||
|
||||
if msg.Amount.Amount.IsInt64() {
|
||||
defer func() {
|
||||
telemetry.IncrCounter(1, types.ModuleName, "undelegate")
|
||||
telemetry.SetGaugeWithLabels(
|
||||
telemetry.IncrCounter(1, types.ModuleName, "undelegate") //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
telemetry.SetGaugeWithLabels( //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
[]string{"tx", "msg", sdk.MsgTypeURL(msg)},
|
||||
float32(msg.Amount.Amount.Int64()),
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)},
|
||||
[]metrics.Label{telemetry.NewLabel("denom", msg.Amount.Denom)}, //nolint:staticcheck // TODO: switch to OpenTelemetry
|
||||
)
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user