Skip to content

Commit

Permalink
Align to latest prometheus version
Browse files Browse the repository at this point in the history
There are known bugs in 7.0; release a version to encourage avoidance of problematic version(s)
  • Loading branch information
chris-peterson committed Apr 11, 2024
1 parent 9fade3c commit bb1e45b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
Configuration: Release

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Build
run: dotnet build
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ namespace Spiffy.Monitoring.Prometheus
{
public class PrometheusConfigurationApi
{
#if NET6_0_OR_GREATER
public PrometheusConfigurationApi()
{
RuntimeStats = global::Prometheus.DotNetRuntime.DotNetRuntimeStatsBuilder.Customize();
}

public global::Prometheus.DotNetRuntime.DotNetRuntimeStatsBuilder.Builder RuntimeStats { get; private set; }
#endif
}
}
2 changes: 0 additions & 2 deletions src/Spiffy.Monitoring.Prometheus/PrometheusProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ public static InitializationApi.ProvidersApi Prometheus(this InitializationApi.P
{
var config = new PrometheusConfigurationApi();
customize(config);
#if NET6_0_OR_GREATER
lock (_serializeCollectionAccess)
{
_previousCollector?.Dispose();
_previousCollector = config.RuntimeStats.StartCollecting();
}
#endif
}
api.Add("prometheus", PrometheusRules.Process);
return api;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Copyright>2020-2023</Copyright>
<Copyright>2020-2024</Copyright>
<Authors>Chris Peterson</Authors>
<Description>The Prometheus provider for Spiffy.Monitoring</Description>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<AssemblyName>Spiffy.Monitoring.Prometheus</AssemblyName>
<PackageId>Spiffy.Monitoring.Prometheus</PackageId>
<PackageTags>monitoring;eventcontext;structured logging;metrics;prometheus;splunk</PackageTags>
<PackageProjectUrl>http://github.com/chris-peterson/spiffy#overview</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>2.0.6</Version>
<Version>3.0.0</Version>
<RootNamespace>Spiffy.Monitoring.Prometheus</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Spiffy.Monitoring\Spiffy.Monitoring.csproj" />
<PackageReference Include="prometheus-net" Version="6.0.*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' " >
<PackageReference Include="prometheus-net" Version="8.2.*" />
<PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.*" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/TestConsoleApp/TestConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DebugType>portable</DebugType>
<OutputTypeEx>exe</OutputTypeEx>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DebugType>portable</DebugType>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>
Expand Down

0 comments on commit bb1e45b

Please sign in to comment.