Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -357,32 +357,29 @@ jobs:
cmake --build --preset gh-prometheus-ubuntu-latest-cpp23
echo "::remove-matcher owner=cpp-prometheus"

- name: Create prometheus dir
run: mkdir -p prometheus_dir
- name: Create prometheus dirs
run: mkdir -p prometheus_dir/pull prometheus_dir/push

- name: Download Prometheus
run: curl -SL "https://github.com/prometheus/prometheus/releases/download/v2.45.1/prometheus-2.45.1.linux-amd64.tar.gz" | tar -xzC prometheus_dir/

- name: Run Prometheus
run: ./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/src/plugins/bmqprometheus/tests/prometheus_localhost.yaml --web.enable-lifecycle --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/data &
- name: Run Prometheus for "pull" mode
run: ./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/.github/workflows/ext/prometheus_localhost_pull.yaml --web.listen-address=0.0.0.0:9090 --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/pull &

- name: Run Prometheus for "push" mode
run: ./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/.github/workflows/ext/prometheus_localhost_push.yaml --web.listen-address=0.0.0.0:9092 --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/push &

- name: Run Pushgateway
run: |
# 30 Oct 2025, v1.11.2:
docker pull prom/pushgateway@sha256:c835998819105d84d484918908df132807c78c05f3e0e649df0c0479c6780d98
docker run -d -p 9091:9091 prom/pushgateway

- name: Run BMQPrometheus plugin integration test in "pull" mode
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m pull --no-docker

- name: Clear Prometheus database and restart
run: |
curl -X POST "http://localhost:9090/-/quit"
rm -rf prometheus_dir/data
./prometheus_dir/prometheus-2.45.1.linux-amd64/prometheus --config.file=${{ github.workspace }}/src/plugins/bmqprometheus/tests/prometheus_localhost.yaml --web.enable-lifecycle --storage.tsdb.path=${{ github.workspace }}/prometheus_dir/data &
- name: Prometheus plugin IT[pull]
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m pull --no-docker --prometheus-host localhost:9090

- name: Run Prometheus plugin integration test in "push" mode
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m push --no-docker
- name: Prometheus plugin IT[push]
run: ${{ github.workspace }}/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py -p ${{ github.workspace }}/build/blazingmq -m push --no-docker --prometheus-host localhost:9092

documentation:
name: "Documentation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ scrape_configs:
static_configs:
- targets: ['localhost:9090']

- job_name: 'gateway'
scrape_interval: 1s
honor_labels: true
static_configs:
- targets: ['localhost:9091']
labels:
group: 'pushgateway'
- job_name: 'bmq'
scrape_interval: 1s
static_configs:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ext/prometheus_localhost_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
global:
scrape_interval: 5s
evaluation_interval: 5s

scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9092']

- job_name: 'gateway'
scrape_interval: 1s
honor_labels: true
static_configs:
- targets: ['localhost:9091']
labels:
group: 'pushgateway'
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
-m {all,pull,push}, --mode {all,pull,push}
prometheus mode
--no-docker don't run Prometheus in docker, assume it is running on localhost
--prometheus-host PROMETHEUS_HOST
Prometheus server host:port to query (default: localhost:9090)

"""

Expand Down Expand Up @@ -100,6 +102,12 @@ def parse_arguments():
action="store_true",
help="don't run Prometheus in docker, assume it is running on localhost",
)
parser.add_argument(
"--prometheus-host",
type=str,
default=PROMETHEUS_HOST,
help="Prometheus server host:port to query",
)

return parser.parse_args()

Expand Down Expand Up @@ -245,7 +253,7 @@ def main(args):
plugin_path,
broker_path,
tool_path,
PROMETHEUS_HOST,
args.prometheus_host,
prometheus_docker_file_path,
mode,
)
Expand Down
Loading