Files
csharp/examples/prometheus/Prometheus.cs
Manuel Menegazzo f615b5b459 Fix some compilation warnings (#1010)
* Fixe some summary warning

* Fixed more warning

* Uniformed example projects code

* Uniformed test projects code

* Fix OperatingSystems enum and GenericType summaries
2022-09-15 16:21:21 -07:00

32 lines
881 B
C#
Executable File

using k8s;
using k8s.Monitoring;
using Prometheus;
using System;
using System.Net.Http;
using System.Threading;
namespace prom
{
internal class Prometheus
{
private static void Main(string[] args)
{
var config = KubernetesClientConfiguration.BuildDefaultConfig();
var handler = new PrometheusHandler();
IKubernetes client = new Kubernetes(config, new DelegatingHandler[] { handler });
var server = new MetricServer(hostname: "localhost", port: 1234);
server.Start();
Console.WriteLine("Making requests!");
while (true)
{
client.CoreV1.ListNamespacedPod("default");
client.CoreV1.ListNode();
client.AppsV1.ListNamespacedDeployment("default");
Thread.Sleep(1000);
}
}
}
}