-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[System.Diagnostics.DiagnosticSource] Support listening to meters out-of-proc using a wildcard #105581
[System.Diagnostics.DiagnosticSource] Support listening to meters out-of-proc using a wildcard #105581
Conversation
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
@tarekgh I added support for doing a prefix as well as the blanket wildcard. Thinking more about this, that will probably be very useful for users who may want to do things like listen to all runtime or aspnetcore metrics but may not care about other things so much. Also had to fix up the tests a bit for introduction of runtime metrics. And there was a cast issue seems to have been introduced recently 🤷 |
spec.MeterName.EndsWith('*')) | ||
#else | ||
spec.MeterName.EndsWith("*", StringComparison.Ordinal)) | ||
#endif |
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.
This is not worth the ifdef
you can write it like
spec.MeterName.Length > 0 && spec.MeterName[spec.MeterName.Length - 1] == '*'
Or just use spec.MeterName.EndsWith("*", StringComparison.Ordinal))
which still fast enough even in .NET 8.0.
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.
Updated! I also made all the string comparisons StringComparison.OrdinalIgnoreCase
. My thinking there is these values are likely coming from config so it is nice to make them as forgiving as possible 😄
Changes
MetricsEventSource
for listening to meters out-of-proc by using a wildcard\prefix style (ex:*
,Company.Library*
) for meter name in spec/cc @noahfalk @samsp-msft @tarekgh @rajkumar-rangaraj