Skip to content

Commit

Permalink
Pattern matching and Listener optimisations (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala authored Aug 21, 2023
1 parent 6080a5b commit 5c93b51
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 131 deletions.
15 changes: 15 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ external_relay_ip =
:error -> external_listen_ip
end

listener_count =
case System.fetch_env("LISTENER_COUNT") do
{:ok, count} ->
count = String.to_integer(count)
if count <= 0, do: raise("LISTENER_COUNT must be greater than 0")
count

:error ->
System.schedulers_online()
end

# AuthProvider/credentials configuration
config :rel,
auth_provider_ip:
Expand Down Expand Up @@ -135,3 +146,7 @@ config :rel,
config :rel,
auth_secret: :crypto.strong_rand_bytes(64),
nonce_secret: :crypto.strong_rand_bytes(64)

# Other
config :rel,
listener_count: listener_count
199 changes: 164 additions & 35 deletions grafana/provisioning/dashboards/rel_metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 2,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -114,10 +113,23 @@
"exemplar": false,
"expr": "rate(turn_listener_client_inbound_traffic_total_bytes[$__interval]) * 8",
"instant": false,
"legendFormat": "Clients -> Listener",
"legendFormat": "Clients -> Listener {{ listener_id }}",
"range": true,
"refId": "client_listener"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "sum(rate(turn_listener_client_inbound_traffic_total_bytes[$__interval])) * 8",
"hide": false,
"instant": false,
"legendFormat": "Clients -> Listener (Total)",
"range": true,
"refId": "client_listener_total"
},
{
"datasource": {
"type": "prometheus",
Expand All @@ -136,6 +148,130 @@
"transparent": true,
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "series",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 11
},
"id": 7,
"options": {
"legend": {
"calcs": [
"lastNotNull",
"max",
"mean"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "rate(turn_listener_client_inbound_traffic_packets_total[$__interval])",
"instant": false,
"legendFormat": "Clients -> Listener {{listener_id}}",
"range": true,
"refId": "client_listener"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "sum(rate(turn_listener_client_inbound_traffic_packets_total[$__interval]))",
"hide": false,
"instant": false,
"legendFormat": "Client -> Listener (Total)",
"range": true,
"refId": "client_listener_total"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "rate(turn_allocations_peer_inbound_traffic_packets_total[$__interval])",
"hide": false,
"instant": false,
"legendFormat": "Peers -> Allocation_handlers",
"range": true,
"refId": "peers_allocation"
}
],
"title": "Packets",
"transparent": true,
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -198,7 +334,7 @@
"h": 9,
"w": 24,
"x": 0,
"y": 11
"y": 21
},
"id": 3,
"interval": "5",
Expand Down Expand Up @@ -331,7 +467,7 @@
"h": 9,
"w": 24,
"x": 0,
"y": 20
"y": 30
},
"id": 6,
"options": {
Expand All @@ -353,35 +489,28 @@
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "100 - (rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[$__rate_interval]) * 100)",
"expr": "100 - (rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[$__interval]) * 100)",
"instant": false,
"legendFormat": "Core {{cpu}}",
"range": true,
"refId": "cpu"
}
],
"title": "CPU usage",
"transformations": [
},
{
"id": "calculateField",
"options": {
"mode": "reduceRow",
"reduce": {
"include": [
"Core 0",
"Core 1",
"Core 2",
"Core 3",
"Core 4",
"Core 5",
"Core 6",
"Core 7"
],
"reducer": "sum"
}
}
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "sum(100 - (rate(node_cpu_seconds_total{job=\"node\",mode=\"idle\"}[$__interval]) * 100))",
"hide": false,
"instant": false,
"legendFormat": "Total",
"range": true,
"refId": "cpu_total"
}
],
"title": "CPU usage",
"transformations": [],
"transparent": true,
"type": "timeseries"
},
Expand Down Expand Up @@ -444,10 +573,10 @@
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"h": 9,
"w": 24,
"x": 0,
"y": 29
"y": 39
},
"id": 4,
"options": {
Expand Down Expand Up @@ -539,10 +668,10 @@
"overrides": []
},
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"y": 29
"h": 8,
"w": 24,
"x": 0,
"y": 48
},
"id": 5,
"options": {
Expand Down Expand Up @@ -597,13 +726,13 @@
"list": []
},
"time": {
"from": "now-5m",
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Rel metrics",
"uid": "f89914d6-5064-454e-bfb9-128f69816c36",
"version": 6,
"version": 1,
"weekStart": ""
}
Loading

0 comments on commit 5c93b51

Please sign in to comment.