Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ease-of-merge-linter-…
Browse files Browse the repository at this point in the history
…autofixes
  • Loading branch information
faddat committed Aug 30, 2023
2 parents 9fc6864 + 78b5af2 commit e937318
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proto-buf-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3.6.0
- uses: bufbuild/buf-setup-action@v1.26.1

# lint checks
Expand Down
3 changes: 3 additions & 0 deletions x/wasm/keeper/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type WasmVMMetricsCollector struct {

// NewWasmVMMetricsCollector constructor
func NewWasmVMMetricsCollector(s metricSource) *WasmVMMetricsCollector {
if s == nil {
panic("wasmvm instance must not be nil")
}
return &WasmVMMetricsCollector{
source: s,
CacheHitsDescr: prometheus.NewDesc("wasmvm_cache_hits_total", "Total number of cache hits", []string{"type"}, nil),
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/keeper/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func WithAccountPruner(x AccountPruner) Option {
}

func WithVMCacheMetrics(r prometheus.Registerer) Option {
return optsFn(func(k *Keeper) {
return postOptsFn(func(k *Keeper) {
NewWasmVMMetricsCollector(k.wasmVM).Register(r)
})
}
Expand Down
10 changes: 10 additions & 0 deletions x/wasm/keeper/options_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
"github.com/prometheus/client_golang/prometheus"
"reflect"
"testing"

Expand Down Expand Up @@ -37,6 +38,15 @@ func TestConstructorOptions(t *testing.T) {
assert.IsType(t, &wasmtesting.MockWasmer{}, k.wasmVM)
},
},
"vm cache metrics": {
srcOpt: WithVMCacheMetrics(prometheus.DefaultRegisterer),
verify: func(t *testing.T, k Keeper) {
t.Helper()
registered := prometheus.DefaultRegisterer.Unregister(NewWasmVMMetricsCollector(k.wasmVM))
assert.True(t, registered)
},
isPostOpt: true,
},
"decorate wasmvm": {
srcOpt: WithWasmEngineDecorator(func(old types.WasmerEngine) types.WasmerEngine {
require.IsType(t, &wasmvm.VM{}, old)
Expand Down

0 comments on commit e937318

Please sign in to comment.