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

Expose activation working set as a metric #8291

Merged
merged 6 commits into from
Jan 30, 2023

Conversation

ahydrax
Copy link
Contributor

@ahydrax ahydrax commented Jan 28, 2023

This should resolve #8279.

Microsoft Reviewers: Open in CodeFlow

@ahydrax
Copy link
Contributor Author

ahydrax commented Jan 29, 2023

reviewers fyi: dotnet/diagnostics#3542
I verified that the bug still present in dotnet-counters tool however the fix is merged and we just have to wait for new version.
Anyway, we can test correctness of UpDownCounter output by using prometheus-net.

@ReubenBond
Copy link
Member

Thank you for opening this! I believe we should use an observable counter for performance reasons, particularly since we are already tracking the count in an interlocked variable.

@ahydrax
Copy link
Contributor Author

ahydrax commented Jan 29, 2023

Yeah, I was considering using ObservableUpDownCounter but then I had to deal with static/nonstatic context. As metrics live in static context we're unable to use observable counters until we made ActivationWorkingSet static somehow.

@ahydrax
Copy link
Contributor Author

ahydrax commented Jan 29, 2023

For sure I could make that ActivationWorkingSet initializes static field with observable counter but for me it will look like a bad design.

@ahydrax
Copy link
Contributor Author

ahydrax commented Jan 29, 2023

The way I see it is to make CatalogInstruments nonstatic then add it to DI and inject ActivationWorkingSet into it.
cc @ReubenBond

@ReubenBond
Copy link
Member

Good point, that is a limitation of how metrics work in .NET today. We don't expect coherent results when multiple silos are hosted within a single process and this problem exists with most of the other counters we publish.

If/when .NET adopts a non-static model for counters, we can adjust our approach to accommodate.

An alternative is to also have a global count property

@ReubenBond
Copy link
Member

The way I see it is to make CatalogInstruments nonstatic then add it to DI and inject ActivationWorkingSet into it.
cc @ReubenBond

We should probably do this, too.

@ahydrax
Copy link
Contributor Author

ahydrax commented Jan 30, 2023

Just a couple of observations made:

So I decided to fix major issue and proceed with current approach.

@ReubenBond ReubenBond merged commit 976a6d1 into dotnet:main Jan 30, 2023
@ahydrax ahydrax deleted the active-working-set-metrics branch January 31, 2023 01:24
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose activation working set as a metric
2 participants