Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

eclipse hono - How to know the number of device connections in gateway mode?

My device connect to Hono MQTT adapter via a gateway. I want to know the number of devices currently connected.

I can only find some metrics from this documentation(https://www.eclipse.org/hono/docs/api/metrics/) One metrics named "hono.connections.authenticated" indicates that current number of connected authenticated devices. But I can only see the number of gateway connections from this indicator, what I want to know is the number of connections for non-gateway devices

enter image description here

So does hono provide corresponding metrics indicating the number of non-gateway devices?

Thanks for any useful suggestions.

question from:https://stackoverflow.com/questions/65838681/how-to-know-the-number-of-device-connections-in-gateway-mode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As you correctly pointed out, the hono.connections.authenticated gauge also tells you how many devices are currently connected to any of Hono's protocol adapters which have successfully authenticated. Because edge devices that connect via a gateway do not themselves get authenticated by adapters (only the gateway is being authenticated and is then trusted to act on behalf of the edge devices), this gauge does not include such edge devices.

I currently do not see how these edge devices could be included in that gauge, simply because the protocol adapters only get to see them once they start sending data or the gateway subscribes to commands on their behalf.

What you could do is evaluate the hono.messages.received timer in order to determine the number of distinct devices that have sent/received data during a particular period of time, e.g. the last 2 minutes. Assuming that the data is being collected by a Prometheus server, the corresponding meter to query would be hono_messages_received_seconds_count.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...