Skip to content

Commit

Permalink
Add max/used concurrent TCP connections to Prometheus text-based 'get…
Browse files Browse the repository at this point in the history
…Metrics' REST endpoint

Signed-off-by: Sven Göthel <sven.gothel@collabora.com>
Change-Id: I68dccec09e7907a5d3561a3df10637b30815bcc1
  • Loading branch information
Sven Göthel committed Nov 9, 2024
1 parent 2764bcd commit ac66440
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions wsd/Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@ void Admin::getMetrics(std::ostringstream &metrics)
size_t memUsed = getTotalMemoryUsage();

metrics << "global_host_system_memory_bytes " << _totalSysMemKb * 1024 << std::endl;
metrics << "global_host_tcp_connections " << net::Defaults.maxExtConnections << std::endl;
metrics << "global_memory_available_bytes " << memAvail * 1024 << std::endl;
metrics << "global_memory_used_bytes " << memUsed * 1024 << std::endl;
metrics << "global_memory_free_bytes " << (memAvail - memUsed) * 1024 << std::endl;
Expand Down
1 change: 1 addition & 0 deletions wsd/AdminModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ void AdminModel::getMetrics(std::ostringstream &oss)
oss << "coolwsd_thread_count " << Util::getStatFromPid(getpid(), 19) << std::endl;
oss << "coolwsd_cpu_time_seconds " << Util::getCpuUsage(getpid()) / sysconf (_SC_CLK_TCK) << std::endl;
oss << "coolwsd_memory_used_bytes " << Util::getMemoryUsagePSS(getpid()) * 1024 << std::endl;
oss << "coolwsd_tcp_connections_used " << StreamSocket::getExternalConnectionCount() << std::endl;
oss << std::endl;

oss << "forkit_count " << getPidsFromProcName(std::regex("forkit"), nullptr) << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions wsd/metrics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ which can be found here: https://prometheus.io/docs/instrumenting/exposition_for
GLOBAL

global_host_system_memory_bytes - Total host system memory in bytes.
global_host_tcp_connections - Total host concurrent TCP connections.
global_memory_available_bytes – Memory available to our application in bytes. This is equal to global_host_system_memory_bytes * memproportion where memproportion represents the maximum percentage of system memory consumed by all of the Collabora Online, after which we start cleaning up idle documents. This parameter can be setup in coolwsd.xml.
global_memory_used_bytes – Total memory usage: PSS(coolwsd) + RSS(forkit) + Private_Dirty(all assigned coolkits).
global_memory_free_bytes - global_memory_available_bytes - global_memory_used_bytes
Expand All @@ -15,6 +16,7 @@ COOLWSD
coolwsd_thread_count – number of threads in the current coolwsd process.
coolwsd_cpu_time_seconds – the CPU usage by current coolwsd process.
coolwsd_memory_used_bytes – the memory used by current coolwsd process: PSS(coolwsd).
coolwsd_tcp_connections_used - number of used TCP connections.

FORKIT

Expand Down

0 comments on commit ac66440

Please sign in to comment.