move the client logic out of main pkg so it can be reused.
Summary
This PR refactors the Prometheus Pushprox client to move its core logic outside the main package, enabling it to be reused as a library in other projects. The primary motivation behind this change is to allow projects to integrate the proxy client directly into existing components, reducing the resource footprint significantly compared to running it as a standalone Docker container or binary.
Motivation
The original implementation of the Pushprox client was designed to run as a dedicated Docker container or a binary. While this works well in many scenarios, it introduces unnecessary overhead for projects that already have a metrics or health component and simply need to integrate the proxy client.
In my use case—likely shared by many others, especially in resource-constrained environments such as IoT devices—this overhead is critical. Running the client as part of an existing component saves resources and simplifies deployment without sacrificing functionality.
Changes
- Extracted the core logic of the Pushprox client into a separate, reusable package.
- Added context to the client so it can be easily cancelled and stopped by caller decision.
Benefits
- Reusability: Developers can import the Pushprox client logic directly into their applications, avoiding the need for an additional Docker container or binary process.
- Reduced Resource Footprint: In environments where resources are limited (e.g., IoT devices), integrating the client directly into existing components minimizes overhead.
- Flexibility: Projects can now tailor the client's behavior to fit their specific needs, enhancing adaptability across diverse use cases.
- Backward Compatibility: The original containerized and binary workflows remain intact, ensuring no disruption for existing users. In fact, no actual logical change was made to anyone uses the current workflow/client.
Impact
- No breaking changes for users leveraging the existing Docker or binary setup.
- Adds a new pathway for integrating the Pushprox client, expanding the utility of the project.
hey @SuperQ, can you take a look?
Happy Birthday to the PR 🎂🥳 @SuperQ can you help progressing this PR and hopefully merge if the PR OK?
Seems mostly fine. A couple questions.
@SuperQ yea you got a point I reverted these odd changes and now it simply work as expected