Cherry-pick Prometheus per-query metrics to release#1135
Draft
justinfrevert wants to merge 1 commit intorelease/node-0.22.4-bfrom
Draft
Cherry-pick Prometheus per-query metrics to release#1135justinfrevert wants to merge 1 commit intorelease/node-0.22.4-bfrom
justinfrevert wants to merge 1 commit intorelease/node-0.22.4-bfrom
Conversation
…22100] (#904) * feat: add Prometheus per-query metrics to midnight data sources Introduce MidnightDataSourceMetrics with public accessor methods, replacing the upstream McFollowerMetrics whose accessors are crate-private in partner-chains v1.8.1. The local observed_async_trait! macro now records call counts and timing histograms for all six midnight-specific data source methods (candidates, cnight observation, federated authority observation). JIRA: PM-22100 Made-with: Cursor * ci: normalise scan job name (#823) * update scanner action to latest version Signed-off-by: Giles Cope <gilescope@gmail.com> * update scanner action to latest version Signed-off-by: Giles Cope <gilescope@gmail.com> * ci: rename workflow name from build to scan Signed-off-by: Giles Cope <gilescope@gmail.com> --------- Signed-off-by: Giles Cope <gilescope@gmail.com> * chore: add change file for PM-22100 dbsync query metrics Made-with: Cursor * feat: add sub-query SQL-level Prometheus timing for midnight data sources Add individual Prometheus timing histograms for each SQL query inside midnight-node data source methods. This provides per-query latency visibility alongside the existing method-level timing, enabling precise identification of slow DBSync queries on mainnet. 13 sub-query timers added across 3 data sources: - cNight observation: 5 queries (block lookup + 4 concurrent UTXO queries) - Federated authority: 3 queries (block lookup + 2 governance UTXOs) - Candidates: 5 queries across 3 methods Ref: PM-22100 Made-with: Cursor * refactor: extract sub-query timer helper to reduce repetition Replace 13 inline timer patterns with a shared start_sub_query_timer() helper and SubQueryTimer RAII guard in the metrics module. Each call site reduces from 3 lines to 1. Made-with: Cursor * refactor: remove method-level timing, keep SQL-level sub-query timers only Remove the observed_async_trait! macro timing (method-level) since per-SQL-query timing provides more useful granularity. Simplify MidnightDataSourceMetrics to histogram-only (remove unused call counter). Rename metric to midnight_data_source_query_time_elapsed with query_name label for clarity. Made-with: Cursor * style: apply rustfmt to candidates data source Made-with: Cursor * chore: update changes file to reflect SQL-level sub-query timing Made-with: Cursor --------- Signed-off-by: Giles Cope <gilescope@gmail.com> Co-authored-by: Squirrel <giles.cope@shielded.io>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…22100] (#904)
Introduce MidnightDataSourceMetrics with public accessor methods, replacing the upstream McFollowerMetrics whose accessors are crate-private in partner-chains v1.8.1. The local observed_async_trait! macro now records call counts and timing histograms for all six midnight-specific data source methods (candidates, cnight observation, federated authority observation).
JIRA: PM-22100
Made-with: Cursor
ci: normalise scan job name (ci: normalise scan job name #823)
update scanner action to latest version
update scanner action to latest version
ci: rename workflow name from build to scan
Made-with: Cursor
Add individual Prometheus timing histograms for each SQL query inside midnight-node data source methods. This provides per-query latency visibility alongside the existing method-level timing, enabling precise identification of slow DBSync queries on mainnet.
13 sub-query timers added across 3 data sources:
Ref: PM-22100
Made-with: Cursor
Replace 13 inline timer patterns with a shared start_sub_query_timer() helper and SubQueryTimer RAII guard in the metrics module. Each call site reduces from 3 lines to 1.
Made-with: Cursor
Remove the observed_async_trait! macro timing (method-level) since per-SQL-query timing provides more useful granularity. Simplify MidnightDataSourceMetrics to histogram-only (remove unused call counter). Rename metric to midnight_data_source_query_time_elapsed with query_name label for clarity.
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Overview
🗹 TODO before merging
📌 Submission Checklist
🧪 Testing Evidence
Please describe any additional testing aside from CI:
🔱 Fork Strategy
Links