Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add total block size for prometheus #183

Closed
wants to merge 1 commit into from
Closed
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
21 changes: 15 additions & 6 deletions consensus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type Metrics struct {
BlockSizeBytes metrics.Gauge
// Total number of transactions.
TotalTxs metrics.Gauge
// Total byte-size of blocks.
TotalBlockSizeBytes metrics.Counter
// The latest block height.
CommittedHeight metrics.Gauge
// Whether or not a node is fast syncing. 1 if yes, 0 if no.
Expand Down Expand Up @@ -197,6 +199,12 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
Name: "total_txs",
Help: "Total number of transactions.",
}, labels).With(labelsAndValues...),
TotalBlockSizeBytes: prometheus.NewCounterFrom(stdprometheus.CounterOpts{
Namespace: namespace,
Subsystem: MetricsSubsystem,
Name: "total_block_size_bytes",
Help: "Total byte-size of blocks since process startup.",
}, labels).With(labelsAndValues...),
CommittedHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{
Namespace: namespace,
Subsystem: MetricsSubsystem,
Expand Down Expand Up @@ -323,12 +331,13 @@ func NopMetrics() *Metrics {

BlockIntervalSeconds: discard.NewGauge(),

NumTxs: discard.NewGauge(),
BlockSizeBytes: discard.NewGauge(),
TotalTxs: discard.NewGauge(),
CommittedHeight: discard.NewGauge(),
FastSyncing: discard.NewGauge(),
BlockParts: discard.NewCounter(),
NumTxs: discard.NewGauge(),
BlockSizeBytes: discard.NewGauge(),
TotalTxs: discard.NewGauge(),
TotalBlockSizeBytes: discard.NewCounter(),
CommittedHeight: discard.NewGauge(),
FastSyncing: discard.NewGauge(),
BlockParts: discard.NewCounter(),

MissingProposal: discard.NewGauge(),
RoundFailures: discard.NewHistogram(),
Expand Down
1 change: 1 addition & 0 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ func (cs *State) recordMetrics(height int64, block *types.Block) {
cs.metrics.NumTxs.Set(float64(len(block.Data.Txs)))
cs.metrics.TotalTxs.Add(float64(len(block.Data.Txs)))
cs.metrics.BlockSizeBytes.Set(float64(block.Size()))
cs.metrics.TotalBlockSizeBytes.Add(float64(block.Size()))
cs.metrics.CommittedHeight.Set(float64(block.Height))

cs.metrics.RoundFailures.Observe(float64(cs.Round))
Expand Down
18 changes: 11 additions & 7 deletions docker_push.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/bin/bash

make build-docker
LINE_VERSION="$(awk -F\" '/LINECoreSemVer =/ {print $2; exit }' < ./version/version.go)"
TM_VERSION="$(awk -F\" '/TMCoreSemVer *=/ {print $2; exit }' < ./version/version.go)"
LINE_VERSION="$(awk -F\" '/LINECoreSemVer *=/ {print $2; exit }' < ./version/version.go)"
DATE_VERSION="`date "+%y%m%d"`"
GIT_COMMIT="$(git rev-parse --short=8 HEAD)"
TAG=docker-registry.linecorp.com/link-network/tendermint:latest
docker tag tendermint/tendermint:latest $TAG

read -p "==> Do you push docker image to [$TAG]? (y/n) " -n 1 -r
TAG=${TM_VERSION}_${LINE_VERSION}-${DATE_VERSION}-${GIT_COMMIT}
docker tag tendermint/tendermint:latest docker-registry.linecorp.com/link-network/tendermint:$TAG
echo "New tendermint version: $TAG"

read -p "==> Do you push docker image to repository as [$TAG]? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker push $TAG
docker push docker-registry.linecorp.com/link-network/tendermint:latest
docker push docker-registry.linecorp.com/link-network/tendermint:$TAG
fi

1 change: 1 addition & 0 deletions types/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/bls"
"github.com/tendermint/tendermint/crypto/composite"
Expand Down
1 change: 1 addition & 0 deletions types/evidence.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/pkg/errors"
amino "github.com/tendermint/go-amino"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
cryptoenc "github.com/tendermint/tendermint/crypto/encoding"
Expand Down
1 change: 1 addition & 0 deletions types/evidence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/libs/rand"
Expand Down