OpenTelemetry OpAMP server in Python with FastAPI + Streamlit UI. Optional integration with Open Policy Agent.
This server also lets you:
- Filter collectors by metadata (such as
environment: production) - Build minimal OTel Collectors (server generates a new
manifest.yamlwhich you build with the OpenTelemetry Collector Builder [OCB]) - Validate connected collectors against OPA compliance policies
┌─────────────────────────┐ ┌─────────────────┐ ┌──────────────┐
│ OTel Collector │───────▶│ OpAMP Server │────────│ UI (:8501) │
│ (OpAMP Extension) │ │ (:4320) │ │ │
└─────────────────────────┘ └─────────────────┘ └──────────────┘
│
┌────────┴──────────────┐
│ Open Policy Agent │ (optional)
│ (:8181) │
└───────────────────────┘
python -m venv ./venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn server.main:app --port 4320pip install -r requirements-ui.txt
streamlit run ui/app.pyModify collector YAML by adding the opamp extension:
extensions:
opamp:
server:
http:
endpoint: http://127.0.0.1:4320/v1/opamp| Variable | Default | Description |
|---|---|---|
SERVER_HTTP_SCHEME |
http |
HTTP scheme |
SERVER_ADDRESS |
localhost |
Server bind address |
SERVER_PORT |
4320 |
Server port |
AGENT_TIMEOUT_SECONDS |
60 |
Seconds before stale agent removed |
DATA_DIR |
data |
SQLite database directory |
Configure via UI at /alerts endpoint. Webhook sends JSON with event_type and message.
| event_type | Trigger |
|---|---|
new_agent |
New agent connects |
agent_disconnected |
Agent becomes stale |
compliance_violation |
OPA policy fails |
⚠️ Warning: Enable alerts will cause alert spam until issue #27 is resolved.
Run OPA server, then set OPA_ENABLED=true.
| Variable | Default | Description |
|---|---|---|
OPA_ENABLED |
false |
Enable OPA compliance |
OPA_URL |
http://localhost:8181 |
OPA server URL |
POLICIES_DIR |
policies/tags |
Policies directory |
docker run --rm -it -p 8181:8181 -v $(pwd)/policies:/policies \
openpolicyagent/opa run --server --bundle /policies --watchAdd package opamp.agent.compliance.<name> policies to policies/tags/.
| Endpoint | Method | Description |
|---|---|---|
/v1/opamp |
POST | OpAMP connection |
/metrics |
GET | Prometheus metrics |
/agents |
GET | List agents |
/agent/{id} |
GET | Agent details |
/health |
GET | Health check |
pip install -r requirements.txt
pip install -r requirements-ui.txt
pytest tests/ -vopamp-server-py/
├── server/ # FastAPI server
├── ui/ # Streamlit dashboard
├── proto/ # Protobuf definitions
├── tests/ # Tests
├── collector/ # Sample configs
└── data/ # SQLite DB