dotnet / extensions

This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
MIT License
2.63k stars 752 forks source link

Microsoft.Extensions.Diagnostics.ResourceMonitoring meter name changed to ResourceMonitoring #5404

Closed gitmln closed 1 month ago

gitmln commented 1 month ago

Description

The following commit https://github.com/dotnet/extensions/commit/cbcef5cee17886e451dc3fd348092205bb438347 changed the name of Microsoft.Extensions.Diagnostics.ResourceMonitoring main meter. The correct one is Microsoft.Extensions.Diagnostics.ResourceMonitoring. The current value (for v8.8) is "ResourceMonitoring".

The problem is with nameof expression meterFactory.Create(nameof(Microsoft.Extensions.Diagnostics.ResourceMonitoring)); Please check https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/nameof When the operand is a type or a namespace, the produced name isn't fully qualified

I provide a PR that fixes this bug https://github.com/dotnet/extensions/pull/5403

Reproduction Steps

AddMeeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring") Run any sample program. ResourceMonitoring Metrics are no longer produced.

Expected behavior

AddMeeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring") gives ResourceMonitoring metrics.

Actual behavior

AddMeeter("Microsoft.Extensions.Diagnostics.ResourceMonitoring") gives no ResourceMonitoring metrics.

Regression?

Worked in < v8.8

Known Workarounds

No response

Configuration

No response

Other information

No response

gitmln commented 1 month ago

The obvious working workaround for now is to use AddMeeter("ResourceMonitoring")

RussKie commented 1 month ago

@evgenyfedorov2 please triage

joperezr commented 1 month ago

We should fix this as it is a regression that breaks dashboards/alerts. Might be patch-worthy. Going on a tangent for a bit, but can we make sure we add tests that catch these type of regressions so this won't break in the future?