Skip to content

Job name for pushgateway can't be a symbol #295

@ngoral

Description

@ngoral

After updating for a patch version I realized a job name, passed to Push can't be a symbol. (Thank me, I wrote the tests, and they failed, not production :) )
There's no such requirement in docs (or I missed it). So I passed symbols as names, no strings.

I am eager to help, but can't deside what to do: validate that job argument passed to Prometheus::Client::Push.new is a string, or just convert it to string inside?

It fails here: https://github.com/prometheus/client_ruby/blob/main/lib/prometheus/client/push.rb#L92
So we can add job.to_s there, or right in the initialize method as @job = job.to_s.
Or validate it at the beginning and raise an error, as other methods for metrics do

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions