-
Notifications
You must be signed in to change notification settings - Fork 769
Add a counter to Stress app #9432
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 a counter to Stress app #9432
Conversation
There was a problem hiding this comment.
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",
| for (var i = 0; i < 1000000; i++) | ||
| { | ||
| counter.Add(1); | ||
| await Task.Delay(20, cancellationToken); |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
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.
| await Task.Delay(20, cancellationToken); | |
| await Task.Delay(DelayDurationMilliseconds, cancellationToken); |
|
take a look at these screen shots: in the first one it said there was 585 new posts at 8:00:14 and 697 new posts at 8:00:34 Sometimes it even changes a value from past as i said in #9251 |
@inlineHamed please show the graph view as well |






Description
While investigating #9251, I ntoiced we were missing a counter in the stress playground app.
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate