Skip to content

Fix benchmark to correctly report metrics to Cosmos#49406

Open
FabianMeiswinkel wants to merge 4 commits into
mainfrom
users/fabianm/gw20bench
Open

Fix benchmark to correctly report metrics to Cosmos#49406
FabianMeiswinkel wants to merge 4 commits into
mainfrom
users/fabianm/gw20bench

Conversation

@FabianMeiswinkel

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 8, 2026 08:46
@FabianMeiswinkel FabianMeiswinkel requested review from a team and kirankumarkolli as code owners June 8, 2026 08:46
@github-actions github-actions Bot added the Cosmos label Jun 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Cosmos benchmark Micrometer reporter lifecycle to avoid reporting after shutdown and to ensure a final “flush” of metrics occurs reliably when stopping the benchmark run.

Changes:

  • Added an AtomicBoolean stop flag to prevent scheduled report() calls after stop() begins and to make stop() idempotent.
  • Extracted the upload loop into reportCore() so it can be invoked both on the schedule and during shutdown.
Show a summary per file
File Description
sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/CosmosMetricsReporter.java Adds stop-guarding and refactors reporting into reportCore() to support a final flush on stop.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines 140 to 142
String timestamp = TIMESTAMP_FORMATTER.format(Instant.now());
double cpuPercent = round(cpuReader.getSystemWideCpuUsage() * 100);

@xinlian12 xinlian12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants