Skip to content

Commit 398ece7

Browse files
committed
use DefaultCollectors from Prometheus.Client
1 parent 141b25e commit 398ece7

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

src/Prometheus.Client.AspNetCore/DefaultCollectors.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Prometheus.Client.AspNetCore/Prometheus.Client.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ItemGroup>
2121
<!-- for debug -->
2222
<!--<PackageReference Include="Prometheus.Client" Version="1.6.0" />-->
23-
<PackageReference Include="Prometheus.Client" Version="1.6.0-build44" />
23+
<PackageReference Include="Prometheus.Client" Version="1.6.0-build45" />
2424
</ItemGroup>
2525
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3'">
2626
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions">

src/Prometheus.Client.AspNetCore/PrometheusExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
2525
{
2626
var options = new PrometheusOptions();
2727
setupOptions?.Invoke(options);
28-
28+
2929
if (app == null)
3030
throw new ArgumentNullException(nameof(app));
3131

@@ -60,9 +60,9 @@ private static void RegisterCollectors(PrometheusOptions options)
6060
{
6161
if (options.UseDefaultCollectors)
6262
{
63-
var metricFactory = Metrics.DefaultFactory;
64-
if (options.CollectorRegistryInstance != CollectorRegistry.Instance)
65-
metricFactory = new MetricFactory(options.CollectorRegistryInstance);
63+
var metricFactory = options.CollectorRegistryInstance == CollectorRegistry.Instance
64+
? Metrics.DefaultFactory
65+
: new MetricFactory(options.CollectorRegistryInstance);
6666

6767
options.Collectors.AddRange(DefaultCollectors.Get(metricFactory));
6868
}

0 commit comments

Comments
 (0)