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: 3 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 (11 months ago)
- Last Synced: 2024-04-13T18:32:34.283Z (10 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
[](https://github.com/prom-client-net/prom-client-metricpusher/actions/workflows/ci.yml)
[](https://www.nuget.org/packages/Prometheus.Client.MetricPusher)
[](https://www.nuget.org/packages/Prometheus.Client.MetricPusher)
[](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).