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

roachtest: add post-process step for perf metrics #138617

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sambhav-jain-16
Copy link
Contributor

@sambhav-jain-16 sambhav-jain-16 commented Jan 8, 2025

There are many tests in which had some custom post processing done in
roachperf to emit the metrics.

To add this facility in the roachtests itself, this change aims to :

  1. Adds 2 new user facing structs HistogramMetric, that gives the user
    access to the histogram metrics generated by the workload and
    AggregatedPerfMetrics which user can return with their aggregated metric.
  2. Introduce a new PostProcessPerfMetrics(HistogramMetrics) AggregatedPerfMetrics step in test spec where the test writer can do custom
    aggregation and provide the aggregated metric. If the test has not
    implemented this step, the runner will use the DefaultPostProcess
    function.
  3. The step creates a new openmetrics file with the name
    aggregated_stats.om that will have the aggregated metrics.
  4. Implement PostProcessPerfMetrics in some roachtests that do
    post processing in roachperf. The implementation is borrowed from roachperf for each test.

There are some roachtests for which PostProcessPerfMetrics is not implemented. It will be done in subsequent PRs

Epic: https://cockroachlabs.atlassian.net/browse/CRDB-41852

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 7 times, most recently from 8e65484 to c16d5a6 Compare January 9, 2025 06:33
@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 2 times, most recently from 0045d82 to 62cea99 Compare January 30, 2025 11:09
Copy link

blathers-crl bot commented Jan 30, 2025

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 5 times, most recently from 81f6b0e to 7bc5033 Compare February 4, 2025 07:01
@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 11 times, most recently from 0a204f5 to 5b23f95 Compare February 18, 2025 04:13
@sambhav-jain-16 sambhav-jain-16 marked this pull request as ready for review February 18, 2025 04:51
@sambhav-jain-16 sambhav-jain-16 requested a review from a team as a code owner February 18, 2025 04:51
@sambhav-jain-16 sambhav-jain-16 removed the request for review from a team February 18, 2025 04:51
@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 2 times, most recently from c765b82 to ba12c23 Compare February 18, 2025 11:49
@@ -1409,6 +1412,13 @@ func (r *testRunner) runTest(
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
}

if t.spec.Benchmark && t.ExportOpenmetrics() {
if err := r.postProcessPerfMetrics(ctx, t, c); err != nil {
Copy link
Collaborator

@herkolategan herkolategan Feb 19, 2025

Choose a reason for hiding this comment

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

From my understanding this downloads the metrics, does post processing and then re-uploads the metrics to the node. And then eventually on:

line 971:

if t.spec.Benchmark {
	getPerfArtifacts(ctx, c, t)
}

The perf artifacts (metrics) will get downloaded again?

For my own understanding, is there a reason we don't do the post processing on or after getPerfArtifacts(ctx, c, t) which won't require a re-upload step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point.
Let me take a look and refactor my changes into the getPerfArtifacts function you mentioned.
Thanks for pointing out !

@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 2 times, most recently from 6a81967 to 7a6a072 Compare February 20, 2025 08:55
@sambhav-jain-16 sambhav-jain-16 force-pushed the post-process-metrics branch 2 times, most recently from 529b512 to e824e9b Compare February 20, 2025 11:31
There are many tests in which had some custom post processing done in
roachperf to emit the metrics.

To add this facility  in the roachtests itself, this change aims to :

1.Adds 2 new user facing structs `HistogramMetric`, that gives the user
access to the histogram metrics generated by the workload and
`PerfMetrics` which user can return with their aggregated metric.
2. Introduce a new `PostProcessPerfMetrics(HistogramMetrics)
PerfMetrics` step in test spec where the test writer can do custom
aggregation and provide the aggregated metric. If the test has not
implemented this step, the runner will use the `DefaultPostProcess`
function.
3. The step creates a new openmetrics file with the name
`aggregated_stats.om` that will have the aggregated metrics.
4. Implement `PostProcessPerfMetrics` in some roachtests that do
post processing in roachperf.

Epic: https://cockroachlabs.atlassian.net/browse/CRDB-41852

Release note: None
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.

3 participants