Skip to content

Commit

Permalink
add room entry metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulexus committed Aug 19, 2022
1 parent e6a12c1 commit 496b2c8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
"github.com/CyCoreSystems/audimance/agenda"
"github.com/CyCoreSystems/audimance/internal/osc"
"github.com/CyCoreSystems/audimance/showtime"
"github.com/labstack/echo-contrib/prometheus"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo-contrib/prometheus"
prom "github.com/prometheus/client_golang/prometheus"
"github.com/labstack/gommon/log"
"golang.org/x/net/websocket"
)
Expand All @@ -43,6 +44,17 @@ var oscRoomIndex int
// instead of bundled ones
var debug bool

var (
metricRoomEntry *prom.CounterVec
)

func init() {
metricRoomEntry = prom.NewCounterVec(prom.CounterOpts{
Name: "audimance_room_load",
Help: "Total number of room loads",
}, []string{"kind"})
}

// Template contains an HTML templates for the web service
type Template struct {
templates *template.Template
Expand Down Expand Up @@ -220,6 +232,10 @@ func enterRoom(c echo.Context) error {
Room: r,
}

metricRoomEntry.With(prom.Labels{
"room": "spatial",
}).Add(1)

return ctx.Render(200, "room.html", data)
}

Expand Down Expand Up @@ -275,6 +291,10 @@ func roomTracks(c echo.Context) error {
Room: r,
}

metricRoomEntry.With(prom.Labels{
"room": "tracks",
}).Add(1)

return ctx.Render(200, "tracks.html", data)
}

Expand Down

0 comments on commit 496b2c8

Please sign in to comment.