akoutmos/prom_ex

[BUG]: Metrics server continues to run on default port even as well as port defined

Closed this issue · 3 comments

Describe the bug

When defining a port in the metrics_server config, the metrics endpoint will work on the defined port but also remain working on the default port of the server.

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

Use the following config in dev.exs or config.exs:

config :my_app, MyApp.PromEx,
  disabled: false,
  manual_metrics_start_delay: :no_delay,
  grafana: [
    host: "http://localhost:3000",
    username: "admin",
    password: "admin",
    upload_dashboards_on_start: true,
    annotate_app_lifecycle: true
  ],
  metrics_server: [
    port: 4021,
    auth_strategy: :none
  ]

Expected behavior

  • /metrics endpoint to only work on port 4021 and not port 4000.

Environment

  • Elixir version: 1.13.4
  • Erlang/OTP version: 24
  • Grafana version: 8.5.6
  • Prometheus version: 2.36.1

Additional Context

  • Console prints PromEx is starting a standalone metrics server on port 4021 over http

The only way to serve PromEx metrics via your Phoenix application is via the provided plug: https://github.com/akoutmos/prom_ex/blob/master/lib/prom_ex/plug.ex. Are you sure that that plug is not in your endpoint.ex file? If it is you can remove it since you have the standalone server running. Let me know if that doesn't work and I can dig in!

That was it - sorry! Thank you.

No worries! Glad it was an easy fix :)