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

Refactor various metric APIs to make distributed execution easier #3191

Merged
merged 4 commits into from
Jul 17, 2023

Conversation

na--
Copy link
Member

@na-- na-- commented Jul 13, 2023

What?

This PR contains parts of #2816 that are pure refactoring of various APIs, to decouple them slightly and make them more flexible and usable for the purposes of implementing distributed execution and test suites. It does not have any breaking changes and can safely be merged now. I've tried to separate the various changes into logical self-contained and small commits, so I suggest reviewing it commit by commit.

Why?

Moving these changes to a separate PR that can be merged now reduces the scope of the big PR and makes merging other backwards-compatible parts of it possible. For the parts that aren't backwards-compatible and will remain in a separate WIP PR for a long while, it makes the upkeep of the PR (i.e. rebasing it on top of master changes) much, much easier.

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make ci-like-lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

na-- added 4 commits July 13, 2023 11:41
Not having it depend on lib.TestRunState means that it can be used both by a local test run, and by a coordinator instasnce that isn't actually running the test itself.
It isn't used for anything except a few tests of questionable quality, but it's not even needed for them...
This is in preparation for HDR histograms, when the TrendSink's internals won't be the same and won't be directly accessible.
@na-- na-- requested a review from codebien July 13, 2023 09:05
@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2023

Codecov Report

Merging #3191 (df5f688) into master (f86938d) will increase coverage by 0.01%.
The diff coverage is 95.31%.

❗ Current head df5f688 differs from pull request most recent head 307ae74. Consider uploading reports for the commit 307ae74 to get more accurate results

@@            Coverage Diff             @@
##           master    #3191      +/-   ##
==========================================
+ Coverage   72.87%   72.89%   +0.01%     
==========================================
  Files         256      256              
  Lines       19800    19806       +6     
==========================================
+ Hits        14430    14437       +7     
+ Misses       4470     4469       -1     
  Partials      900      900              
Flag Coverage Δ
ubuntu 72.83% <95.31%> (+0.02%) ⬆️
windows 72.73% <95.31%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
metrics/engine/ingester.go 91.48% <ø> (ø)
cmd/run.go 74.27% <86.66%> (+0.11%) ⬆️
metrics/sink.go 97.40% <96.29%> (+1.51%) ⬆️
execution/scheduler.go 93.09% <100.00%> (ø)
metrics/engine/engine.go 90.26% <100.00%> (+1.28%) ⬆️
metrics/sample.go 95.23% <100.00%> (ø)
metrics/thresholds.go 89.92% <100.00%> (-0.16%) ⬇️

Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for doing it!

@@ -167,10 +159,10 @@ func (me *MetricsEngine) initSubMetricsAndThresholds() error {
// StartThresholdCalculations spins up a new goroutine to crunch thresholds and
// returns a callback that will stop the goroutine and finalizes calculations.
func (me *MetricsEngine) StartThresholdCalculations(
ingester *OutputIngester,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already an improvement, in the final picture, I think we should try to reverse the control here. Passing the MetricsEngine as a dependency to the Ingester (the Output).

Just sharing this to you for collecting thoughts, not really a request for change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this might be a better approach 🤔

Though the MetricsEngine and the OutputIngester also have other issues that I didn't fully fix when I extracted them from the core.Engine (e.g. #572 (comment) probably being the biggest one) that we can probably refactor things here even further 🤔

Still, this PR at least somewhat further decouples the metrics crunching from the test execution, so any such refactoring should hopefully be easier 🤞

Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

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

🚀

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.

5 participants