Skip to content

Commit 85208b0

Browse files
committed
prepare for new version
1 parent d2a0fb2 commit 85208b0

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
3131
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime)
3232
{
3333
app.UsePrometheusServer(q =>
34-
{
35-
q.MapPath = "/metrics1";
36-
});
34+
{
35+
q.MapPath = "/metrics1";
36+
});
3737
}
3838

3939
```
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22
using Prometheus.Client.Collectors;
3-
using System.Runtime.InteropServices;
3+
using Prometheus.Client.Collectors.Abstractions;
44

55
namespace Prometheus.Client.AspNetCore
66
{
@@ -14,12 +14,11 @@ public static class DefaultCollectors
1414
/// </summary>
1515
public static IEnumerable<IOnDemandCollector> Get(MetricFactory metricFactory)
1616
{
17-
yield return new DotNetStatsCollector(metricFactory);
18-
19-
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
20-
if (isWindows)
21-
yield return new WindowsDotNetStatsCollector(metricFactory);
22-
17+
return new IOnDemandCollector[]
18+
{
19+
new DotNetStatsCollector(metricFactory),
20+
new ProcessCollector(metricFactory)
21+
};
2322
}
2423
}
2524
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Description>Middleware for the Prometheus.Client</Description>
44
<Copyright>2018 © Sergey Kuznetsov</Copyright>
55
<AssemblyTitle>Prometheus.Client.AspNetCore</AssemblyTitle>
6-
<VersionPrefix>1.5.1</VersionPrefix>
6+
<VersionPrefix>1.6.0</VersionPrefix>
77
<Authors>Sergey Kuznetsov</Authors>
88
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
99
<AssemblyName>Prometheus.Client.AspNetCore</AssemblyName>
@@ -18,7 +18,7 @@
1818
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1919
</PropertyGroup>
2020
<ItemGroup>
21-
<PackageReference Include="Prometheus.Client" Version="[1.5.0,1.6.0)" />
21+
<!--<PackageReference Include="Prometheus.Client" Version="1.6.0" />-->
2222
</ItemGroup>
2323
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3'">
2424
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions">
@@ -30,4 +30,7 @@
3030
<Version>2.0.0</Version>
3131
</PackageReference>
3232
</ItemGroup>
33+
<ItemGroup>
34+
<PackageReference Include="Prometheus.Client" Version="1.6.0-build44" />
35+
</ItemGroup>
3336
</Project>

src/Prometheus.Client.AspNetCore/PrometheusExtensions.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,11 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
4141
{
4242
coreapp.Run(async context =>
4343
{
44-
var req = context.Request;
4544
var response = context.Response;
4645

47-
req.Headers.TryGetValue("Accept", out var acceptHeaders);
48-
var contentType = ScrapeHandler.GetContentType(acceptHeaders);
49-
50-
response.ContentType = contentType;
51-
5246
using (var outputStream = response.Body)
5347
{
54-
var collected = options.CollectorRegistryInstance.CollectAll();
55-
ScrapeHandler.ProcessScrapeRequest(collected, contentType, outputStream);
48+
ScrapeHandler.Process(options.CollectorRegistryInstance, outputStream);
5649
}
5750

5851
await Task.FromResult(0).ConfigureAwait(false);

src/Prometheus.Client.AspNetCore/PrometheusOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using Prometheus.Client.Collectors;
3+
using Prometheus.Client.Collectors.Abstractions;
34

45
namespace Prometheus.Client.AspNetCore
56
{

0 commit comments

Comments
 (0)