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

Feature request: allow passing base URL instead of host + port for Gateway constructor #654

Open
rutgerbrf opened this issue Aug 1, 2023 · 0 comments

Comments

@rutgerbrf
Copy link

Recently, I found myself wanting to use prometheus-cpp in push mode. As I already had VictoriaMetrics running, which exposes a Pushgateway-compatible API at /api/v1/import/prometheus, it seemed unnecessary to install an extra Pushgateway component.

However, prometheus-cpp does not support setting a base URL for the Gateway class constructor: it only takes a host and port as connection information.

In the end, I succesfully macgyvered a solution that puts the path after the port number. More specifically: my program takes a base URL as a configuration parameter, this URL gets chopped into two parts: scheme + host and port + path. It is currently possible to pass the scheme combined with the host in the host parameter of the Gateway constructor, as it does not handle IPv6 addresses correctly. (Or at least, for an IPv6 address, the user would have to add square brackets around the address themselves. Should I file an issue for this too?)

Of course, what I made here is not exactly a clean solution. It would be nice if it would be possible to pass a base URL to the Gateway constructor instead.

@rutgerbrf rutgerbrf changed the title Feature request: allow passing base URL instead of host+port for Gateway constructor Feature request: allow passing base URL instead of host + port for Gateway constructor Aug 1, 2023
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

No branches or pull requests

1 participant