-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add prometheus metrics library
- Loading branch information
1 parent
225d835
commit 3431cf6
Showing
25 changed files
with
2,425 additions
and
7 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Release prometheus workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
paths: | ||
- Zupit.Prometheus/** | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
uses: ./.github/workflows/common-release.yml | ||
with: | ||
DOTNET_IMAGE: 'mcr.microsoft.com/dotnet/sdk:8.0.101-alpine3.18-amd64' | ||
WORKING_DIRECTORY: Zupit.Prometheus | ||
PROJECT: Zupit.Prometheus | ||
PROJECT_NAME_COMMIT_SUFFIX: Prometheus | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Zupit.Prometheus; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Services.AddControllers(); | ||
|
||
builder.Services.AddPrometheusMetrics(builder.Configuration); | ||
|
||
var app = builder.Build(); | ||
|
||
app.MapPrometheusEndpointWithToken(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.MapControllers(); | ||
|
||
app.Run(); | ||
|
||
public partial class Program { } |
41 changes: 41 additions & 0 deletions
41
Zupit.Prometheus/Zupit.Prometheus.TestApp/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:52605", | ||
"sslPort": 44355 | ||
} | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5128", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7262;http://localhost:5128", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Zupit.Prometheus/Zupit.Prometheus.TestApp/Zupit.Prometheus.TestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Zupit.Prometheus\Zupit.Prometheus.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
6 changes: 6 additions & 0 deletions
6
Zupit.Prometheus/Zupit.Prometheus.TestApp/Zupit.Prometheus.TestApp.http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@Zupit.Prometheus.TestApp_HostAddress = http://localhost:5128 | ||
|
||
GET {{Zupit.Prometheus.TestApp_HostAddress}}/weatherforecast/ | ||
Accept: application/json | ||
|
||
### |
8 changes: 8 additions & 0 deletions
8
Zupit.Prometheus/Zupit.Prometheus.TestApp/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Zupit.Prometheus/Zupit.Prometheus.TestApp/appsettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"AllowedHosts": "*", | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"Metrics": { | ||
"TokenKey": "token", | ||
"TokenValue": "cV^96k" | ||
} | ||
} |
201 changes: 201 additions & 0 deletions
201
Zupit.Prometheus/Zupit.Prometheus.TestApp/packages.lock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
{ | ||
"version": 1, | ||
"dependencies": { | ||
"net8.0": { | ||
"Microsoft.Extensions.Configuration": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Primitives": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Configuration.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Primitives": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Configuration.Binder": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.DependencyInjection": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==" | ||
}, | ||
"Microsoft.Extensions.Diagnostics.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Options": "8.0.0", | ||
"System.Diagnostics.DiagnosticSource": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.FileProviders.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Primitives": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Hosting.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "AG7HWwVRdCHlaA++1oKDxLsXIBxmDpMPb3VoyOoAghEWnkUvEAdYQUwnV4jJbAaa/nMYNiEh5ByoLauZBEiovg==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Logging.Abstractions": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Logging": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection": "8.0.0", | ||
"Microsoft.Extensions.Logging.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Options": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Logging.Abstractions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Logging.Configuration": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "ixXXV0G/12g6MXK65TLngYN9V5hQQRuV+fZi882WIoVJT7h5JvoYoxTEwCgdqwLjSneqh1O+66gM8sMr9z/rsQ==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Configuration": "8.0.0", | ||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Configuration.Binder": "8.0.0", | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Logging": "8.0.0", | ||
"Microsoft.Extensions.Logging.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Options": "8.0.0", | ||
"Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Options": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Primitives": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Options.ConfigurationExtensions": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "0f4DMRqEd50zQh+UyJc+/HiBsZ3vhAQALgdkcQEalSH1L2isdC7Yj54M3cyo5e+BeO5fcBQ7Dxly8XiBBcvRgw==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Configuration.Binder": "8.0.0", | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Options": "8.0.0", | ||
"Microsoft.Extensions.Primitives": "8.0.0" | ||
} | ||
}, | ||
"Microsoft.Extensions.Primitives": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==" | ||
}, | ||
"OpenTelemetry": { | ||
"type": "Transitive", | ||
"resolved": "1.7.0", | ||
"contentHash": "HNmOJg++4FtEJGCIn1dCJcDkHRLNuLKU047owrGXUOfz/C/c5oZHOPKrowKVOy2jOOh/F9+HDshzeOk5NnQEZg==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Logging": "8.0.0", | ||
"Microsoft.Extensions.Logging.Configuration": "8.0.0", | ||
"OpenTelemetry.Api.ProviderBuilderExtensions": "1.7.0" | ||
} | ||
}, | ||
"OpenTelemetry.Api": { | ||
"type": "Transitive", | ||
"resolved": "1.7.0", | ||
"contentHash": "w5uDHl1Nm7R5igWu1QjewpdPzJSavua8NTI3+iThOdRNHD3cabox8JeIJ8LpBSXGHARSNFMJZ/Xr5EGRinMTMg==", | ||
"dependencies": { | ||
"System.Diagnostics.DiagnosticSource": "8.0.0" | ||
} | ||
}, | ||
"OpenTelemetry.Api.ProviderBuilderExtensions": { | ||
"type": "Transitive", | ||
"resolved": "1.7.0", | ||
"contentHash": "fHLmJcRJk1dAwddjBgvqi/Grmr04hPo1DoFwTa6hxtSvAFOXPU56Xe9Sh2VXqz6Gstzp6TCju8z0Sob1t7BzSg==", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", | ||
"OpenTelemetry.Api": "1.7.0" | ||
} | ||
}, | ||
"OpenTelemetry.Exporter.Prometheus.AspNetCore": { | ||
"type": "Transitive", | ||
"resolved": "1.7.0-rc.1", | ||
"contentHash": "tlA8oDOZoyFAkKA5StEPdzCyFf/6N/8y0Ymjae1dJYEfxPmNrcrtEHxuxtd0h5GwrIKnVpkb/hJMopHOErnSqQ==", | ||
"dependencies": { | ||
"OpenTelemetry": "1.7.0-rc.1" | ||
} | ||
}, | ||
"OpenTelemetry.Extensions.Hosting": { | ||
"type": "Transitive", | ||
"resolved": "1.7.0", | ||
"contentHash": "MbB7CWWqb7xHK0jTF9Gtvw/eLWdaKqzkE1XAwLe05xyskHuwJWAbZFax4nGLA71YkMWQNO5iPIBlirvYXOLMlg==", | ||
"dependencies": { | ||
"Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", | ||
"Microsoft.Extensions.Hosting.Abstractions": "8.0.0", | ||
"OpenTelemetry": "1.7.0" | ||
} | ||
}, | ||
"OpenTelemetry.Instrumentation.AspNetCore": { | ||
"type": "Transitive", | ||
"resolved": "1.7.1", | ||
"contentHash": "H6Br/PNxNJ9s0BS/iW8n7e8EivS3ovXTQnzrGBsYBHA4tsI/YuclNpTAntHBdXP+ziwu4dNRRahOBFtAk2hiZw==", | ||
"dependencies": { | ||
"OpenTelemetry.Api.ProviderBuilderExtensions": "1.7.0" | ||
} | ||
}, | ||
"System.Diagnostics.DiagnosticSource": { | ||
"type": "Transitive", | ||
"resolved": "8.0.0", | ||
"contentHash": "c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ==" | ||
}, | ||
"zupit.prometheus": { | ||
"type": "Project", | ||
"dependencies": { | ||
"Microsoft.Extensions.DependencyInjection.Abstractions": "[8.0.0, )", | ||
"OpenTelemetry.Exporter.Prometheus.AspNetCore": "[1.7.0-rc.1, )", | ||
"OpenTelemetry.Extensions.Hosting": "[1.7.0, )", | ||
"OpenTelemetry.Instrumentation.AspNetCore": "[1.7.1, )" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Xunit; |
Oops, something went wrong.