Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PrometheusClientNet/Prometheus.Client.MetricPusher
Push metrics to a PushGateway for the Prometheus.Client
https://github.com/PrometheusClientNet/Prometheus.Client.MetricPusher
metrics prometheus prometheus-client
Last synced: about 2 months ago
JSON representation
Push metrics to a PushGateway for the Prometheus.Client
- Host: GitHub
- URL: https://github.com/PrometheusClientNet/Prometheus.Client.MetricPusher
- Owner: prom-client-net
- License: mit
- Created: 2017-09-18T12:46:49.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T01:52:54.000Z (9 months ago)
- Last Synced: 2024-04-13T18:32:34.283Z (9 months ago)
- Topics: metrics, prometheus, prometheus-client
- Language: C#
- Homepage:
- Size: 224 KB
- Stars: 15
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-dotnet-core - Prometheus.Client.MetricPusher - Push metrics to a PushGateaway for the Prometheus.Client. (Frameworks, Libraries and Tools / Code Analysis and Metrics)
- fucking-awesome-dotnet-core - Prometheus.Client.MetricPusher - Push metrics to a PushGateaway for the Prometheus.Client. (Frameworks, Libraries and Tools / Code Analysis and Metrics)
- awesome-dotnet-core - Prometheus.Client.MetricPusher - Push metrics to a PushGateaway for the Prometheus.Client. (Frameworks, Libraries and Tools / Code Analysis and Metrics)
README
# Prometheus.Client.MetricPusher
[![ci](https://img.shields.io/github/actions/workflow/status/prom-client-net/prom-client-metricpusher/ci.yml?branch=main&label=ci&logo=github&style=flat-square)](https://github.com/prom-client-net/prom-client-metricpusher/actions/workflows/ci.yml)
[![nuget](https://img.shields.io/nuget/v/Prometheus.Client.MetricPusher?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Prometheus.Client.MetricPusher)
[![nuget](https://img.shields.io/nuget/dt/Prometheus.Client.MetricPusher?logo=nuget&style=flat-square)](https://www.nuget.org/packages/Prometheus.Client.MetricPusher)
[![license](https://img.shields.io/github/license/prom-client-net/prom-client-metricpusher?style=flat-square)](https://github.com/prom-client-net/prom-client-metricpusher/blob/main/LICENSE)## PushGateway
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 PushGateaway server that you can install from [here](https://github.com/prometheus/pushgateway/releases).
## Install
```sh
dotnet add package Prometheus.Client.MetricPusher
```## Use
[Examples](https://github.com/prom-client-net/prom-examples)
One push. You can use Timer for regularly push to PushGateway:
```c#
var pusher = new MetricPusher(new MetricPusherOptions
{
Endpoint = "http://localhost:9091",
Job = "pushgateway",
Instance = "instance"
});await pusher.PushAsync();
```Push with Auth:
```c#
var pusher = new MetricPusher(new MetricPusherOptions
{
Endpoint = "http://localhost:9091",
Job = "pushgateway",
Instance = "instance",
AdditionalHeaders = new Dictionary { { "Authorization", "Bearer " + accessToken } }
});
```Background server:
```c#
var pusher = new MetricPusher(new MetricPusherOptions
{
Endpoint = "http://localhost:9091",
Job = "pushgateway"
});var worker = new MetricPushServer(pusher);
worker.Start();
// code
worker.Stop();
```## Contribute
Contributions to the package are always welcome!
* Report any bugs or issues you find on the [issue tracker](https://github.com/prom-client-net/prom-client-metricpusher/issues).
* You can grab the source code at the package's [git repository](https://github.com/prom-client-net/prom-client-metricpusher).## License
All contents of this package are licensed under the [MIT license](https://opensource.org/licenses/MIT).