Sometimes when it is not possible to pull e.g. - nodes behind LB or there is a worker like daemon or windows service that does not have HTTP endpoint still there is way to push your metrics to Pushgateway server that you can install from here.
dotnet add package Prometheus.Client.MetricPusher
One push. You can use Timer for regularly push to Pushgateway:
var pusher = new MetricPusher(new MetricPusherOptions { Endpoint = "http://localhost:9091", Job = "pushgateway", Instance = "instance" }); await pusher.PushAsync();
Push with Auth:
var pusher = new MetricPusher(new MetricPusherOptions { Endpoint = "http://localhost:9091", Job = "pushgateway", Instance = "instance", AdditionalHeaders = new Dictionary<string, string> { { "Authorization", "Bearer " + accessToken } } });
Background server:
var pusher = new MetricPusher(new MetricPusherOptions { Endpoint = "http://localhost:9091", Job = "pushgateway" }); var worker = new MetricPushServer(pusher); worker.Start(); // code worker.Stop();
Contributions to the package are always welcome!
All contents of this package are licensed under the MIT license.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4