sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Make `System.Diagnostics.Metrics` available in `net7.0` and earlier

Open jamescrosswell opened this issue 1 year ago • 0 comments

We have already a package, that's only used for older frameworks:

https://github.com/getsentry/sentry-dotnet/tree/main/src/Sentry.DiagnosticSource#when-shouldnt-i-include-this-package

Sentry DiagnosticSource integration

  • Baked in on net6.0 and later at the moment

System DiagnosticsMetrics integration

  • Baked in on net8.0 and later at the moment

Assuming we can bump the System.Diagnostics.DiagnosticSource version from 4.5.0 to 8.0.0, I could a .src/Sentry.DiagnosticSource/Internal/DiagnosticsMetrics folder containing the Metrics integration... include that in the root project for net8.0 and later and then people could grab the Sentry.DiagnosticSource either if they wanted the DiagnosticSource integration for netstandard/netframework or if they wanted the Metrics integration for net6.0 or below.

I am wondering whether that might create a clash however. If someone was running net6.0 and added a reference to Sentry.DiagnosticSource so that they could use the metrics integration... presumably their Sentry.nupkg would already include everything from src/Sentry.DiagnosticSource/Internal/DiagnosticSource but now so would the Sentry.DiagnosticSource.nupkg that they referred to as well.

Seems like actually these would have to exist as separate packages then... So we'd need a new Sentry.DiagnosticSource.Metrics package that people could add if they're on net6.0 or below, and we just do the same trick for that that we've done already for Sentry.DiagnosticSource.

Originally posted by @jamescrosswell in https://github.com/getsentry/sentry-dotnet/issues/3052#issuecomment-1900001093

jamescrosswell avatar Jan 29 '24 09:01 jamescrosswell