Skip to content
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

add metrics to services #1267

Closed
wants to merge 2 commits into from

Conversation

leviathanbeak
Copy link
Contributor

closes #1168

I added metrics to each run() method of RunnableTask implementor.

Improvement: this could be hidden behind metrics feature?

@leviathanbeak leviathanbeak self-assigned this Jul 28, 2023
@@ -180,6 +182,8 @@ where
D: P2pDb + 'static,
{
async fn run(&mut self, watcher: &mut StateWatcher) -> anyhow::Result<bool> {
let start = Instant::now();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that possible to move it to ServiceRunner and have it for each service?
image

@@ -53,6 +60,8 @@ impl SyncHeights {
/// Sync the state from the height stream.
/// This stream never blocks or errors.
pub(crate) async fn sync(&mut self) -> Option<()> {
let start = ServiceMetrics::instant();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It measures busy and idle time together, we want to know about both independently.

self.import_inner(shutdown).await?;

IMPORT_METRICS.observe(start);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each service may have the instance inside of ServiceRunner and you don't need to use lazy=)

@xgreenx xgreenx assigned xgreenx and unassigned leviathanbeak Aug 7, 2023
@xgreenx
Copy link
Collaborator

xgreenx commented Aug 9, 2023

Clsoe in favor of #1284

@xgreenx xgreenx closed this Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance metrics for each service
2 participants