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] Global metric prefix override #178

Open
clandry94 opened this issue Nov 3, 2022 · 0 comments
Open

[FEATURE] Global metric prefix override #178

clandry94 opened this issue Nov 3, 2022 · 0 comments
Assignees

Comments

@clandry94
Copy link
Contributor

clandry94 commented Nov 3, 2022

Is your feature request related to a problem? Please describe.
I'm currently instrumenting my Phoenix app with prometheus metrics exported to Datadog through the datadog-agent running as a sidecar. The sidecar automatically adds a prefix with the app name my_app.<metric name> and I'd like to remove the otp_app prefix name since it is redundant and all metrics now look like my_app.my_app_prom_ex_ecto_...

The only way I've found to work around this is by setting the metric_prefix for each individual plugin to []

[
      {Plugins.Beam, metric_prefix: []},
      {Plugins.Phoenix, router: MyApp.Router, endpoint: MyApp.Endpoint, metric_prefix: []},
      {Plugins.Ecto, metric_prefix: []},
      {Plugins.Oban, metric_prefix: []},
      {Plugins.Broadway, metric_prefix: []}
]

Unfortunately this also removes the prefixes added by each plugin like ecto_, oban_ etc.

The only option I've found that works is to copy paste the metric prefix from each plugin into a metric prefix override at the promex plugin setup like so

[
      {Plugins.Beam, metric_prefix: [:beam]},
      {Plugins.Phoenix, router: MyApp.Router, endpoint: MyApp.Endpoint, metric_prefix: [:phoenix]},
      {Plugins.Ecto, metric_prefix: [:ecto]},
      {Plugins.Oban, metric_prefix: [:oban]},
      {Plugins.Broadway, metric_prefix: [:broadway]}
]

Describe the solution you would like to see
I'd like to have the ability to set a global metrix prefix that overrides the otp_app default for all plugins and have the ability to remove the prefix altogether.

How would you expect this feature to work
Ideally this would work like it does for plugins and I could add it to the properties when I use PromEx`. ex:

No prefix

defmodule MyApp.PromEx do
  use PromEx, otp_app: :felt_server, metric_prefix: []
end

No prefix

defmodule MyApp.PromEx do
  use PromEx, otp_app: :felt_server, metric_prefix: ["something"]
end

This should apply to each plugin's prefixes so metrics would look like

something_ecto_repo_...

and so on.

Additional context
I saw there was some previous work to allow the customization at the metric prefix initially #42. Happy to continue this work and could be assigned to this feature and #137 which is related!

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