Feature Request: PrometheusContainer
What is the new container you'd like to have?
I'd like to propose a PrometheusContainer for integration testing with Prometheus.
Relevant resources:
Besides exposing the Prometheus UI/API, it could provide convenience methods to configure scrape targets and rules directly, without requiring users to write and mount a complete prometheus.yml, for example:
prometheus = (
PrometheusContainer()
.with_scrape_target("app", app_container, port=8080, metrics_path="/metrics")
.with_scrape_target("redis", redis_exporter)
)
The container could generate the corresponding prometheus.yml internally while still allowing users to provide a custom configuration file if needed.
Why not just use a generic container for this?
While DockerContainer("prom/prometheus") works, most tests usually need additional setup:
- Configuring scrape targets.
- Providing a Prometheus configuration.
- Waiting until Prometheus is ready to accept requests.
- Reload Prometheus on config change.
- etc.
Other references
A similar idea has already been discussed in the testcontainers-java
Feature Request: PrometheusContainer
What is the new container you'd like to have?
I'd like to propose a
PrometheusContainerfor integration testing with Prometheus.Relevant resources:
Besides exposing the Prometheus UI/API, it could provide convenience methods to configure scrape targets and rules directly, without requiring users to write and mount a complete
prometheus.yml, for example:The container could generate the corresponding
prometheus.ymlinternally while still allowing users to provide a custom configuration file if needed.Why not just use a generic container for this?
While
DockerContainer("prom/prometheus")works, most tests usually need additional setup:Other references
A similar idea has already been discussed in the testcontainers-java