Skip to content

Migrate to use the System.Diagnostics.Metrics API to track internal metrics - #7814

Merged
ReubenBond merged 17 commits into
dotnet:mainfrom
suraciii:meters
Jul 6, 2022
Merged

ReubenBond merged 17 commits into
dotnet:mainfrom
suraciii:meters

Conversation

@suraciii

@suraciii suraciii commented Jun 24, 2022 •

Copy link
Copy Markdown
Contributor

Fixes: #7480

This PR migrate most of current *Statistics to System.Diagnostics.Metrics.Instruments, let metrics can be collected directly by common tools (dotnet-counters, OpenTelemetry SDK, etc.)

Microsoft Reviewers: Open in CodeFlow

@ReubenBond ReubenBond self-assigned this Jun 24, 2022
@ReubenBond ReubenBond added this to the 4.0-preview5 milestone Jun 24, 2022
@ReubenBond

Copy link
Copy Markdown
Member

@suraciii this is fantastic! Is there anything which remains before you mark this PR as "Ready for review"?

@suraciii

Copy link
Copy Markdown
Contributor Author

@suraciii this is fantastic! Is there anything which remains before you mark this PR as "Ready for review"?

I'm validating migrated metrics, and considering to improve the way how Orleans itself subscribes its metrics, but it can be done in a further PR.

This PR is ready for review now, you can get all migrated metrics at src/Orleans.Core/Diagnostics/Metrics/InstrumentNames.cs.
Any feedback would be grateful.

@suraciii
suraciii marked this pull request as ready for review June 26, 2022 18:01
private static CounterAggregator FindOrCreate(string name, params KeyValuePair<string, object>[] tags)
{
var key = new AggregatorKey(name, tags);
ref var aggregator = ref CollectionsMarshal.GetValueRefOrAddDefault(Aggregators, key, out var exists);

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.

This doesn't look thread-safe - I suggest a lock

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.

My mistake, you removed this already

@ReubenBond
ReubenBond merged commit 8438b19 into dotnet:main Jul 6, 2022
@ReubenBond

ReubenBond commented Jul 6, 2022 •

Copy link
Copy Markdown
Member

If there are any other changes you'd like to make here, we can do so in a subsequent PR. Many thanks for this contribution!

@suraciii

suraciii commented Jul 8, 2022

Copy link
Copy Markdown
Contributor Author

@ReubenBond Thank you so much for your help with this PR :)

@ReubenBond

Copy link
Copy Markdown
Member

Gladly, @suraciii, your effort here is a tremendous help

@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.

Migrate internal stats to .NET Counters

3 participants