зеркало из https://github.com/dotnet/extensions.git
Remove IMeter from Metering source-gen (#4112)
Co-authored-by: Nikita Balabaev <nbalabaev@microsoft.com>
This commit is contained in:
Родитель
04608fd766
Коммит
bb9d90008f
|
@ -415,14 +415,6 @@ internal sealed class Parser
|
|||
return (null, false);
|
||||
}
|
||||
|
||||
// check if any of methodSymbol parameters is of IMeter type
|
||||
if (symbols.IMeterInterface != null &&
|
||||
methodSymbol.Parameters.Any(p => ParserUtilities.IsBaseOrIdentity(p.Type, symbols.IMeterInterface, _compilation)))
|
||||
{
|
||||
// The method uses old IMeter, no need to parse it
|
||||
return (null, false);
|
||||
}
|
||||
|
||||
if (instrumentKind == InstrumentKind.Gauge)
|
||||
{
|
||||
Diag(DiagDescriptors.ErrorGaugeNotSupported, methodSymbol.GetLocation());
|
||||
|
|
|
@ -13,5 +13,4 @@ internal sealed record class SymbolHolder(
|
|||
INamedTypeSymbol? HistogramOfTAttribute,
|
||||
INamedTypeSymbol? GaugeAttribute,
|
||||
INamedTypeSymbol LongTypeSymbol,
|
||||
INamedTypeSymbol? DimensionAttribute,
|
||||
INamedTypeSymbol? IMeterInterface);
|
||||
INamedTypeSymbol? DimensionAttribute);
|
||||
|
|
|
@ -14,7 +14,6 @@ internal static class SymbolLoader
|
|||
internal const string HistogramAttribute = "Microsoft.Extensions.Telemetry.Metering.HistogramAttribute";
|
||||
internal const string DimensionAttribute = "Microsoft.Extensions.Telemetry.Metering.DimensionAttribute";
|
||||
internal const string MeterClass = "System.Diagnostics.Metrics.Meter";
|
||||
private const string MeterInterface = "Microsoft.Extensions.Telemetry.Metering.IMeter";
|
||||
|
||||
internal static SymbolHolder? LoadSymbols(Compilation compilation)
|
||||
{
|
||||
|
@ -35,7 +34,6 @@ internal static class SymbolLoader
|
|||
var gaugeAttribute = compilation.GetTypeByMetadataName(GaugeAttribute);
|
||||
var dimensionAttribute = compilation.GetTypeByMetadataName(DimensionAttribute);
|
||||
var longType = compilation.GetSpecialType(SpecialType.System_Int64);
|
||||
var meterInterface = compilation.GetTypeByMetadataName(MeterInterface);
|
||||
|
||||
return new(
|
||||
meterClassSymbol,
|
||||
|
@ -45,7 +43,6 @@ internal static class SymbolLoader
|
|||
histogramTAttribute,
|
||||
gaugeAttribute,
|
||||
longType,
|
||||
dimensionAttribute,
|
||||
meterInterface);
|
||||
dimensionAttribute);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.Extensions.Telemetry.Metering;
|
|||
/// static partial class Metric
|
||||
/// {
|
||||
/// [Gauge]
|
||||
/// static partial MemoryUsage CreateMemoryUsage(IMeter meter);
|
||||
/// static partial MemoryUsage CreateMemoryUsage(Meter meter);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
|
@ -58,7 +58,7 @@ public sealed class GaugeAttribute : Attribute
|
|||
/// static partial class Metric
|
||||
/// {
|
||||
/// [Gauge(Name="SampleMetric")]
|
||||
/// static partial MemoryUsage CreateMemoryUsage(IMeter meter);
|
||||
/// static partial MemoryUsage CreateMemoryUsage(Meter meter);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.Extensions.Telemetry.Metering;
|
|||
/// static partial class Metric
|
||||
/// {
|
||||
/// [Histogram("RequestName", "RequestStatusCode")]
|
||||
/// static partial RequestLatency CreateRequestLatency(IMeter meter);
|
||||
/// static partial RequestLatency CreateRequestLatency(Meter meter);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
|
@ -58,7 +58,7 @@ public sealed class HistogramAttribute : Attribute
|
|||
/// static partial class Metric
|
||||
/// {
|
||||
/// [Histogram("RequestName", "RequestStatusCode", Name="SampleMetric")]
|
||||
/// static partial RequestLatency CreateRequestLatency(IMeter meter);
|
||||
/// static partial RequestLatency CreateRequestLatency(Meter meter);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
|
|
Загрузка…
Ссылка в новой задаче