This message was deleted.
# opal
s
This message was deleted.
o
Hi @Rajat 🙂
can the opal-server save some state to which clients it published to and which all clients have successfully made the update and reverted back to opal-server
Yes, 1. This is available via the Statistics feature, you turn it on with
OPAL_STATISTICS_ENABLED=true
and then query
/statistics
on the OPAL server 2. You can also query each OPAL client health-check / or even create a specific Rego policy to query which uses that healthcheck state Note - for clarity - the client callbacks don’t have to be to the OPAL-server- they will open up http connections to the URLs you configure for them; so you can easily create a reporting/ logging service this way- if you need more than the basic topic tracking the OPAL server currently provides
Also, if you need more than this- please consider upgrading the statistics feature and contributing it back via a pull request.
r
Thanks @Or Weis. On hitting the statistics endpoint, i get an empty response with only the server-uptime being present
there are 2 instances of opal-server up and running
both of them apparently seem to not have any clients connected but i do have 1 client connected
o
1. Are there clients connected and subscribed to topics? 2. Did you configure the broadcast channel between the servers?
r
yep, they are subscribed to the default
policy_data
topic
and i did configure the server to use a redis backbone
o
Mmm… 🤔 Can you share the logs for the OPAL servers?
@Asaf Cohen, @Ori Shavit, @OBD gmail - any suggestions?
Oh- I know! Did you set
OPAL_STATISTICS_ENABLED=true
on the clients as well?
r
yep
Copy code
2022-12-22T11:19:12.339820+0000 | opal_server.statistics         | INFO | Serving statistics
2022-12-22T11:19:12.340503+0000 | uvicorn.protocols.http.httptools_impl  | INFO | 172.31.80.108:41126 - "GET /statistics HTTP/1.1" 200
o
Mmm. Damn - I thought that was a good guess.
r
on a side note, it’s a websocket connection only, right?
as in, not a pub-sub based architecture but rather a websocket connection is established between client and server, right?
o
Would need more of the logs. - we want to see these logs:
"Set client statistics {client_id} on channel {rpc_id} with {topics}"
as in, not a pub-sub based architecture but rather a websocket connection is established between client and server, right?
Yes the pub/sub is a protocol on top of the websocket
Specifically this (if you’re curious) : https://github.com/permitio/fastapi_websocket_pubsub
r
aah, makes sense. as for the other logs, let me see if i can grab them
thanks @Or Weis ✌️
💪 1
😇 1
a
Hi @Rajat 🙂
Before publishing to the clients, can the opal-server save some state to which clients it published to and which all clients have successfully made the update and reverted back to opal-server?
The opal server can receive the callbacks from the clients and thus you will see in the logs what updates where successful. Other than that - the statistics features is only tracking which clients are currently connected so it's a bit limited in that regard. We are planning to expand the statistics feature in the near future, but if you want to contribute something back we would be happy to guide you.