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

Support for pushgateway groupping keys #30

Open
josegomezr opened this issue Jul 23, 2024 · 0 comments
Open

Support for pushgateway groupping keys #30

josegomezr opened this issue Jul 23, 2024 · 0 comments

Comments

@josegomezr
Copy link

josegomezr commented Jul 23, 2024

Yabeda doesn't offer a way to pass the the grouping_key param to the Prometheus PushGateway client.

See the parameter here:

https://github.com/prometheus/client_ruby/blob/main/lib/prometheus/client/push.rb#L31-L35

It allows for more granularity when pushing metrics to the push gateway.

Maybe something along the lines of:

# in lib/yabeda/prometheus.rb
def push_gateway(grouping_key: {})
  @push_gateway ||= ::Prometheus::Client::Push.new(
      job: ENV.fetch("PROMETHEUS_JOB_NAME", "yabeda"),
      gateway: ENV.fetch("PROMETHEUS_PUSH_GATEWAY", "http://localhost:9091"),
      grouping_key: grouping_key,
      open_timeout: 5, read_timeout: 30,
    )
end

so as the caller I could do:

Yabeda::Prometheus.push_gateway(grouping_key: { "key" => "value" }).add(Yabeda::Prometheus.registry)

Although it may be "surprising" that the groupping key persist throughout the lifecycle of the class, but given the volatile nature of the scenario using a push gateway it may be good enough (?)

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