Skip to content

Add a counter to Stress app#9432

Merged
danmoseley merged 1 commit into
microsoft:mainfrom
adamint:dev/adamint/add-counter-stress
May 20, 2025
Merged

Add a counter to Stress app#9432
danmoseley merged 1 commit into
microsoft:mainfrom
adamint:dev/adamint/add-counter-stress

Conversation

@adamint

@adamint adamint commented May 20, 2025

Copy link
Copy Markdown
Member

Description

While investigating #9251, I ntoiced we were missing a counter in the stress playground app.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@adamint adamint requested review from Copilot and removed request for Copilot May 20, 2025 21:18
@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 20, 2025
@adamint adamint requested review from JamesNK and danmoseley May 20, 2025 21:18

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 adds a counter feature to the Stress playground app by registering a new hosted service and corresponding metrics meter. Key changes include:

  • Registering CounterMetrics as a hosted service and adding its corresponding meter in Program.cs.
  • Introducing a new CounterMetrics class that creates and increments a counter metric in a background loop.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
playground/Stress/Stress.TelemetryService/Program.cs Added registration for the CounterMetrics hosted service and meter.
playground/Stress/Stress.TelemetryService/CounterMetrics.cs New service that implements a counter metric using a background task loop.
Comments suppressed due to low confidence (1)

playground/Stress/Stress.TelemetryService/CounterMetrics.cs:16

  • [nitpick] The metric name 'run.done.new.count' could be made more descriptive. Consider renaming it to something like 'counter.completedRuns' to better convey its purpose.
name: "run.done.new.count",

Comment thread playground/Stress/Stress.TelemetryService/CounterMetrics.cs
for (var i = 0; i < 1000000; i++)
{
counter.Add(1);
await Task.Delay(20, cancellationToken);

Copilot AI May 20, 2025

Copy link

Choose a reason for hiding this comment

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

Extracting the delay duration (20 milliseconds) into a named constant could enhance readability and maintainability.

Suggested change
await Task.Delay(20, cancellationToken);
await Task.Delay(DelayDurationMilliseconds, cancellationToken);

Copilot uses AI. Check for mistakes.
@adamint adamint added area-dashboard and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 20, 2025
@danmoseley danmoseley merged commit 4625811 into microsoft:main May 20, 2025
@inlineHamed

inlineHamed commented May 23, 2025

Copy link
Copy Markdown
Contributor

take a look at these screen shots:

Image
Image
Image

in the first one it said there was 585 new posts at 8:00:14 and 697 new posts at 8:00:34
few seconds later in the second shot it removed the 8:00:14 one
few seconds later in the third shot it remove the previous item and show a new one

Sometimes it even changes a value from past as i said in #9251

@adamint

adamint commented May 23, 2025

Copy link
Copy Markdown
Member Author

take a look at these screen shots:

Image Image Image

in the first one it said there was 585 new posts at 8:00:14 and 697 new posts at 8:00:34 few seconds later in the second shot it removed the 8:00:14 one few seconds later in the third shot it remove the previous item and show a new one

Sometimes it even changes a value from past as i said in #9251

@inlineHamed please show the graph view as well

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants