Skip to content

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
@SagiROosto SagiROosto force-pushed the master branch 2 times, most recently from 1a5fba8 to 7efcbc0 Compare November 27, 2024 11:48
@SagiROosto
Copy link
Author

hey @SuperQ, can you take a look?

@SagiROosto
Copy link
Author

Happy Birthday to the PR 🎂🥳
@SuperQ can you help progressing this PR and hopefully merge if the PR OK?

done

./pushprox-client --log.level=debug --proxy-url=http://localhost:8080 &
./pushprox-client --log.level=debug --proxy-url=http://localhost:8080 --fqdn $(hostname) &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed?

Copy link
Author

@SagiROosto SagiROosto Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably failed my tests but now it pass so I reverted it

@SuperQ
Copy link
Contributor

SuperQ commented Nov 26, 2025

Seems mostly fine. A couple questions.

Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
Signed-off-by: SagiROosto <sagi.rosenthal@oosto.com>
@SagiROosto
Copy link
Author

@SuperQ yea you got a point I reverted these odd changes and now it simply work as expected

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.

2 participants