testcontainers / testcontainers/testcontainers-python
New Container: Prometheus
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 386
- Avg merge
- 4h 40m
- Merged PRs (30d)
- 1
Description
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:
- Docker image: https://hub.docker.com/r/prom/prometheus
- Prometheus docs: https://prometheus.io/docs/introduction/overview/
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files or tests are named. Start by reviewing existing testcontainers-python container implementations and the linked Prometheus documentation and Docker image; done means a PrometheusContainer can expose the UI/API, configure scrape targets or a custom prometheus.yml, and support readiness and configuration reload concerns described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, prometheus, python
- Domain
- devops, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100