Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions sei-cosmos/baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import (
"syscall"
"time"

"github.com/armon/go-metrics"
"github.com/sei-protocol/sei-chain/sei-cosmos/codec"
snapshottypes "github.com/sei-protocol/sei-chain/sei-cosmos/snapshots/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/store/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/tasks"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
"github.com/sei-protocol/sei-chain/sei-cosmos/types/legacytm"
Expand Down Expand Up @@ -118,8 +116,6 @@ func (app *BaseApp) MidBlock(ctx sdk.Context, height int64) (events []abci.Event
start := time.Now()
defer func() {
baseappMetrics.midBlockDuration.Record(ctx.Context(), time.Since(start).Seconds())
// TODO(PLT-353): remove once baseapp_mid_block_duration verified
telemetry.MeasureSince(start, "abci", "mid_block")
}()

if app.midBlocker != nil {
Expand All @@ -135,8 +131,6 @@ func (app *BaseApp) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) (res abc
start := time.Now()
defer func() {
baseappMetrics.endBlockDuration.Record(ctx.Context(), time.Since(start).Seconds())
// TODO(PLT-353): remove once baseapp_end_block_duration verified
telemetry.MeasureSince(start, "abci", "end_block")
}()

if app.endBlocker != nil {
Expand Down Expand Up @@ -195,20 +189,10 @@ func (app *BaseApp) DeliverTx(ctx sdk.Context, req abci.RequestDeliverTxV2, tx s

defer func() {
baseappMetrics.deliverTxDuration.Record(ctx.Context(), time.Since(deliverTxStart).Seconds())
// TODO(PLT-353): remove once baseapp_deliver_tx_duration verified
telemetry.MeasureSince(deliverTxStart, "abci", "deliver_tx")
baseappMetrics.txCount.Add(ctx.Context(), 1)
// TODO(PLT-353): remove once baseapp_tx_count verified
telemetry.IncrCounter(1, "tx", "count")
baseappMetrics.txResult.Add(ctx.Context(), 1, otelmetric.WithAttributes(attribute.String("result", resultStr)))
// TODO(PLT-353): remove once baseapp_tx_result verified
telemetry.IncrCounter(1, "tx", resultStr)
baseappMetrics.txGasUsed.Record(ctx.Context(), int64(gInfo.GasUsed)) //nolint:gosec
// TODO(PLT-353): remove once baseapp_tx_gas_used verified
telemetry.SetGauge(float32(gInfo.GasUsed), "tx", "gas", "used")
baseappMetrics.txGasUsed.Record(ctx.Context(), int64(gInfo.GasUsed)) //nolint:gosec
baseappMetrics.txGasWanted.Record(ctx.Context(), int64(gInfo.GasWanted)) //nolint:gosec
// TODO(PLT-353): remove once baseapp_tx_gas_wanted verified
telemetry.SetGauge(float32(gInfo.GasWanted), "tx", "gas", "wanted")
}()

runTxRes, err := app.runTx(ctx.WithTxBytes(req.Tx).WithTxSum(checksum), runTxModeDeliver, tx, checksum)
Expand Down Expand Up @@ -281,8 +265,6 @@ func (app *BaseApp) Commit(ctx context.Context) (res *abci.ResponseCommit, err e
commitStart := time.Now()
defer func() {
baseappMetrics.commitDuration.Record(ctx, time.Since(commitStart).Seconds())
// TODO(PLT-353): remove once baseapp_commit_duration verified
telemetry.MeasureSince(commitStart, "abci", "commit")
}()
app.commitLock.Lock()
defer app.commitLock.Unlock()
Expand Down Expand Up @@ -441,8 +423,6 @@ func (app *BaseApp) Query(ctx context.Context, req *abci.RequestQuery) (res *abc
defer func() {
route := app.abciQueryMetricRoute(req.Path)
baseappMetrics.abciQueryDuration.Record(ctx, time.Since(queryStart).Seconds(), otelmetric.WithAttributes(attribute.String(abciQueryMetricRouteLabel, route)))
// TODO(PLT-353): remove once baseapp_abci_query_duration verified
telemetry.MeasureSinceWithLabels([]string{"abci", "query"}, queryStart, []metrics.Label{{Name: "path", Value: req.Path}})
}()

// Add panic recovery for all queries.
Expand Down Expand Up @@ -1001,8 +981,6 @@ func (app *BaseApp) ProcessProposal(ctx context.Context, req *abci.RequestProces
processProposalStart := time.Now()
defer func() {
baseappMetrics.processProposalDuration.Record(ctx, time.Since(processProposalStart).Seconds())
// TODO(PLT-353): remove once baseapp_process_proposal_duration verified
telemetry.MeasureSince(processProposalStart, "abci", "process_proposal")
}()
defer func() { app.execProcessProposalMs = time.Since(processProposalStart).Milliseconds() }()
if app.ChainID != req.Header.ChainID {
Expand Down Expand Up @@ -1068,8 +1046,6 @@ func (app *BaseApp) FinalizeBlock(ctx context.Context, req *abci.RequestFinalize
finalizeBlockStart := time.Now()
defer func() {
baseappMetrics.finalizeBlockDuration.Record(ctx, time.Since(finalizeBlockStart).Seconds())
// TODO(PLT-353): remove once baseapp_finalize_block_duration verified
telemetry.MeasureSince(finalizeBlockStart, "abci", "finalize_block")
}()
app.execBlockTxCount = len(req.Txs)
defer func() { app.execFinalizeBlockMs = time.Since(finalizeBlockStart).Milliseconds() }()
Expand Down Expand Up @@ -1146,8 +1122,6 @@ func (app *BaseApp) GetTxPriorityHint(ctx context.Context, req *abci.RequestGetT
priorityHintStart := time.Now()
defer func() {
baseappMetrics.getTxPriorityHintDuration.Record(ctx, time.Since(priorityHintStart).Seconds())
// TODO(PLT-353): remove once baseapp_get_tx_priority_hint_duration verified
telemetry.MeasureSince(priorityHintStart, "abci", "get_tx_priority_hint")
}()

tx, err := app.txDecoder(req.Tx)
Expand Down
30 changes: 0 additions & 30 deletions sei-cosmos/baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"sync"
"time"

"github.com/armon/go-metrics"
"github.com/ethereum/go-ethereum/common"
"github.com/gogo/protobuf/proto"
"github.com/holiman/uint256"
Expand All @@ -17,7 +16,6 @@ import (
servertypes "github.com/sei-protocol/sei-chain/sei-cosmos/server/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/snapshots"
"github.com/sei-protocol/sei-chain/sei-cosmos/store"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
"github.com/sei-protocol/sei-chain/sei-cosmos/utils/tracing"
Expand Down Expand Up @@ -882,14 +880,6 @@ func (app *BaseApp) runTx(ctx sdk.Context, mode runTxMode, tx sdk.Tx, checksum [
runTxStart := time.Now()
defer func() {
baseappMetrics.runTxDuration.Record(ctx.Context(), time.Since(runTxStart).Seconds(), otelmetric.WithAttributes(attribute.String("mode", modeKeyToString[mode])))
// TODO(PLT-353): remove once baseapp_run_tx_duration verified
telemetry.MeasureThroughputSinceWithLabels(
telemetry.TxCount,
[]metrics.Label{
telemetry.NewLabel("mode", modeKeyToString[mode]),
},
runTxStart,
)
}()

// check for existing parent tracer, and if applicable, use it
Expand Down Expand Up @@ -1041,14 +1031,6 @@ func (app *BaseApp) RunMsgs(ctx sdk.Context, msgs []sdk.Msg) (*sdk.Result, error
runMsgsStart := time.Now()
defer func() {
baseappMetrics.runMsgsDuration.Record(ctx.Context(), time.Since(runMsgsStart).Seconds())
// TODO(PLT-353): remove once baseapp_run_msgs_duration verified
telemetry.MeasureThroughputSinceWithLabels(
telemetry.MessageCount,
[]metrics.Label{
telemetry.NewLabel("mode", "deliver"),
},
runMsgsStart,
)
}()

defer func() {
Expand Down Expand Up @@ -1084,12 +1066,6 @@ func (app *BaseApp) RunMsgs(ctx sdk.Context, msgs []sdk.Msg) (*sdk.Result, error
msgResult, err = handler(msgCtx, msg)
eventMsgName = sdk.MsgTypeURL(msg)
baseappMetrics.runMsgLatency.Record(ctx.Context(), time.Since(startTime).Seconds(), otelmetric.WithAttributes(attribute.String("type", eventMsgName)))
// TODO(PLT-353): remove once baseapp_run_msg_latency verified
metrics.MeasureSinceWithLabels(
[]string{"sei", "cosmos", "run", "msg", "latency"},
startTime,
[]metrics.Label{{Name: "type", Value: eventMsgName}},
)
} else if legacyMsg, ok := msg.(legacytx.LegacyMsg); ok {
// legacy sdk.Msg routing
// Assuming that the app developer has migrated all their Msgs to
Expand All @@ -1104,12 +1080,6 @@ func (app *BaseApp) RunMsgs(ctx sdk.Context, msgs []sdk.Msg) (*sdk.Result, error
}
msgResult, err = handler(msgCtx, msg)
baseappMetrics.runMsgLatency.Record(ctx.Context(), time.Since(startTime).Seconds(), otelmetric.WithAttributes(attribute.String("type", eventMsgName)))
// TODO(PLT-353): remove once baseapp_run_msg_latency verified
metrics.MeasureSinceWithLabels(
[]string{"cosmos", "run", "msg", "latency"},
startTime,
[]metrics.Label{{Name: "type", Value: eventMsgName}},
)
} else {
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "can't route message %+v", msg)
}
Expand Down
13 changes: 1 addition & 12 deletions sei-cosmos/store/types/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"context"
"sync"

"github.com/armon/go-metrics"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
"go.opentelemetry.io/otel/attribute"
otelmetric "go.opentelemetry.io/otel/metric"
)
Expand Down Expand Up @@ -50,8 +48,7 @@ type BoundedCache struct {
CacheBackend
limit int

mu *sync.Mutex
metricName []string
mu *sync.Mutex
}

func NewBoundedCache(backend CacheBackend, limit int) *BoundedCache {
Expand All @@ -62,19 +59,11 @@ func NewBoundedCache(backend CacheBackend, limit int) *BoundedCache {
CacheBackend: backend,
limit: limit,
mu: &sync.Mutex{},
// cosmos_bounded_cache
metricName: []string{"cosmos", "bounded", "cache"},
}
}

func (c *BoundedCache) emitKeysEvictedMetrics(keysToEvict int) {
storeMetrics.boundedCache.Record(context.Background(), int64(keysToEvict), otelmetric.WithAttributes(attribute.String("type", "keys_evicted")))
// TODO(PLT-353): remove once store_bounded_cache verified
telemetry.SetGaugeWithLabels(
c.metricName,
float32(keysToEvict),
[]metrics.Label{telemetry.NewLabel("type", "keys_evicted")},
)
}

func (c *BoundedCache) Set(key string, val *CValue) {
Expand Down
11 changes: 1 addition & 10 deletions sei-cosmos/store/types/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"math"
"sync"

"github.com/armon/go-metrics"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
"go.opentelemetry.io/otel/attribute"
otelmetric "go.opentelemetry.io/otel/metric"
)
Expand Down Expand Up @@ -114,19 +112,12 @@ func (g *basicGasMeter) ConsumeGas(amount Gas, descriptor string) {
}
}

// cosmos_tx_gas_exceeded
func (g *basicGasMeter) incrGasExceededCounter(errorType string, descriptor string) {
storeMetrics.gasExceeded.Add(context.Background(), 1, otelmetric.WithAttributes(
attribute.String("error", errorType),
// descriptor distinguishes between different gas meters (e.g block vs tx)
attribute.String("descriptor", descriptor),
))
// TODO(PLT-353): remove once store_gas_exceeded verified
telemetry.IncrCounterWithLabels(
[]string{"gas", "exceeded"},
1,
// descriptor is a label to distinguish between different gas meters (e.g block vs tx)
[]metrics.Label{telemetry.NewLabel("error", errorType), telemetry.NewLabel("descriptor", descriptor)},
)
}

// RefundGas will deduct the given amount from the gas consumed. If the amount is greater than the
Expand Down
39 changes: 0 additions & 39 deletions sei-cosmos/storev2/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import (
"io"
"math"
"sort"
"strconv"
"strings"
"sync"
"time"

"cosmossdk.io/errors"
"github.com/armon/go-metrics"
"github.com/sei-protocol/seilog"
"go.opentelemetry.io/otel/attribute"
otelmetric "go.opentelemetry.io/otel/metric"
Expand All @@ -28,7 +26,6 @@ import (
"github.com/sei-protocol/sei-chain/sei-cosmos/storev2/commitment"
"github.com/sei-protocol/sei-chain/sei-cosmos/storev2/query"
"github.com/sei-protocol/sei-chain/sei-cosmos/storev2/state"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
commonerrors "github.com/sei-protocol/sei-chain/sei-db/common/errors"
"github.com/sei-protocol/sei-chain/sei-db/config"
Expand Down Expand Up @@ -196,8 +193,6 @@ func (rs *Store) Commit(bumpVersion bool) types.CommitID {
commitStartTime := time.Now()
defer func() {
storev2Metrics.scCommitLatency.Record(context.Background(), time.Since(commitStartTime).Seconds())
// TODO(PLT-353): remove once storev2_sc_commit_latency verified
telemetry.MeasureSince(commitStartTime, "storeV2", "sc", "commit", "latency")
}()
if err := rs.flush(); err != nil {
panic(err)
Expand Down Expand Up @@ -1004,26 +999,12 @@ func (rs *Store) Query(ctx context.Context, req abci.RequestQuery) abci.Response
attribute.Bool("success", false),
attribute.Bool("proof", needProof),
))
// TODO(PLT-353): remove once storev2_historical_abci_query verified
telemetry.IncrCounterWithLabels([]string{"historical", "abci", "query"},
1,
[]metrics.Label{
telemetry.NewLabel("success", "false"),
telemetry.NewLabel("proof", strconv.FormatBool(needProof)),
})
return sdkerrors.QueryResult(err)
} else {
storev2Metrics.historicalAbciQuery.Add(ctx, 1, otelmetric.WithAttributes(
attribute.Bool("success", true),
attribute.Bool("proof", needProof),
))
// TODO(PLT-353): remove once storev2_historical_abci_query verified
telemetry.IncrCounterWithLabels([]string{"historical", "abci", "query"},
1,
[]metrics.Label{
telemetry.NewLabel("success", "true"),
telemetry.NewLabel("proof", strconv.FormatBool(needProof)),
})
}
defer rs.releaseHistProofPermit()

Expand Down Expand Up @@ -1337,30 +1318,12 @@ func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error {
if err == commonerrors.ErrorExportDone {
for k, v := range keySizePerStore {
storev2Metrics.iavlTotalKeyBytes.Record(context.Background(), v, otelmetric.WithAttributes(attribute.String("store_name", k)))
// TODO(PLT-353): remove once storev2_iavl_total_key_bytes verified
telemetry.SetGaugeWithLabels(
[]string{"iavl", "store", "total_key_bytes"},
float32(v),
[]metrics.Label{telemetry.NewLabel("store_name", k)},
)
}
for k, v := range valueSizePerStore {
storev2Metrics.iavlTotalValueBytes.Record(context.Background(), v, otelmetric.WithAttributes(attribute.String("store_name", k)))
// TODO(PLT-353): remove once storev2_iavl_total_value_bytes verified
telemetry.SetGaugeWithLabels(
[]string{"iavl", "store", "total_value_bytes"},
float32(v),
[]metrics.Label{telemetry.NewLabel("store_name", k)},
)
}
for k, v := range numKeysPerStore {
storev2Metrics.iavlTotalNumKeys.Record(context.Background(), v, otelmetric.WithAttributes(attribute.String("store_name", k)))
// TODO(PLT-353): remove once storev2_iavl_total_num_keys verified
telemetry.SetGaugeWithLabels(
[]string{"iavl", "store", "total_num_keys"},
float32(v),
[]metrics.Label{telemetry.NewLabel("store_name", k)},
)
}
break
}
Expand All @@ -1384,8 +1347,6 @@ func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error {
valueSizePerStore[currentStoreName] += int64(len(item.Value))
numKeysPerStore[currentStoreName] += 1
storev2Metrics.stateSyncKeysExported.Add(context.Background(), 1)
// TODO(PLT-353): remove once storev2_state_sync_keys_exported verified
telemetry.IncrCounter(1, "state_sync", "num_keys_exported")
case string:
if err := protoWriter.WriteMsg(&snapshottypes.SnapshotItem{
Item: &snapshottypes.SnapshotItem_Store{
Expand Down
5 changes: 0 additions & 5 deletions sei-cosmos/tasks/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/sei-protocol/sei-chain/sei-cosmos/store/multiversion"
store "github.com/sei-protocol/sei-chain/sei-cosmos/store/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/types/occ"
"github.com/sei-protocol/sei-chain/sei-cosmos/utils/tracing"
Expand Down Expand Up @@ -273,11 +272,7 @@ func (s *scheduler) emitMetrics(ctx context.Context) {
fmt.Fprintf(os.Stderr, "telemetry panic: %v\n%s", e, debug.Stack())
}
}()
// TODO(PLT-353): remove once scheduler_retries verified
telemetry.IncrCounter(float32(s.metrics.retries), "scheduler", "retries")
taskMetrics.retries.Add(ctx, int64(s.metrics.retries))
// TODO(PLT-353): remove once scheduler_incarnations verified
telemetry.IncrCounter(float32(s.metrics.maxIncarnation), "scheduler", "incarnations")
taskMetrics.incarnations.Add(ctx, int64(s.metrics.maxIncarnation))
}

Expand Down
7 changes: 0 additions & 7 deletions sei-cosmos/telemetry/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const (
MetricKeyBeginBlocker = "begin_blocker"
MetricKeyEndBlocker = "end_blocker"
MetricLabelNameModule = "module"
MessageCount = "message"
TxCount = "transaction"
)

Expand Down Expand Up @@ -61,12 +60,6 @@ func MeasureSince(start time.Time, keys ...string) {
metrics.MeasureSinceWithLabels(keys, start.UTC(), globalLabels)
}

// MeasureSinceWithLabels provides a wrapper functionality for emitting a a time measure
// metric with custom labels (if any)
func MeasureSinceWithLabels(keys []string, start time.Time, labels []metrics.Label) {
metrics.MeasureSinceWithLabels(keys, start.UTC(), labels)
}

// Measure Validator slashing events
// validator_slashed
func IncrValidatorSlashedCounter(validator string, slashingType string) {
Expand Down
8 changes: 0 additions & 8 deletions sei-cosmos/x/bank/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package keeper
import (
"context"

"github.com/armon/go-metrics"

"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
Expand Down Expand Up @@ -59,12 +57,6 @@ func (k msgServer) Send(goCtx context.Context, msg *types.MsgSend) (*types.MsgSe
for _, a := range msg.Amount {
if a.Amount.IsInt64() {
bankMetrics.sendAmount.Record(goCtx, a.Amount.Int64(), otelmetric.WithAttributes(attribute.String("denom_class", telemetry.DenomClass(a.Denom))))
// TODO(PLT-353): remove once bank_send_amount verified
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "send"},
float32(a.Amount.Int64()),
[]metrics.Label{telemetry.NewLabel("denom", a.Denom)},
)
}
}
}()
Expand Down
Loading
Loading