File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
src/Prometheus.Client.AspNetCore Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
33 <Description >Middleware for the Prometheus.Client</Description >
4- <Copyright >2018 © Sergey Kuznetsov </Copyright >
4+ <Copyright >2020 © Serge K, Oleksandr Poliakov </Copyright >
55 <AssemblyTitle >Prometheus.Client.AspNetCore</AssemblyTitle >
6- <VersionPrefix >4.0 .0</VersionPrefix >
7- <Authors >Sergey Kuznetsov </Authors >
6+ <VersionPrefix >4.1 .0</VersionPrefix >
7+ <Authors >Serge K, Oleksandr Poliakov </Authors >
88 <TargetFrameworks >netstandard2.0;netcoreapp2.2;netstandard2.1;netcoreapp3.1</TargetFrameworks >
99 <AssemblyName >Prometheus.Client.AspNetCore</AssemblyName >
1010 <PackageId >Prometheus.Client.AspNetCore</PackageId >
3333 </None >
3434 </ItemGroup >
3535 <ItemGroup >
36- <PackageReference Include =" Prometheus.Client" Version =" 4.0 .0" />
36+ <PackageReference Include =" Prometheus.Client" Version =" 4.1 .0" />
3737 </ItemGroup >
3838 <ItemGroup Condition =" '$(TargetFramework)' == 'netcoreapp3.1'" >
3939 <FrameworkReference Include =" Microsoft.AspNetCore.App" />
Original file line number Diff line number Diff line change 22using Prometheus . Client . Collectors ;
33using Microsoft . AspNetCore . Builder ;
44using Microsoft . AspNetCore . Http ;
5+ using Prometheus . Client . Collectors . Abstractions ;
56
67namespace Prometheus . Client . AspNetCore
78{
@@ -35,6 +36,10 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
3536 if ( ! options . MapPath . StartsWith ( "/" ) )
3637 throw new ArgumentException ( $ "MapPath '{ options . MapPath } ' should start with '/'") ;
3738
39+ options . CollectorRegistryInstance
40+ ??= ( ICollectorRegistry ) app . ApplicationServices . GetService ( typeof ( ICollectorRegistry ) )
41+ ?? Metrics . DefaultCollectorRegistry ;
42+
3843 if ( options . UseDefaultCollectors )
3944 options . CollectorRegistryInstance . UseDefaultCollectors ( ) ;
4045
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ public class PrometheusOptions
1818 public int ? Port { get ; set ; }
1919
2020 /// <summary>
21- /// CollectorRegistry intance
21+ /// CollectorRegistry instance.
2222 /// </summary>
23- public ICollectorRegistry CollectorRegistryInstance { get ; set ; } = Metrics . DefaultCollectorRegistry ;
23+ public ICollectorRegistry CollectorRegistryInstance { get ; set ; }
2424
2525 /// <summary>
2626 /// Use default collectors
You can’t perform that action at this time.
0 commit comments