From 44e6ccaf2fe9fc502d91ab3f21fb4384969e6446 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Sun, 10 Oct 2021 01:18:26 -0500 Subject: [PATCH 1/2] Remove more telemetry ops, update docs --- docs/core/telemetry.md | 8 -------- store/cachekv/store.go | 3 --- store/gaskv/store.go | 3 --- 3 files changed, 14 deletions(-) diff --git a/docs/core/telemetry.md b/docs/core/telemetry.md index 9e434eef2bec..11c31413748e 100644 --- a/docs/core/telemetry.md +++ b/docs/core/telemetry.md @@ -131,14 +131,6 @@ The following examples expose too much cardinality and may not even prove to be | `store_iavl_delete` | Duration of an IAVL `Store#Delete` call | ms | summary | | `store_iavl_commit` | Duration of an IAVL `Store#Commit` call | ms | summary | | `store_iavl_query` | Duration of an IAVL `Store#Query` call | ms | summary | -| `store_gaskv_get` | Duration of a GasKV `Store#Get` call | ms | summary | -| `store_gaskv_set` | Duration of a GasKV `Store#Set` call | ms | summary | -| `store_gaskv_has` | Duration of a GasKV `Store#Has` call | ms | summary | -| `store_gaskv_delete` | Duration of a GasKV `Store#Delete` call | ms | summary | -| `store_cachekv_get` | Duration of a CacheKV `Store#Get` call | ms | summary | -| `store_cachekv_set` | Duration of a CacheKV `Store#Set` call | ms | summary | -| `store_cachekv_write` | Duration of a CacheKV `Store#Write` call | ms | summary | -| `store_cachekv_delete` | Duration of a CacheKV `Store#Delete` call | ms | summary | ## Next {hide} diff --git a/store/cachekv/store.go b/store/cachekv/store.go index 799805c2ae1f..3a706afb246e 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/listenkv" "github.com/cosmos/cosmos-sdk/store/tracekv" "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/telemetry" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -91,7 +90,6 @@ func (store *Store) Has(key []byte) bool { func (store *Store) Delete(key []byte) { store.mtx.Lock() defer store.mtx.Unlock() - defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "delete") types.AssertValidKey(key) store.setCacheValue(key, nil, true, true) @@ -101,7 +99,6 @@ func (store *Store) Delete(key []byte) { func (store *Store) Write() { store.mtx.Lock() defer store.mtx.Unlock() - defer telemetry.MeasureSince(time.Now(), "store", "cachekv", "write") // We need a copy of all of the keys. // Not the best, but probably not a bottleneck depending. diff --git a/store/gaskv/store.go b/store/gaskv/store.go index 182b04e07c67..31e2ce32e68f 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -5,7 +5,6 @@ import ( "time" "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/telemetry" ) var _ types.KVStore = &Store{} @@ -58,14 +57,12 @@ func (gs *Store) Set(key []byte, value []byte) { // Implements KVStore. func (gs *Store) Has(key []byte) bool { - defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "has") gs.gasMeter.ConsumeGas(gs.gasConfig.HasCost, types.GasHasDesc) return gs.parent.Has(key) } // Implements KVStore. func (gs *Store) Delete(key []byte) { - defer telemetry.MeasureSince(time.Now(), "store", "gaskv", "delete") // charge gas to prevent certain attack vectors even though space is being freed gs.gasMeter.ConsumeGas(gs.gasConfig.DeleteCost, types.GasDeleteDesc) gs.parent.Delete(key) From fcdeccc08eb4ad6ae647cb8e8ebe330f9cc57c23 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Sun, 10 Oct 2021 01:23:12 -0500 Subject: [PATCH 2/2] Update imports & changelog --- CHANGELOG.md | 2 +- store/cachekv/store.go | 1 - store/gaskv/store.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faf09150246d..b159a9269a21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * `MkConsKeyOutput` * `MkValKeyOutput` * `MkAccKeyOutput` -* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077) Remove telemetry on `GasKV` and `CacheKV` store Get/Set operations, significantly improving their performance. +* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077),[\#10334](https://github.com/cosmos/cosmos-sdk/pull/10334) Remove telemetry on `GasKV` and `CacheKV` store operations, significantly improving their performance. * [\#10022](https://github.com/cosmos/cosmos-sdk/pull/10022) `AuthKeeper` interface in `x/auth` now includes a function `HasAccount`. * [\#9759](https://github.com/cosmos/cosmos-sdk/pull/9759) `NewAccountKeeeper` in `x/auth` now takes an additional `bech32Prefix` argument that represents `sdk.Bech32MainPrefix`. * [\#9628](https://github.com/cosmos/cosmos-sdk/pull/9628) Rename `x/{mod}/legacy` to `x/{mod}/migrations`. diff --git a/store/cachekv/store.go b/store/cachekv/store.go index 3a706afb246e..221a96e679a4 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -5,7 +5,6 @@ import ( "io" "sort" "sync" - "time" dbm "github.com/tendermint/tm-db" diff --git a/store/gaskv/store.go b/store/gaskv/store.go index 31e2ce32e68f..845e59cf9363 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -2,7 +2,6 @@ package gaskv import ( "io" - "time" "github.com/cosmos/cosmos-sdk/store/types" )