Skip to content

Commit e089531

Browse files
authored
[Do Not Merge Yet] Complete PLT-910: remove legacy wasm dual metrics (#4075)
## Summary Complete the WASM keeper OpenTelemetry migration by removing legacy `telemetry`/`go-metrics` emissions that duplicate the OTel histograms introduced in v6.7. ## Changes - Remove `telemetry.MeasureSince` fallbacks for contract instantiate, execute, migrate, sudo, query-smart, and query-raw durations. - Remove the legacy per-contract execute-latency metric. - Remove the legacy query-smart invocation counter and gas-used gauge. - Keep the OTel duration and gas histograms as the single source of truth. - Eliminate contract-address-labeled series that grow with every distinct queried or executed contract, addressing CON-336 and CON-337. ## Rollout > [!IMPORTANT] > Do not merge or deploy this change until v6.7 has landed. The replacement OTel histograms are only available from v6.7 onward. The corresponding platform migration, sei-protocol/platform#2216, updates the dev and prod dashboards to query the OTel metrics. Deploy that dashboard migration before this legacy metric removal reaches nodes. ## Validation The current CI run passes the build, lint, unit/race, upgrade, and integration test suites. ## Related - PLT-910 - CON-336 - CON-337 - sei-protocol/platform#2216
1 parent 0223c81 commit e089531

3 files changed

Lines changed: 2 additions & 44 deletions

File tree

‎sei-wasmd/x/wasm/keeper/keeper.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ func (k Keeper) QuerySmartSafe(ctx sdk.Context, contractAddr sdk.AccAddress, req
637637
func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error) {
638638
start := time.Now()
639639
defer func() { recordContractQuerySmartDuration(ctx.Context(), start) }()
640-
recordContractQuerySmartInvocation(contractAddr.String())
641640

642641
// checks and increase query stack size
643642
ctx, err := checkAndIncreaseQueryStackSize(ctx, k.maxQueryStackSize)
@@ -667,7 +666,7 @@ func (k Keeper) QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []b
667666
return nil, sdkerrors.Wrap(types.ErrQueryFailed, qErr.Error())
668667
}
669668

670-
recordContractQuerySmartGasUsed(ctx.Context(), contractAddr.String(), gasUsed)
669+
recordContractQuerySmartGasUsed(ctx.Context(), gasUsed)
671670
return queryResult, nil
672671
}
673672

‎sei-wasmd/x/wasm/keeper/metrics.go‎

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import (
44
"context"
55
"time"
66

7-
"github.com/armon/go-metrics"
87
"github.com/prometheus/client_golang/prometheus"
9-
"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
108
wasmvmtypes "github.com/sei-protocol/sei-chain/sei-wasmvm/types"
119
"go.opentelemetry.io/otel"
1210
"go.opentelemetry.io/otel/metric"
@@ -88,62 +86,30 @@ func must[V any](v V, err error) V {
8886

8987
func recordContractInstantiateDuration(ctx context.Context, start time.Time) {
9088
wasmKeeperMetrics.contractInstantiateDuration.Record(ctx, time.Since(start).Seconds())
91-
// TODO(PLT-910): remove once wasm_contract_instantiate_duration verified
92-
telemetry.MeasureSince(start, "wasm", "contract", "instantiate")
9389
}
9490

9591
func recordContractExecuteDuration(ctx context.Context, start time.Time) {
9692
wasmKeeperMetrics.contractExecuteDuration.Record(ctx, time.Since(start).Seconds())
97-
// TODO(PLT-910): remove once wasm_contract_execute_duration verified
98-
telemetry.MeasureSince(start, "wasm", "contract", "execute")
9993
}
10094

10195
func recordContractMigrateDuration(ctx context.Context, start time.Time) {
10296
wasmKeeperMetrics.contractMigrateDuration.Record(ctx, time.Since(start).Seconds())
103-
// TODO(PLT-910): remove once wasm_contract_migrate_duration verified
104-
telemetry.MeasureSince(start, "wasm", "contract", "migrate")
10597
}
10698

10799
func recordContractSudoDuration(ctx context.Context, start time.Time) {
108100
wasmKeeperMetrics.contractSudoDuration.Record(ctx, time.Since(start).Seconds())
109-
// TODO(PLT-910): remove once wasm_contract_sudo_duration verified
110-
telemetry.MeasureSince(start, "wasm", "contract", "sudo")
111101
}
112102

113103
func recordContractQuerySmartDuration(ctx context.Context, start time.Time) {
114104
wasmKeeperMetrics.contractQuerySmartDuration.Record(ctx, time.Since(start).Seconds())
115-
// TODO(PLT-910): remove once wasm_contract_query_smart_duration verified
116-
telemetry.MeasureSince(start, "wasm", "contract", "query-smart")
117105
}
118106

119107
func recordContractQueryRawDuration(ctx context.Context, start time.Time) {
120108
wasmKeeperMetrics.contractQueryRawDuration.Record(ctx, time.Since(start).Seconds())
121-
// TODO(PLT-910): remove once wasm_contract_query_raw_duration verified
122-
telemetry.MeasureSince(start, "wasm", "contract", "query-raw")
123109
}
124110

125-
func recordContractQuerySmartInvocation(contractAddress string) {
126-
// No OTel counter here: it would be redundant with wasm_contract_query_smart_duration's
127-
// count, which is recorded unconditionally on every QuerySmart call just like this one.
128-
// TODO(PLT-910): remove once wasm_contract_query_smart_duration verified
129-
telemetry.IncrCounterWithLabels(
130-
[]string{"wasm", "contract", "query-smart", "invocation"},
131-
1,
132-
[]metrics.Label{telemetry.NewLabel("contract_address", contractAddress)},
133-
)
134-
}
135-
136-
func recordContractQuerySmartGasUsed(ctx context.Context, contractAddress string, gasUsed uint64) {
137-
// contract_address omitted on the OTel histogram: unlike the legacy Prometheus sink, the
138-
// OTel SDK has no series expiration, so a per-contract label here would retain one series
139-
// per distinct contract address queried for the process lifetime.
111+
func recordContractQuerySmartGasUsed(ctx context.Context, gasUsed uint64) {
140112
wasmKeeperMetrics.contractQuerySmartGasUsed.Record(ctx, int64(gasUsed)) //nolint:gosec
141-
// TODO(PLT-910): remove once wasm_contract_query_smart_gas_used verified
142-
telemetry.SetGaugeWithLabels(
143-
[]string{"wasm", "contract", "query-smart", "gas-used"},
144-
float32(gasUsed),
145-
[]metrics.Label{telemetry.NewLabel("contract_address", contractAddress)},
146-
)
147113
}
148114

149115
const (

‎sei-wasmd/x/wasm/keeper/msg_server.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package keeper
22

33
import (
44
"context"
5-
"time"
65

7-
"github.com/armon/go-metrics"
86
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
97
sdkerrors "github.com/sei-protocol/sei-chain/sei-cosmos/types/errors"
108

@@ -85,11 +83,6 @@ func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteC
8583
if err != nil {
8684
return nil, sdkerrors.Wrap(err, "contract")
8785
}
88-
defer metrics.MeasureSinceWithLabels(
89-
[]string{"wasmd", "execute", "contract", "latency"},
90-
time.Now(),
91-
[]metrics.Label{{Name: "contract", Value: contractAddr.String()}},
92-
)
9386

9487
ctx.EventManager().EmitEvent(sdk.NewEvent(
9588
sdk.EventTypeMessage,

0 commit comments

Comments
 (0)