Compare commits

..
1 Commits
6 changed files with 3133 additions and 17 deletions
+11 -5
View File
@@ -53,15 +53,21 @@ try {
$process_id = strval($pid);
} catch (PDOException $e) {}
// --- WebSocket connections (estimate from pg_class) ---
// --- WebSocket connections (count distinct wsi_pointer with active subscriptions) ---
$ws_connections = 0;
try {
$est = intval($pdo->query("SELECT reltuples FROM pg_class WHERE relname = 'subscriptions'")->fetchColumn());
$ws_connections = max(0, intval($est * 0.2));
$ws_connections = intval($pdo->query(
"SELECT COUNT(DISTINCT wsi_pointer) FROM subscriptions WHERE event_type = 'created' AND ended_at IS NULL"
)->fetchColumn());
} catch (PDOException $e) {}
// --- Active subscriptions (same estimate) ---
$active_subscriptions = $ws_connections;
// --- Active subscriptions (count open subscription rows) ---
$active_subscriptions = 0;
try {
$active_subscriptions = intval($pdo->query(
"SELECT COUNT(*) FROM subscriptions WHERE event_type = 'created' AND ended_at IS NULL"
)->fetchColumn());
} catch (PDOException $e) {}
// --- Memory usage ---
$memory_usage = '-';
+13 -8
View File
@@ -31,18 +31,23 @@ try {
$process_id = strval($pid);
} catch (PDOException $e) {}
// WebSocket connections: tracked in-memory by the relay (g_connection_count).
// The subscriptions table is a 32M-row historical log, not a live state table.
// Use pg_class for an instant estimate (updated by autovacuum).
// WebSocket connections: count distinct wsi_pointer values with active subscriptions.
// The subscriptions table is a historical log, so we filter for rows where
// event_type = 'created' AND ended_at IS NULL (i.e., still open).
$ws_connections = 0;
try {
$est = intval($pdo->query("SELECT reltuples FROM pg_class WHERE relname = 'subscriptions'")->fetchColumn());
// ~60% are 'created', ~40% are 'closed' — active ≈ created - closed
$ws_connections = max(0, intval($est * 0.2));
$ws_connections = intval($pdo->query(
"SELECT COUNT(DISTINCT wsi_pointer) FROM subscriptions WHERE event_type = 'created' AND ended_at IS NULL"
)->fetchColumn());
} catch (PDOException $e) {}
// Active subscriptions: same estimate approach.
$active_subscriptions = $ws_connections;
// Active subscriptions: count rows where event_type = 'created' AND ended_at IS NULL.
$active_subscriptions = 0;
try {
$active_subscriptions = intval($pdo->query(
"SELECT COUNT(*) FROM subscriptions WHERE event_type = 'created' AND ended_at IS NULL"
)->fetchColumn());
} catch (PDOException $e) {}
// Memory/CPU (from /proc on Linux)
$memory_usage = '-';
+1 -1
View File
@@ -1 +1 @@
[{"kind":1,"count":2135,"pct":96.7},{"kind":6,"count":41,"pct":1.9},{"kind":30023,"count":11,"pct":0.5},{"kind":10002,"count":8,"pct":0.4},{"kind":0,"count":5,"pct":0.2},{"kind":3,"count":4,"pct":0.2},{"kind":10000,"count":4,"pct":0.2}]
[{"kind":1,"count":28402,"pct":89.4},{"kind":6,"count":2631,"pct":8.3},{"kind":30078,"count":184,"pct":0.6},{"kind":10002,"count":169,"pct":0.5},{"kind":5,"count":76,"pct":0.2},{"kind":4,"count":65,"pct":0.2},{"kind":0,"count":63,"pct":0.2},{"kind":3,"count":35,"pct":0.1},{"kind":30023,"count":32,"pct":0.1},{"kind":36787,"count":24,"pct":0.1},{"kind":30267,"count":21,"pct":0.1},{"kind":7375,"count":16,"pct":0.1},{"kind":7376,"count":15,"pct":0},{"kind":9321,"count":8,"pct":0},{"kind":10000,"count":8,"pct":0},{"kind":9999,"count":7,"pct":0},{"kind":30004,"count":4,"pct":0},{"kind":7,"count":3,"pct":0},{"kind":1311,"count":3,"pct":0},{"kind":33301,"count":2,"pct":0}]
+1 -1
View File
@@ -1 +1 @@
[{"pubkey":"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f","name":"mleku","count":572,"pct":25.9},{"pubkey":"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c","name":"Vitor Pamplona","count":564,"pct":25.5},{"pubkey":"1ec454734dcbf6fe54901ce25c0c7c6bca5edd89443416761fadc321d38df139","name":"Laan Tungir","count":525,"pct":23.8},{"pubkey":"4d7842051782e0d3feb034d150adc2b6bae4ee3b49786793bffa468b6f5b96b3","name":"FLASH","count":509,"pct":23.1},{"pubkey":"52a3e82f7b3743852fbe804cfcbf4db3448115887895247c001f2b50e790acb8","name":"Didactyl Agent","count":34,"pct":1.5},{"pubkey":"fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52","name":"","count":1,"pct":0},{"pubkey":"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa","name":"","count":1,"pct":0},{"pubkey":"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2","name":"","count":1,"pct":0},{"pubkey":"8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e","name":"","count":1,"pct":0}]
[{"pubkey":"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f","name":"mleku","count":13987,"pct":44},{"pubkey":"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2","name":"jack","count":6486,"pct":20.4},{"pubkey":"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c","name":"Vitor Pamplona","count":3938,"pct":12.4},{"pubkey":"1ec454734dcbf6fe54901ce25c0c7c6bca5edd89443416761fadc321d38df139","name":"Laan Tungir","count":3738,"pct":11.8},{"pubkey":"4d7842051782e0d3feb034d150adc2b6bae4ee3b49786793bffa468b6f5b96b3","name":"FLASH","count":1372,"pct":4.3},{"pubkey":"fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52","name":"PABLOF7z","count":552,"pct":1.7},{"pubkey":"8ff74724ed641b3c28e5a86d7c5cbc49c37638ace8c6c38935860e7a5eedde0e","name":"WSB","count":531,"pct":1.7},{"pubkey":"c558c7cc69bbda3c271782b736babc64acd2da258b14f356dbca966cb0b7b89e","name":"","count":163,"pct":0.5},{"pubkey":"cd31cbf4f750002b48c4371e8d0337be4c380fbedeaa9774956162599b727208","name":"","count":39,"pct":0.1},{"pubkey":"52a3e82f7b3743852fbe804cfcbf4db3448115887895247c001f2b50e790acb8","name":"Didactyl Agent","count":34,"pct":0.1},{"pubkey":"3a25abe5c5f41f274657ed59c65455f8c969a84d922fab3845675b69c1e842e2","name":"","count":30,"pct":0.1},{"pubkey":"bfc1ed709912efc0be42024cde4147b70517dc9a2329ec7a86fe0a0d0fb3c33d","name":"","count":21,"pct":0.1},{"pubkey":"f8b063e710b7844303493bd65b2d239b3279177ab51bed463dd64edf6a424b88","name":"","count":18,"pct":0.1},{"pubkey":"5c3b08d9e3d457418bf9104dcc87ede76a05a68c6c4c2d981f48c28cd8aba07d","name":"","count":16,"pct":0.1},{"pubkey":"cf21d2a85a588ce73e2fe8e44459335e06121801cde55f0339da9ee2b4f4d56f","name":"","count":12,"pct":0},{"pubkey":"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa","name":"","count":11,"pct":0},{"pubkey":"08c6657385c506f242a0f4474b9fd4f0cbd488544972df116910b79d3e5b72b2","name":"","count":10,"pct":0},{"pubkey":"1d28171b0c3a3a452cc7102c02a555e57900fbbc57d48d1e3585823870692e9e","name":"","count":9,"pct":0},{"pubkey":"a13d0cca4316d76227dcaabc59d22a0bd63ad73d723355c3645c66408dc9223a","name":"","count":8,"pct":0},{"pubkey":"8bf4d2aa23b4adc25c0a7a9a758814958e9abb1eebcfb8ebb76d10ab91679238","name":"","count":8,"pct":0}]
+3105
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -13,8 +13,8 @@
// Using CRELAY_ prefix to avoid conflicts with nostr_core_lib VERSION macros
#define CRELAY_VERSION_MAJOR 2
#define CRELAY_VERSION_MINOR 1
#define CRELAY_VERSION_PATCH 36
#define CRELAY_VERSION "v2.1.36"
#define CRELAY_VERSION_PATCH 37
#define CRELAY_VERSION "v2.1.37"
// Relay metadata (authoritative source for NIP-11 information)
#define RELAY_NAME "C-Relay-PG"