HydraNPS is a session rating service for the Hydra streaming infrastructure. It receives a record for every streaming session that ends, whether the user rated it or not. This gives visibility into total sessions vs. rated sessions, with full session context (duration, body, district, ICE type, disconnect count).
Ratings use a 1-10 scale (half-star precision with 5 visual stars). Unrated sessions have score: null.
curl https://hydranps.experiencenet.com/api/v1/health
Config at ~/.hydranps/config.yaml:
server:
domain: "hydranps.experiencenet.com"
admin_token: "<secure-token>"
Dev mode:
server:
listen: ":8080"
admin_token: "dev-token"
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/ratings | Bearer (admin) | Submit a session record |
| GET | /api/v1/ratings | Bearer (admin) | List all ratings (optional ?experience= filter) |
| GET | /api/v1/health | none | Health check |
| GET | /api/v1/runbook | none | Raw markdown runbook |
| GET | /admin | cookie | Ratings dashboard |
| GET | /docs | none | Documentation (redirect) |
| GET | /docs/{section} | none | Documentation viewer |
Submit a session record. Called by hydraneckwebrtc workers at session end.
{
"experience": "rupelmonde",
"score": 7,
"session_id": "abc123",
"body_ip": "10.0.0.2",
"district": "visit-flanders",
"end_reason": "quit",
"duration_ms": 342000,
"ice_candidate_type": "relay",
"disconnect_count": 0
}
session_id is requiredscore is optional (omit or null for unrated sessions). If present, must be 1-10end_reason values: quit (user clicked exit), timeout (idle timeout), error (process died), shutdown (worker restarting)List all session records. Optionally filter by experience:
curl -H "Authorization: Bearer <token>" \
"https://hydranps.experiencenet.com/api/v1/ratings?experience=rupelmonde"
OnSessionEnd callback firesNPSRecord from the telemetry report and sends it to hydranps via POST /api/v1/ratingsratings.yaml with a unique ID and timestampBrowser --> hydraneckwebrtc worker --> session ends --> OnSessionEnd callback
| |
| (optional rating via star widget) v
| POST /api/v1/ratings
v |
telemetry.SetRating(id, score) v
hydranps stores record
Access at https://hydranps.experiencenet.com/admin (requires login).
Shows:
nps section in config with correct URL and tokenjournalctl -u hydraneckwebrtc -f | grep npscurl https://hydranps.experiencenet.com/api/v1/healthls -la /root/.hydranps/config.yamlEnvironment=HOME=/rootjournalctl -u hydranps -fjournalctl -u hydranps -f
# Key log prefixes
# [nps] - rating submissions (session ID, experience, score, end reason)
git tag v<X.Y.Z>git push origin v<X.Y.Z>