This document describes the HTTP API exposed by both services in the project:
All endpoints accept and return application/json unless noted otherwise.
Base URL: depends on deployment. In development it listens on port 8000.
LogMessage{
"level": "INFO", // log level
"message": "text" // log message
}
LogPacket{
"id": "string", // unique identifier for the packet
"timestamp": 1700000000000, // Unix epoch millis
"messages": [LogMessage, ...]
}
| Method & Path | Description |
|---|---|
POST /analyse |
Submit a log packet for processing. |
GET /heartbeat |
Health probe. Returns analyser status. |
GET /custom_metrics |
Current packet/message counters. |
GET /metrics |
Prometheus metrics endpoint. |
POST /internal/simulate/fail |
Mark analyser as unhealthy. |
POST /internal/simulate/begin |
Mark analyser as healthy. |
POST /analyseRequest body: LogPacket
Response:
{
"id": "<packet id>"
}
GET /heartbeatResponse:
{
"alive": true
}
GET /custom_metricsResponse example:
{
"packets": 42,
"messages": 123,
"alive": true,
"app": "fastapi_analyser"
}
The /metrics endpoint exposes the default and custom Prometheus metrics.
The /internal/simulate/fail and /internal/simulate/begin endpoints are
primarily for testing the health‑check mechanism.
Base URL: by default http://localhost:8080.
LogMessageSame as in the Analyser API.
LogPacketSame as in the Analyser API.
Analyser{
"uuid": "string", // unique analyser identifier
"name": "string", // human readable name
"url": "http://host:port", // analyser base URL
"weight": 1.0 // relative load balancing weight
}
| Method & Path | Description |
|---|---|
GET /health |
Simple health check endpoint. |
POST /distributor/packet |
Enqueue a log packet for distribution. |
POST /distributor/analyser |
Register a new analyser instance. |
GET /distributor/analyser |
List all currently registered analysers. |
POST /distributor/packetRequest body: LogPacket
Response codes:
200 OK – packet was accepted.500 Internal Server Error – processing failed.POST /distributor/analyserRequest body: Analyser
Response codes:
200 OK – analyser registered.500 Internal Server Error – registration failed.GET /distributor/analyserReturns an array of Analyser objects.
Register an analyser and send a packet:
curl -XPOST http://localhost:8080/distributor/analyser \
-H "Content-Type: application/json" \
-d '{"uuid":"a1","name":"Analyser-1","url":"http://analyser:8000","weight":1.0}'
curl -XPOST http://localhost:8080/distributor/packet \
-H "Content-Type: application/json" \
-d '{"id":"p1","timestamp":1700000,"messages":[{"level":"INFO","message":"demo"}]}'