-
Notifications
You must be signed in to change notification settings - Fork 5
feat(logpoller): use shared framework metrics where applicable #632
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,9 +34,20 @@ func (o *ObservedLogStore) SaveLogs(ctx context.Context, logs []models.Log, batc | |||||||||||||
| start := time.Now() | ||||||||||||||
| count, err := o.LogStore.SaveLogs(ctx, logs, batchInsertSize, minBatchSize) | ||||||||||||||
|
|
||||||||||||||
| o.metrics.RecordQueryDuration(ctx, "SaveLogs", frameworkmetrics.Create, time.Since(start)) | ||||||||||||||
| o.metrics.frameworkMetrics.RecordQueryDuration(ctx, "SaveLogs", frameworkmetrics.Create, time.Since(start).Seconds()) | ||||||||||||||
| if err == nil && count > 0 { | ||||||||||||||
| o.metrics.AddLogsInserted(ctx, count) | ||||||||||||||
| o.metrics.frameworkMetrics.IncrementLogsInserted(ctx, count) | ||||||||||||||
|
|
||||||||||||||
| // Record discovery latency using the newest log's TxTimestamp. | ||||||||||||||
| // TxTimestamp is set from tx.Transaction.Now (uint32 Unix seconds) during parsing. | ||||||||||||||
| // Latency = wall clock now - transaction timestamp, in seconds. | ||||||||||||||
| newestTimestamp := logs[0].TxTimestamp | ||||||||||||||
| for _, l := range logs[1:] { | ||||||||||||||
| if l.TxTimestamp.After(newestTimestamp) { | ||||||||||||||
| newestTimestamp = l.TxTimestamp | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| o.metrics.frameworkMetrics.RecordLogDiscoveryLatency(ctx, time.Since(newestTimestamp).Seconds()) | ||||||||||||||
|
||||||||||||||
| o.metrics.frameworkMetrics.RecordLogDiscoveryLatency(ctx, time.Since(newestTimestamp).Seconds()) | |
| latency := time.Since(newestTimestamp) | |
| if latency < 0 { | |
| latency = 0 | |
| } | |
| o.metrics.frameworkMetrics.RecordLogDiscoveryLatency(ctx, latency.Seconds()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -288,7 +288,6 @@ func (lp *service) run(ctx context.Context) (err error) { | |
|
|
||
| lp.lastProcessedBlockSeqNo = blockRange.ToSeqNo() | ||
| lp.metrics.SetLastProcessedBlock(ctx, lp.lastProcessedBlockSeqNo) | ||
| lp.metrics.AddBlocksProcessed(ctx, int64(blockRange.ToSeqNo()-blockRange.FromSeqNo())) | ||
|
|
||
|
Comment on lines
289
to
291
|
||
| return nil | ||
| } | ||
|
|
||
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.
This change removes several Prometheus/OTel query and ingestion metrics (e.g.
ton_logpoller_query_duration_seconds,ton_logpoller_query_result_size, and the logs/blocks processed counters) from this package. That is an operationally breaking change for any existing dashboards/alerts scraping theton_logpoller_*series; consider keeping backward-compatible aliases during a deprecation window or documenting the metric renames/removals as part of the rollout.