File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818{
1919 imports = [
2020 ./integration-nginx.nix
21+ ./integration-prometheus.nix
2122 ./users.nix
2223 ( import ./gw-sharding.nix self )
2324 ( import ./pion-sfu.nix self )
Original file line number Diff line number Diff line change 1+ {
2+ config ,
3+ lib ,
4+ ...
5+ } :
6+
7+ let
8+ cfg = config . services . spacebarchat-server ;
9+ in
10+ {
11+ options . services . spacebarchat-server . prometheus = {
12+ enable = lib . mkEnableOption "prometheus integration" ;
13+ } ;
14+
15+ config = lib . mkIf ( cfg . enable && cfg . prometheus . enable ) {
16+ services . prometheus . scrapeConfigs = [
17+ {
18+ job_name = "spacebar-api-${ builtins . toString cfg . apiEndpoint . localPort } " ;
19+ scrape_interval = "1s" ;
20+ static_configs = [
21+ { targets = [ "localhost:${ builtins . toString cfg . apiEndpoint . localPort } " ] ; }
22+ ] ;
23+ }
24+ {
25+ job_name = "spacebar-gateway-${ builtins . toString cfg . gatewayEndpoint . localPort } " ;
26+ scrape_interval = "1s" ;
27+ static_configs = [
28+ { targets = [ "localhost:${ builtins . toString cfg . gatewayEndpoint . localPort } " ] ; }
29+ ] ;
30+ }
31+ {
32+ job_name = "spacebar-cdn-${ builtins . toString cfg . cdnEndpoint . localPort } " ;
33+ scrape_interval = "1s" ;
34+ static_configs = [
35+ { targets = [ "localhost:${ builtins . toString cfg . cdnEndpoint . localPort } " ] ; }
36+ ] ;
37+ }
38+ ]
39+ ++ ( lib . map ( port : {
40+ job_name = "spacebar-gateway-${ builtins . toString port } " ;
41+ scrape_interval = "1s" ;
42+ static_configs = [
43+ { targets = [ "localhost:${ builtins . toString port } " ] ; }
44+ ] ;
45+ } ) cfg . extraGatewayPorts ) ;
46+ } ;
47+ }
You can’t perform that action at this time.
0 commit comments