Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring cometd client #1268

Open
inspire99 opened this issue Nov 20, 2022 · 1 comment
Open

Monitoring cometd client #1268

inspire99 opened this issue Nov 20, 2022 · 1 comment
Labels

Comments

@inspire99
Copy link

CometD version(s) 5

Java version & vendor (use: java -version) Java 11

Question

I would like to monitor cometd client and check it's health from time to time.

Are there hooks within bayeuxclient which would help me do that ?

Ultimately want to expose metrics to Prometheus which will track the health of cometd clients.

Sometimes we have seen that some thread which receives the data messages is stuck, due to which subsequent meta connect doesn't go through. And sometimes there are errors from server which stops the client.

@sbordet
Copy link
Member

sbordet commented Nov 21, 2022

BayeuxClient is currently not exposed for monitoring although its components can be exposed.

You can see an example of exposing BayeuxClient starting from this line:
https://github.com/cometd/cometd/blob/7.0.9/cometd-java/cometd-java-benchmark/cometd-java-benchmark-client/src/main/java/org/cometd/benchmark/client/CometDLoadClient.java#L352

Right now it exposes some isXYZ() methods related to its internal state.
You can add a TransportListener to be notified of transport events (messages sent or received).

Health tracking can be done by sending a special health message from the client to the server, and see if you get a reply from the server (but it requires the server to understand and reply to those messages).

For /meta/ messages, you can easily register a listener and be notified, for example, of /meta/connect messages and derive from there their rate, when the last was sent/received, its content, etc.

There is nothing pre-made, but depending on what exactly you need, you should be able to setup what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants