swift-server / swift-prometheus

Prometheus client library for Swift
https://swiftpackageindex.com/swift-server/swift-prometheus
Apache License 2.0
142 stars 30 forks source link

Added Prometheus PushGateway support #72

Closed snkirov closed 1 year ago

snkirov commented 2 years ago

Added support for the prometheus pushgateway.

Checklist

Motivation and Context

I needed a swift library, which would allow me to upload metrics to the pushgateway. I developed this solution and decided to suggest it as an improvement to the SwiftPrometheus library, as mentioned in #47.

Description

I did not change any of the existing functionalities, rather I added new ones. I added a repeating timer class, which allows for a process to be repeatedly triggered in the background. In addition to that I added two public functions to the Prometheus client, one for setting up the repeated pushes and one for tearing them down. There are two additional private helper functions, which should make the code easier to follow through.

I ran the available tests locally and also experimented with the framework in a personal project.

Once I receive confirmation that such a change is something that is welcome to this project, I will be more than happy to add additional tests and documentation.

There is a lot of code and I am open for improvements/ suggestions. I would be more than happy to contribute to this project!

snkirov commented 2 years ago

Hey @ktoso, I would be very grateful if you or any of the maintainers could give me some feedback on this PR😁

dankinsoid commented 1 year ago

@snkirov There is not enough opportunity to make requests with Auth headers