-
Notifications
You must be signed in to change notification settings - Fork 23
PLEX-2791 Improve LogPoller Heath Observability #436
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
Open
dhaidashenko
wants to merge
21
commits into
develop
Choose a base branch
from
fix/PLEX-2791-N-06-improve-lp-health-observability
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b65f4ab
Test: reorg during replay
dhaidashenko 64e2c63
Fix reorg handling during replay
dhaidashenko ccc00f8
Fix nits
dhaidashenko a6119cf
ORM methods to batch insert
dhaidashenko 5195851
switch to batch logs/blocks inserts
dhaidashenko 715d9ba
nit fixes
dhaidashenko cc16600
switch ubig to sqlutil big
dhaidashenko 60ed9da
fix orm_test
dhaidashenko 7667a4d
Refactor tests in preparation for sparse blocks
dhaidashenko c681f60
Store only blocks with logs and checkpoints
dhaidashenko cd25239
Add feature flag to disable/enable sparse blocks storage
dhaidashenko dea1935
Fix Replay Reorg Detection Bypassed When Parent Block Is Missing
dhaidashenko 7092abc
Fix flaky test
dhaidashenko 8d2ba50
Improve backfill tests
dhaidashenko 385692e
Fix false clearing of finality violation error in case of termproary …
dhaidashenko ef8d1cd
L-03 document findBlockAfterLCA behavior
dhaidashenko fd3bc34
L-05 Ensure finality violation is detected even in cases of empty fin…
dhaidashenko fce5cb3
Test to ensure finality violation is detected
dhaidashenko 8df19b6
PLEX-2791 N-06 Improve LogPoller Heath Observability
dhaidashenko 377491d
Merge develop
dhaidashenko 4274b06
fix err shadow declaration
dhaidashenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package logpoller | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/prometheus/client_golang/prometheus" | ||
| "github.com/prometheus/client_golang/prometheus/promauto" | ||
| "go.opentelemetry.io/otel/attribute" | ||
| "go.opentelemetry.io/otel/metric" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-common/pkg/beholder" | ||
| ) | ||
|
|
||
| var ( | ||
| promLpLastProcessedBlock = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||
| Name: "evm_log_poller_last_processed_block", | ||
| Help: "The last block that the log poller has processed. Main purpose is to signal if the log poller is stuck and not processing new blocks. May be reported with a delay.", | ||
| }, []string{"chainFamily", "chainID"}) | ||
| ) | ||
|
|
||
| type Metrics interface { | ||
| RecordLastProcessedBlock(ctx context.Context, lastProcessedBlock int64) | ||
| } | ||
|
|
||
| var _ Metrics = (*PromBeholderMetrics)(nil) | ||
|
|
||
| type PromBeholderMetrics struct { | ||
| chainID string | ||
| chainFamily string | ||
| lastProcessedBlock metric.Int64Gauge | ||
| } | ||
|
|
||
| func NewPromBeholderMetrics(chainID string, chainFamily string) (*PromBeholderMetrics, error) { | ||
| lastProcessedBlock, err := beholder.GetMeter().Int64Gauge("evm_log_poller_last_processed_block") | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to register last processed block metric: %w", err) | ||
| } | ||
|
|
||
| return &PromBeholderMetrics{ | ||
| chainID: chainID, | ||
| chainFamily: chainFamily, | ||
| lastProcessedBlock: lastProcessedBlock, | ||
| }, nil | ||
| } | ||
|
|
||
| func (m *PromBeholderMetrics) RecordLastProcessedBlock(ctx context.Context, lastProcessedBlock int64) { | ||
| promLpLastProcessedBlock.WithLabelValues(m.chainFamily, m.chainID).Set(float64(lastProcessedBlock)) | ||
| m.lastProcessedBlock.Record(ctx, lastProcessedBlock, metric.WithAttributes( | ||
| attribute.String("chainFamily", m.chainFamily), | ||
| attribute.String("chainID", m.chainID))) | ||
| } | ||
|
|
||
| var _ Metrics = (*noopMetrics)(nil) | ||
|
|
||
| var NoopMetrics = &noopMetrics{} | ||
|
|
||
| type noopMetrics struct{} | ||
|
|
||
| func (m *noopMetrics) RecordLastProcessedBlock(_ context.Context, _ int64) {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.