From fbc250ebfbbaf0e06737ad271f5ea8fc946517f7 Mon Sep 17 00:00:00 2001 From: 24kushang <102860007+24kushang@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:02:50 +0530 Subject: [PATCH] feat(prosody): openmetrics module support (#1832) add option to enable http_openmetrics --- docker-compose.yml | 2 ++ prosody/rootfs/defaults/prosody.cfg.lua | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0d33d54..08c7d39 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -262,9 +262,11 @@ services: - PROSODY_RESERVATION_REST_BASE_URL - PROSODY_ENABLE_RATE_LIMITS - PROSODY_ENABLE_S2S + - PROSODY_ENABLE_METRICS - PROSODY_GUEST_AUTH_TYPE - PROSODY_HTTP_PORT - PROSODY_LOG_CONFIG + - PROSODY_METRICS_ALLOWED_CIDR - PROSODY_MODE - PROSODY_RATE_LIMIT_LOGIN_RATE - PROSODY_RATE_LIMIT_SESSION_RATE diff --git a/prosody/rootfs/defaults/prosody.cfg.lua b/prosody/rootfs/defaults/prosody.cfg.lua index 6796fa4..59f8c97 100644 --- a/prosody/rootfs/defaults/prosody.cfg.lua +++ b/prosody/rootfs/defaults/prosody.cfg.lua @@ -12,7 +12,9 @@ {{ $GC_GEN_MAX_TH := .Env.GC_GEN_MAX_TH | default 100 -}} {{ $LOG_LEVEL := .Env.LOG_LEVEL | default "info" }} {{ $PROSODY_C2S_LIMIT := .Env.PROSODY_C2S_LIMIT | default "10kb/s" -}} +{{ $PROSODY_METRICS_ALLOWED_CIDR := .Env.PROSODY_METRICS_ALLOWED_CIDR | default "172.16.0.0/12" -}} {{ $PROSODY_HTTP_PORT := .Env.PROSODY_HTTP_PORT | default "5280" -}} +{{ $PROSODY_ENABLE_METRICS := .Env.PROSODY_ENABLE_METRICS | default "false" | toBool -}} {{ $PROSODY_ADMINS := .Env.PROSODY_ADMINS | default "" -}} {{ $PROSODY_ADMIN_LIST := splitList "," $PROSODY_ADMINS -}} {{ $TRUSTED_PROXIES := .Env.PROSODY_TRUSTED_PROXIES | default "127.0.0.1,::1" -}} @@ -108,6 +110,12 @@ modules_enabled = { "s2sout_override"; "s2s_whitelist"; {{ end -}} + + {{ if $PROSODY_ENABLE_METRICS }} + -- metrics collection functionality + "http_openmetrics"; + {{ end -}} + {{ if .Env.GLOBAL_MODULES }} "{{ join "\";\n\"" (splitList "," .Env.GLOBAL_MODULES) }}"; {{ end }} @@ -287,6 +295,13 @@ log = { {{ end }} } +{{ if $PROSODY_ENABLE_METRICS }} +-- Statistics Provider configuration +statistics = "internal" +statistics_interval = "manual" +openmetrics_allow_cidr = "{{ $PROSODY_METRICS_ALLOWED_CIDR }}" +{{ end }} + {{ if .Env.GLOBAL_CONFIG }} {{ join "\n" (splitList "\\n" .Env.GLOBAL_CONFIG) }} {{ end }}