Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move the client logic out of main pkg so it can be reused. #191

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SagiROosto
Copy link

@SagiROosto SagiROosto commented Nov 26, 2024

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.

@SagiROosto SagiROosto changed the title move the client logic out of main func so it can be reused. move the client logic out of main pkg so it can be reused. Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant