Ignore metric when emitter or destination chains are unset (#390)
This commit is contained in:
parent
b02d602b14
commit
444c185f38
|
@ -10,11 +10,13 @@ require (
|
|||
github.com/gofiber/fiber/v2 v2.42.0
|
||||
github.com/influxdata/influxdb-client-go/v2 v2.12.2
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/sethvargo/go-envconfig v0.9.0
|
||||
github.com/shopspring/decimal v1.3.1
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/wormhole-foundation/wormhole-explorer/common v0.0.0-00010101000000-000000000000
|
||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20230426150516-e695fad0bed8
|
||||
go.mongodb.org/mongo-driver v1.11.2
|
||||
go.uber.org/zap v1.24.0
|
||||
)
|
||||
|
||||
|
@ -60,7 +62,6 @@ require (
|
|||
github.com/xdg-go/scram v1.1.1 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.3 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||
go.mongodb.org/mongo-driver v1.11.2 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
|
||||
|
|
|
@ -112,6 +112,8 @@ github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWV
|
|||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
||||
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
|
||||
|
|
|
@ -261,6 +261,17 @@ func MakePointForVaaVolume(params *MakePointForVaaVolumeParams) (*write.Point, e
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
// Do not generate this metric when the emitter chain is unset
|
||||
if params.Vaa.EmitterChain.String() == sdk.ChainIDUnset.String() {
|
||||
if params.Logger != nil {
|
||||
params.Logger.Warn("emitter chain is unset",
|
||||
zap.String("vaaId", params.Vaa.MessageID()),
|
||||
zap.Uint16("emitterChain", uint16(params.Vaa.EmitterChain)),
|
||||
)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
const measurement = "vaa_volume"
|
||||
|
||||
// Decode the VAA payload
|
||||
|
@ -269,6 +280,17 @@ func MakePointForVaaVolume(params *MakePointForVaaVolumeParams) (*write.Point, e
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
// Do not generate this metric when the target chain is unset
|
||||
if payload.TargetChain.String() == sdk.ChainIDUnset.String() {
|
||||
if params.Logger != nil {
|
||||
params.Logger.Warn("target chain is unset",
|
||||
zap.String("vaaId", params.Vaa.MessageID()),
|
||||
zap.Uint16("targetChain", uint16(payload.TargetChain)),
|
||||
)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Create a data point
|
||||
point := influxdb2.NewPointWithMeasurement(measurement).
|
||||
// This is always set to the portal token bridge app ID, but we may have other apps in the future
|
||||
|
|
Loading…
Reference in New Issue