-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Off-Chain, Scalability] Query client caching & history #985
Changes from all commits
0ba527a
af418e7
6df478a
0e5b214
4f989a1
b4beeed
12e3dd3
d7e6a10
f25bcc5
c8af216
3d98b18
9388489
aadbd8f
cdf11f8
16acda7
b07a8b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,13 @@ func (b *blockReplayClient) queryLatestBlock( | |
errCh := make(chan error) | ||
|
||
go func() { | ||
// TODO_IN_THIS_COMMIT: extract labels (and values?) to constants. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [linter-name (fail-on-found)] reported by reviewdog 🐶 |
||
defer client.AllQueriesTotalCounter.With( | ||
"method", "block", | ||
"client_type", "block", | ||
"msg_type", "", | ||
).Add(1) | ||
|
||
queryBlockResult, err := b.onStartQueryClient.Block(ctx, nil) | ||
if err != nil { | ||
errCh <- err | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package client | ||
|
||
import ( | ||
"github.com/go-kit/kit/metrics/prometheus" | ||
stdprometheus "github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
const ( | ||
clientSubsystem = "client" | ||
|
||
allQueriesTotal = "all_queries_total" | ||
paramsQueriesTotal = "params_queries_total" | ||
) | ||
|
||
var ( | ||
// TODO_IN_THIS_COMMIT: godoc... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [linter-name (fail-on-found)] reported by reviewdog 🐶 |
||
AllQueriesTotalCounter = prometheus.NewCounterFrom(stdprometheus.CounterOpts{ | ||
Subsystem: clientSubsystem, | ||
Name: allQueriesTotal, | ||
Help: "Total number of all query messages, of any type, sent by the client.", | ||
// TODO_IN_THIS_COMMIT: extract labels to constants. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [linter-name (fail-on-found)] reported by reviewdog 🐶 |
||
//}, []string{"client_type", "method", "msg_type", "claim_proof_lifecycle_stage"}) | ||
}, []string{"client_type", "method", "msg_type"}) | ||
|
||
// TODO_IN_THIS_COMMIT: godoc... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [linter-name (fail-on-found)] reported by reviewdog 🐶 |
||
ParamsQueriesTotalCounter = prometheus.NewCounterFrom(stdprometheus.CounterOpts{ | ||
Subsystem: clientSubsystem, | ||
Name: paramsQueriesTotal, | ||
Help: "Total number of QueryParamsRequest messages sent by the client.", | ||
}, []string{"client_type", "method", "claim_proof_lifecycle_stage"}) | ||
|
||
// TODO_IN_THIS_COMMIT: godoc & use... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [linter-name (fail-on-found)] reported by reviewdog 🐶 |
||
AllWebsocketEventsTotalCounter = prometheus.NewCounterFrom(stdprometheus.CounterOpts{ | ||
Subsystem: clientSubsystem, | ||
Name: "all_websocket_events_total", | ||
Help: "Total number of websocket events received by the client.", | ||
}, []string{"client_type", "event_type"}) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package cache | ||
|
||
// TODO_UP_NEXT(@bryanchriswhite): Implement a persistent cache using badger. | ||
// | ||
// var _ query.QueryCache[any] = (*BadgerCache[any])(nil) | ||
|
||
// BadgerCache is a persistent cache backed by a badger database. | ||
type BadgerCache[T any] struct { | ||
// db *badger.DB | ||
// config CacheConfig | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert