permitio / opal

Policy and data administration, distribution, and real-time updates on top of Policy Agents (OPA, Cedar, ...)
https://opal.ac
Apache License 2.0
3.5k stars 154 forks source link

Improve Statistics and introduce server (and client) counts #589

Closed roekatz closed 3 weeks ago

roekatz commented 1 month ago
  1. Introduce ability to track count of server instances currently alive. (both as a new field under /statistics that lists their uuids, and in a new endpoint /stats that retrieves amount of opal servers and opal clients connected to the same broadcast channel.
  2. Fix tasks leaking by using TasksPool
  3. Added opal version in both /stats & /statistics

Examples:

> curl http://localhost:7002/stats     
{"uptime":"2024-05-26T16:21:52.895075","version":"0.7.6","client_count":3,"server_count":2}%                       
> curl http://localhost:7002/statistics 
{"uptime":"2024-05-23T14:52:14.461300","version":"0.7.6","clients":{"CLIENT_9e9023bba9ee4a53b13e4f02ae0fafe1":[{"rpc_id":"699b34bcfb6246cea01d9f519d64a549","client_id":"CLIENT_9e9023bba9ee4a53b13e4f02ae0fafe1","topics":["policy:."]},{"rpc_id":"f047f5bdc12f442b9a361392de691fd6","client_id":"CLIENT_9e9023bba9ee4a53b13e4f02ae0fafe1","topics":["policy_data"]}],"CLIENT_b8a52614b8434a298bd30fa43875ff13":[{"rpc_id":"70e21d276bc74e4d93a511d6ad6aa7b2","client_id":"CLIENT_b8a52614b8434a298bd30fa43875ff13","topics":["policy:."]},{"rpc_id":"ebe6a48a74b44833b44de251c85c752f","client_id":"CLIENT_b8a52614b8434a298bd30fa43875ff13","topics":["policy_data"]}],"CLIENT_64ba93657aab4ba3bd2fe780f2cdd569":[{"rpc_id":"fabd61db82f949c9aeb0f049eec6ecf8","client_id":"CLIENT_64ba93657aab4ba3bd2fe780f2cdd569","topics":["policy_data"]},{"rpc_id":"239ac052772c45de93524e6c03ed808b","client_id":"CLIENT_64ba93657aab4ba3bd2fe780f2cdd569","topics":["policy:."]}]},"servers":["110a98f18bee45ce85e470da43450a70","8e22985f497846f89d1783c7dd7221f1"]}%     
netlify[bot] commented 1 month ago

Deploy Preview for opal-docs canceled.

Name Link
Latest commit 731b10137c9a77569c91ef7699f66c81c926f5ba
Latest deploy log https://app.netlify.com/sites/opal-docs/deploys/66536294983cbf0008ac30e3