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] Make it clear that metric_prefix is a list of atoms, or handle more gracefully #137

Open
DaniruKun opened this issue Apr 19, 2022 · 0 comments
Assignees

Comments

@DaniruKun
Copy link
Contributor

Is your feature request related to a problem? Please describe.
From the docs about PromEx.Plugins.Ecto it is unclear what is the type of the metric_prefix argument. The naive assumption is that it is a binary (or String), but looking at the code, it assumes a list of atoms is passed:

metric_prefix ++ [:repo, :init, :status, :info],

This is unclear behaviour that isn't documented or handled gracefully:

    ** (EXIT) an exception was raised:
        ** (ArgumentError) argument error
            :erlang.++("someapp_ecto", [:repo, :init, :status, :info])
            (prom_ex 1.7.1) lib/prom_ex/plugins/ecto.ex:92: PromEx.Plugins.Ecto.init_metrics/1
            (prom_ex 1.7.1) lib/prom_ex/plugins/ecto.ex:70: PromEx.Plugins.Ecto.event_metrics/1
            (prom_ex 1.7.1) lib/prom_ex.ex:604: PromEx.init_plugin/3

Describe the solution you would like to see

  1. Make it clear in the documentation what type is expected + a short example.2.
  2. Ideally, handle both types (e.g. if a snake_case prefix is supplied as a string, convert it to a list of atoms).

How would you expect this feature to work
A description of a possible API, behaviour, modules, etc.

Additional context
Add any other context or screenshots about the feature request here.

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

2 participants