Skip to content

Commit f44b02a

Browse files
JozefielJozef Volak
andauthored
[performance-monitor] Add performance monitor API (FRINXio#99)
Co-authored-by: Jozef Volak <[email protected]>
1 parent a99525f commit f44b02a

File tree

12 files changed

+1010
-0
lines changed

12 files changed

+1010
-0
lines changed

.github/workflows/pr-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
- 'schellar/python/**'
4141
topology-discovery/python:
4242
- 'topology-discovery/python/**'
43+
performance-monitor/python:
44+
- 'performance-monitor/python/**'
4345
uniconfig/python:
4446
- 'uniconfig/python/**'
4547
utils/graphql-pydantic-converter:

.github/workflows/publish-package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
- 'frinx-inventory-server/python/RELEASE.md'
2222
resource-manager/python:
2323
- 'resource-manager/python/RELEASE.md'
24+
performance-monitor/python:
25+
- 'performance-monitor/python/RELEASE.md'
2426
schellar/python:
2527
- 'schellar/python/RELEASE.md'
2628
topology-discovery/python:

performance-monitor/python/CHANGELOG.md

Whitespace-only changes.

performance-monitor/python/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Frinx Performance Monitor Api in Python
2+
3+
4+
Performance Monitor Graphql Schema transformed to Pydantic basemodel.
5+
This package has been tested with Python 3.10.
6+
7+
8+
## Getting started
9+
10+
```python
11+
12+
```
13+
### Prerequisites
14+
15+
- Python 3.10+ is required to use this package.
16+
- Usage with grapqhl-pydantic-converter
17+
18+
### Install the package
19+
20+
```bash
21+
poetry add git+https://github.com/FRINXio/frinx-services-python-api.git@main#subdirectory=performance-monitor/python
22+
```

performance-monitor/python/RELEASE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Release matrix
2+
3+
| Docker Image Tag | Python Library Version |
4+
|------------------|------------------------|
5+
| 6.0.3 | 0.0.1 |
6+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: '3.8'
2+
3+
services:
4+
monitor-postgres:
5+
image: timescale/timescaledb:latest-pg16
6+
restart: always
7+
environment:
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
healthcheck:
11+
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
12+
interval: 10s
13+
timeout: 5s
14+
retries: 5
15+
start_period: 10s
16+
17+
kafka:
18+
image: bitnami/kafka:3.5.1
19+
env_file:
20+
- ./env_files/.env_kafka
21+
healthcheck:
22+
test: kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --create --if-not-exists && kafka-topics.sh --bootstrap-server kafka:9092 --topic hc --describe
23+
start_period: 50s
24+
interval: 10s
25+
timeout: 10s
26+
retries: 10
27+
depends_on:
28+
monitor-postgres:
29+
condition: service_healthy
30+
31+
performance-monitor:
32+
image: frinx/performance-monitor:${IMAGE_TAG:?}
33+
depends_on:
34+
kafka:
35+
condition: service_healthy
36+
healthcheck:
37+
test: curl --fail -s -X GET http://localhost:8000/api/liveness-healthcheck
38+
interval: 5s
39+
timeout: 10s
40+
retries: 10
41+
env_file:
42+
- ./env_files/.env_performance_monitor
43+
44+
converter:
45+
image: frinx/graphql-pydantic-converter:1.2.0
46+
restart: on-failure
47+
depends_on:
48+
kafka:
49+
condition: service_healthy
50+
volumes:
51+
- ./frinx_api/performance_monitor/:/home/
52+
command: '--url http://performance-monitor:8000/api/graphql -o /home/__init__.py'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
KAFKA_CFG_NODE_ID=0
2+
KAFKA_CFG_PROCESS_ROLES=controller,broker
3+
KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
4+
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
5+
KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:9094
6+
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093
7+
KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
##### KAFKA variables
2+
PM_KAFKA__TOPICS__GNMI_NOTIFICATIONS_TOPIC=gnmi-notifications
3+
PM_KAFKA__TOPICS__DEVICE_INVENTORY_TOPIC=device-inventory
4+
PM_KAFKA__BOOTSTRAP_SERVERS=["kafka:9092"]
5+
6+
##### DB variables
7+
PM_DB__DB_NAME=postgres
8+
PM_DB__DB_HOST=monitor-postgres
9+
PM_DB__DB_USER=postgres
10+
PM_DB__DB_PASSWORD=postgres
11+
PM_DB__DB_PORT=5432
12+
PM_DB__DB_MIGRATIONS_DIR=./migrations

performance-monitor/python/frinx_api/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)