8000 Feature request: allow passing base URL instead of host + port for Gateway constructor · Issue #654 · jupp0r/prometheus-cpp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Feature request: allow passing base URL instead of host + port for Gateway constructor #654
Open
@rutgerbrf

Description

@rutgerbrf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0