Skip to content

feat(metrics_server): Add Bandit support#266

Open
odarriba wants to merge 3 commits intoakoutmos:masterfrom
bluelabs-eu:support-bandit-metrics-server
Open

feat(metrics_server): Add Bandit support#266
odarriba wants to merge 3 commits intoakoutmos:masterfrom
bluelabs-eu:support-bandit-metrics-server

Conversation

@odarriba
Copy link
Copy Markdown

@odarriba odarriba commented Jun 5, 2025

Change description

Updaters the metrics server child spec to support Bandit if available, as it is the new standard in Phoenix.

What problem does this solve?

It solves the need of exposing metrics in an internal port while using Bandit as the Plug server in newer/updated Phoenix apps.

Related issues: #265

Example usage

  1. Create a new Phoenix app with Bandit
  2. Add PromEx and configure the metrics server:
config :your_app, YourApp.PromEx,
  metrics_server: [
    port: 9200,
    path: "/metrics",
    protocol: :http,
    auth_strategy: :none
  ]

Additional details and screenshots

Screenshot of the standalone metrics server starting with Bandit:

image

Checklist

  • My changes have passed unit tests and have been tested E2E in an real project.

@odarriba
Copy link
Copy Markdown
Author

odarriba commented Aug 1, 2025

@akoutmos I'm not surte if this lib is still maintained, just in case pinging you to see if we can get a review at some point 🙏 Thanks for your time and work for this lib 🙌

@a3kov
Copy link
Copy Markdown

a3kov commented Aug 8, 2025

This code still generates a compiler warning because it refers to modules that may not be available.
The warning is present in the current version of PromEx too btw, so you could call this PR a bugfix (once you fix the warning of course).

@odarriba
Copy link
Copy Markdown
Author

odarriba commented Aug 8, 2025

This code still generates a compiler warning because it refers to modules that may not be available. The warning is present in the current version of PromEx too btw, so you could call this PR a bugfix (once you fix the warning of course).

If you can test it again, now it should not emit any warning I think 🤔

@a3kov
Copy link
Copy Markdown

a3kov commented Aug 8, 2025

I'm using my fork already at least until this project starts accepting PRs again.
But yeah, declaring code conditionally should fix it.

@odarriba
Copy link
Copy Markdown
Author

odarriba commented Mar 3, 2026

@akoutmos Any news on this? With this easy fix we will be solving compilation warnings on any new Phoenix app that uses Bandit by default 🙏

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

Successfully merging this pull request may close these issues.

2 participants