Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 6d3e3ad

Browse files
authored
Release v0.5.0 (#56)
* feat(api): Add support of configuration management API (#51) #minor * feat(ui): Add configuration management UI (#52) #minor Signed-off-by: hayk96 <hayko5999@gmail.com>
1 parent ffbdfd6 commit 6d3e3ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4743
-220
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 0.5.0 / 2024-12-06
4+
5+
* [REFACTOR] Created a `PrometheusAPIClient` class for core API functionalities such as creating/deleting rule files and updating/reloading configurations. Removed a duplicated validation function and moved it to the utils folder. Also Updated the architecture diagram. #53
6+
* [ENHANCEMENT] Introduced a new web page called Config Management for managing Prometheus configuration through a web interface. This page utilizes the /configs API. #52
7+
* [ENHANCEMENT] Introduces a new API /configs for Prometheus configuration (prometheus.yml).
8+
This API provides three methods: GET, PUT, and PATCH:
9+
- Fetch the existing configuration in JSON or YAML format.
10+
- Update the entire Prometheus configuration file.
11+
- Partially update specific sections of the configuration file. Adds an OpenAPI specification for the prometheus.yml #51
12+
* [CHANGE] The name of the page API Documentation has been renamed to **API Reference**. Changed server address in API reference page. #50
13+
314
## 0.4.2 / 2024-07-05
415

516
* [CHANGE] Replaced base64 encoded files in web assets (HTML, CSS) with common images and added a new route for images.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ enhances flexibility and automation in monitoring and alerting workflows.
6565
### Prerequisites
6666

6767
The following prerequisites are required to get up and running with this tool:
68-
- The Prometheus server's rules directory must be shared and accessible
69-
- The Prometheus lifecycle API must be enabled to allow requesting the /reload API
68+
- Prometheus server's rules directory and configuration file (prometheus.yml) must be shared and accessible
69+
- Prometheus lifecycle API must be enabled to allow requesting the /reload API
7070

7171
### Quick Start
7272

docs/examples/docker/docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ services:
1818
ports:
1919
- "5000:5000"
2020
volumes:
21+
- "./prometheus.yml:/app/prometheus.yml:rw"
2122
- "./rules:/app/rules:rw"
2223
command:
2324
- --prom.addr=http://prometheus:9090
25+
- --config.file=/app/prometheus.yml
2426
- --rule.path=/app/rules
2527
- --web.enable-ui=true

docs/images/architecture.png

33.8 KB
Loading

main.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
import uvicorn
1111
import sys
1212

13-
1413
args = arg_parser()
15-
prom_addr, rule_path = args.get("prom.addr"), args.get("rule.path")
1614
host, port = args.get("web.listen_address").split(":")
1715

18-
if not all([settings.check_rules_directory(rule_path),
19-
settings.check_fs_permissions(rule_path),
20-
settings.establish_prom_connection(prom_addr),
21-
settings.check_reload_api_status(prom_addr)]):
16+
if not all([settings.check_files_and_directories(),
17+
settings.check_fs_permissions(),
18+
settings.establish_prom_connection(),
19+
settings.check_reload_api_status()]):
2220
sys.exit()
2321

2422

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ email-validator==2.0.0
44
APScheduler==3.10.4
55
pytimeparse2==1.7.1
66
jsonschema==4.17.3
7+
starlette==0.35.1
78
requests==2.28.2
89
pydantic==1.10.7
910
fastapi==0.109.0

src/api/v1/api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from .. v1.endpoints import reverse_proxy, rules, policies, web, health, export
1+
from .. v1.endpoints import reverse_proxy, rules, policies, web, health, export, configs
22
from fastapi import APIRouter
33

44
api_router = APIRouter()
55
api_router.include_router(rules.router, prefix="/api/v1")
66
api_router.include_router(export.router, prefix="/api/v1")
77
api_router.include_router(policies.router, prefix="/api/v1")
8+
api_router.include_router(configs.router, prefix="/api/v1")
89
api_router.include_router(web.router, prefix="")
910
api_router.include_router(health.router, prefix="")
1011
api_router.add_route("/{path:path}", reverse_proxy._reverse_proxy, ["GET", "POST", "PUT"])

0 commit comments

Comments
 (0)