testcontainers / testcontainers/testcontainers-python

New Container: Prometheus

Open
#1,075 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🚀 enhancement
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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.