Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KSZK
Schönherz Mátrix
games
Aggregator Backend
Commits
00e57836
Commit
00e57836
authored
Oct 03, 2021
by
Miklós Tóth
🤷
Browse files
Add active connections gauge
parent
0dc70bf6
Pipeline
#8895
passed with stages
in 1 minute and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
metrics/metrics.go
View file @
00e57836
...
...
@@ -16,3 +16,9 @@ var Votes = promauto.NewCounter(prometheus.CounterOpts{
Name
:
"votes"
,
Help
:
"number of votes counted"
,
})
var
ActiveConnections
=
promauto
.
NewGauge
(
prometheus
.
GaugeOpts
{
Namespace
:
"matrix"
,
Name
:
"active"
,
Help
:
"number of votes counted"
,
})
web/socket.go
View file @
00e57836
...
...
@@ -30,6 +30,8 @@ func broadcast(start bool) {
var
socketsByTeams
=
make
(
map
[
string
][]
sockjs
.
Session
)
func
socketHandler
(
session
sockjs
.
Session
)
{
go
metrics
.
ActiveConnections
.
Inc
()
defer
metrics
.
ActiveConnections
.
Dec
()
connectedSockets
=
append
(
connectedSockets
,
session
)
e
:=
sendMsg
(
session
,
&
resp
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment