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 counter for finished spawned tasks #4481

Merged
merged 3 commits into from
Sep 6, 2023

Conversation

alessandromazza98
Copy link
Contributor

Closes #4479

I add two fields to TaskExecutorMetrics:

  • finished_critical_tasks
  • finished_regular_tasks

And then updates the spawn and spawn_critical functions in order to properly increase finished critical and regular tasks metrics as well.

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Merging #4481 (a99eaf7) into main (d2647dc) will increase coverage by 0.00%.
Report is 13 commits behind head on main.
The diff coverage is 90.90%.

Impacted file tree graph

Files Changed Coverage Δ
crates/tasks/src/metrics.rs 57.14% <85.71%> (+32.14%) ⬆️
crates/tasks/src/lib.rs 66.79% <93.33%> (+1.30%) ⬆️

... and 26 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.67% <0.00%> (+0.05%) ⬆️
unit-tests 63.81% <90.90%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 29.71% <ø> (ø)
blockchain tree 83.58% <ø> (ø)
pipeline 90.56% <ø> (ø)
storage (db) 75.06% <ø> (+0.08%) ⬆️
trie 94.88% <ø> (ø)
txpool 47.50% <ø> (+0.07%) ⬆️
networking 77.42% <ø> (-0.03%) ⬇️
rpc 57.44% <ø> (+0.07%) ⬆️
consensus 63.40% <ø> (ø)
revm 31.74% <ø> (ø)
payload builder 6.34% <ø> (ø)
primitives 86.18% <90.90%> (+0.03%) ⬆️

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

if you want to get extra fancy you can do something like

struct IncCounterOnDrop(Counter)

impl Drop for IncCounterOnDrop {
  fn drop(&self) {
    // incr
  }
}

this would also solve the issue that on panic the counter wouldn't get decreased atm

so wrap the relevant counter in the helper type and move into the task closure

crates/tasks/src/lib.rs Outdated Show resolved Hide resolved
crates/tasks/src/lib.rs Outdated Show resolved Hide resolved
@mattsse mattsse added the A-observability Related to tracing, metrics, logs and other observability tools label Sep 4, 2023
crates/tasks/src/lib.rs Outdated Show resolved Hide resolved
crates/tasks/src/lib.rs Outdated Show resolved Hide resolved
crates/tasks/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this works, thanks

@mattsse mattsse added this pull request to the merge queue Sep 6, 2023
Merged via the queue into paradigmxyz:main with commit 6299c26 Sep 6, 2023
23 checks passed
@alessandromazza98 alessandromazza98 deleted the issue4479 branch September 11, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-observability Related to tracing, metrics, logs and other observability tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add metrics counter for finished spawned tasks
3 participants