Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1f6be5b

Browse files
authoredMar 21, 2023
Fixed two bugs related to metrics (celestiaorg#562)
* Fix metrics bug * Fix metrics for vote extensions * Activate prometheus on ci.toml * Set up metric-related scripts
1 parent 2071c6c commit 1f6be5b

File tree

6 files changed

+23
-21
lines changed

6 files changed

+23
-21
lines changed
 

‎consensus/metrics.gen.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎consensus/metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type Metrics struct {
9494
// VoteExtensionReceiveCount is the number of vote extensions received by this
9595
// node. The metric is annotated by the status of the vote extension from the
9696
// application, either 'accepted' or 'rejected'.
97-
VoteExtensionReceiveCount metrics.Counter
97+
VoteExtensionReceiveCount metrics.Counter `metrics_labels:"status"`
9898

9999
// ProposalReceiveCount is the total number of proposals received by this node
100100
// since process start.

‎proxy/app_conn.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -74,38 +74,38 @@ func (app *appConnConsensus) Error() error {
7474
}
7575

7676
func (app *appConnConsensus) InitChain(ctx context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error) {
77-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "init_chain"))()
77+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "init_chain", "type", "sync"))()
7878
return app.appConn.InitChain(ctx, req)
7979
}
8080

8181
func (app *appConnConsensus) PrepareProposal(ctx context.Context,
8282
req *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error) {
83-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "prepare_proposal"))()
83+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "prepare_proposal", "type", "sync"))()
8484
return app.appConn.PrepareProposal(ctx, req)
8585
}
8686

8787
func (app *appConnConsensus) ProcessProposal(ctx context.Context, req *types.RequestProcessProposal) (*types.ResponseProcessProposal, error) {
88-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "process_proposal"))()
88+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "process_proposal", "type", "sync"))()
8989
return app.appConn.ProcessProposal(ctx, req)
9090
}
9191

9292
func (app *appConnConsensus) ExtendVote(ctx context.Context, req *types.RequestExtendVote) (*types.ResponseExtendVote, error) {
93-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "extend_vote"))()
93+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "extend_vote", "type", "sync"))()
9494
return app.appConn.ExtendVote(ctx, req)
9595
}
9696

9797
func (app *appConnConsensus) VerifyVoteExtension(ctx context.Context, req *types.RequestVerifyVoteExtension) (*types.ResponseVerifyVoteExtension, error) {
98-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "verify_vote_extension"))()
98+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "verify_vote_extension", "type", "sync"))()
9999
return app.appConn.VerifyVoteExtension(ctx, req)
100100
}
101101

102102
func (app *appConnConsensus) FinalizeBlock(ctx context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error) {
103-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "finalize_block"))()
103+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "finalize_block", "type", "sync"))()
104104
return app.appConn.FinalizeBlock(ctx, req)
105105
}
106106

107107
func (app *appConnConsensus) Commit(ctx context.Context) (*types.ResponseCommit, error) {
108-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "commit"))()
108+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "commit", "type", "sync"))()
109109
return app.appConn.Commit(ctx, &types.RequestCommit{})
110110
}
111111

@@ -133,7 +133,7 @@ func (app *appConnMempool) Error() error {
133133
}
134134

135135
func (app *appConnMempool) Flush(ctx context.Context) error {
136-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "flush"))()
136+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "flush", "type", "sync"))()
137137
return app.appConn.Flush(ctx)
138138
}
139139

@@ -167,17 +167,17 @@ func (app *appConnQuery) Error() error {
167167
}
168168

169169
func (app *appConnQuery) Echo(ctx context.Context, msg string) (*types.ResponseEcho, error) {
170-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "echo"))()
170+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "echo", "type", "sync"))()
171171
return app.appConn.Echo(ctx, msg)
172172
}
173173

174174
func (app *appConnQuery) Info(ctx context.Context, req *types.RequestInfo) (*types.ResponseInfo, error) {
175-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "info"))()
175+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "info", "type", "sync"))()
176176
return app.appConn.Info(ctx, req)
177177
}
178178

179179
func (app *appConnQuery) Query(ctx context.Context, req *types.RequestQuery) (*types.ResponseQuery, error) {
180-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "query"))()
180+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "query", "type", "sync"))()
181181
return app.appConn.Query(ctx, req)
182182
}
183183

@@ -201,22 +201,22 @@ func (app *appConnSnapshot) Error() error {
201201
}
202202

203203
func (app *appConnSnapshot) ListSnapshots(ctx context.Context, req *types.RequestListSnapshots) (*types.ResponseListSnapshots, error) {
204-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "list_snapshots"))()
204+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "list_snapshots", "type", "sync"))()
205205
return app.appConn.ListSnapshots(ctx, req)
206206
}
207207

208208
func (app *appConnSnapshot) OfferSnapshot(ctx context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error) {
209-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "offer_snapshot"))()
209+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "offer_snapshot", "type", "sync"))()
210210
return app.appConn.OfferSnapshot(ctx, req)
211211
}
212212

213213
func (app *appConnSnapshot) LoadSnapshotChunk(ctx context.Context, req *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error) {
214-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "load_snapshot_chunk"))()
214+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "load_snapshot_chunk", "type", "sync"))()
215215
return app.appConn.LoadSnapshotChunk(ctx, req)
216216
}
217217

218218
func (app *appConnSnapshot) ApplySnapshotChunk(ctx context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) {
219-
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "apply_snapshot_chunk"))()
219+
defer addTimeSample(app.metrics.MethodTimingSeconds.With("method", "apply_snapshot_chunk", "type", "sync"))()
220220
return app.appConn.ApplySnapshotChunk(ctx, req)
221221
}
222222

‎scripts/qa/reporting/latency_plotter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import numpy as np
1010
import pandas as pd
1111

12-
release = 'v0.37.x-alpha3'
12+
release = 'abci++vef_Smoke'
1313

1414
#FIXME: figure out in which timezone prometheus was running to adjust to UTC.
1515
tz = pytz.timezone('America/Sao_Paulo')

‎scripts/qa/reporting/prometheus_plotter.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#left_end = '2023-02-07T18:07:00Z' #homogeneous
3333
#left_end = '2022-10-13T19:41:23Z' #baseline
3434
#left_end = '2023-02-22T18:56:29Z' #CMT 0.37.x-alpha3
35-
left_end = '2022-10-13T15:57:50Z' #TM v0.37 (200 nodes) baseline
35+
#left_end = '2022-10-13T15:57:50Z' #TM v0.37 (200 nodes) baseline
36+
left_end = '2023-03-20T19:45:35Z' #feature/abci++vef merged with main (7d8c9d426)
3637

3738
right_end = pd.to_datetime(left_end) + pd.Timedelta(**window_size)
3839
time_window = (left_end, right_end.strftime('%Y-%m-%dT%H:%M:%SZ'))
@@ -42,8 +43,8 @@
4243

4344

4445

45-
#fork='cometbft'
46-
fork='tendermint'
46+
fork='cometbft'
47+
#fork='tendermint'
4748

4849
# Do prometheus queries
4950
queries = [

‎test/e2e/networks/ci.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ process_proposal_delay = "100ms"
1111
check_tx_delay = "0ms"
1212
# The most common case (e.g. Cosmos SDK-based chains).
1313
abci_protocol = "builtin"
14+
prometheus = true
1415

1516
[validators]
1617
validator01 = 100

0 commit comments

Comments
 (0)
Please sign in to comment.