OnDemand Exporter Grafana Dashboard Websocket Metrics

Hi,

I have deployed the ondemand_exporter to our OOD server with mod_status enabled in apache. The dashboard works well for PUNs and passenger app metrics, however the Websocket and Client metrics look wrong:

The total websocket connections is high but the unique number of connections is only 1 and client connections is 0. I’m wondering if the fact that we are running behind a reverse proxy is causing the total calculated, here, to be incorrect.

Any help would be appreciated.

Hey sorry for the delay - I’m not entirely sure what’s going on and it would take some time for me to dig into find out.

It could be as simple as a bug here where we’re counting API requests that just have the string websockify in it, but again, I’d have to dig in to be sure.

Hey Jeff,

I’m no expert in GO but the logic looks like client_connections is not incremented if it is a local connection, i.e. comes from “127.0.0.1”, which is what we are seeing, the ondemand_client_connections is 0. ondemand_websocket_connections on the other hand is non-zero and ondemand_unique_websocket_clients is 1:

        localClients := []string{fqdn, "localhost", "127.0.0.1"}
        ...
        if strings.Contains(request, "/node/") || strings.Contains(request, "/rnode/") ||strings.Contains(request, "websockify") {
			websocket_connections++
			if contains := sliceContains(unique_websocket_clients, client); !contains {
				unique_websocket_clients = append(unique_websocket_clients, client)
			}
		}
		if localClient := sliceContains(localClients, client); !localClient {
			client_connections++
			if contains := sliceContains(unique_client_connections, client); !contains {
				unique_client_connections = append(unique_client_connections, client)
			}
		}

I think this is our problem, due to the reverse proxy. I will try to fix it so it forwards non-local addresses.

Thanks for your help!

James