This commit is contained in:
Michal 2024-08-17 02:54:33 +01:00
parent 576ce11da6
commit 630ae101e5
9 changed files with 7 additions and 6 deletions

View File

@ -2,12 +2,12 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; // Add this line using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Prometheus; using Prometheus;
namespace PrometheusExporterExample namespace PrometheusExporterEdenic
{ {
public class Program public class Program
{ {
@ -36,7 +36,9 @@ namespace PrometheusExporterExample
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
string EDENIC_API = Environment.GetEnvironmentVariable("EDENIC_API") ?? "placeholderapikey";
// Enable prometheus metrics // Enable prometheus metrics
app.UseMetricServer(); app.UseMetricServer();
app.UseHttpMetrics(); app.UseHttpMetrics();
@ -55,7 +57,6 @@ namespace PrometheusExporterExample
var ph = Metrics.CreateGauge("edenic_ph", "Edenic ph"); var ph = Metrics.CreateGauge("edenic_ph", "Edenic ph");
var temperature = Metrics.CreateGauge("edenic_temperature", "Edenic temperature"); var temperature = Metrics.CreateGauge("edenic_temperature", "Edenic temperature");
var ec = Metrics.CreateGauge("edenic_ec", "Edenic EC"); var ec = Metrics.CreateGauge("edenic_ec", "Edenic EC");
// Example of incrementing the counter
Task.Run(async () => Task.Run(async () =>
{ {
while (true) while (true)

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("DotNet.Docker")] [assembly: System.Reflection.AssemblyCompanyAttribute("DotNet.Docker")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+dcb756ad14d02f4c192f8fad0a900c95286ce9f9")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+576ce11da69fc49bd84f117e4ef563dcddf8a397")]
[assembly: System.Reflection.AssemblyProductAttribute("DotNet.Docker")] [assembly: System.Reflection.AssemblyProductAttribute("DotNet.Docker")]
[assembly: System.Reflection.AssemblyTitleAttribute("DotNet.Docker")] [assembly: System.Reflection.AssemblyTitleAttribute("DotNet.Docker")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
fc8adf85983639ac82ae2c50a5f3768b29189ea442e4bf491ed2593770deeff9 b12bdd851226df3620379f067a2d97b7fa0c5ed9735ed922b09da25c217f93e3