add most documented metrics

This commit is contained in:
Georg Reinke 2020-04-14 21:24:37 +02:00
parent fdabba1a28
commit 8d47a7681d
No known key found for this signature in database
GPG key ID: E4990A07F73C807F
5 changed files with 358 additions and 55 deletions

View file

@ -4,6 +4,9 @@
Prometheus Exporter for Jitsi Meet written in Go. Based on [Jitsi Meet Exporter](https://git.autistici.org/ai3/tools/jitsi-prometheus-exporter) from [Autistici](https://www.autistici.org/) Prometheus Exporter for Jitsi Meet written in Go. Based on [Jitsi Meet Exporter](https://git.autistici.org/ai3/tools/jitsi-prometheus-exporter) from [Autistici](https://www.autistici.org/)
There's multiple different statistics endpoint that can be exposed by jitsi (like /stats and /colibri/stats); you can configure the used URL with the `videobridge-url`.
The exporter will handle both of them, but some metrics that aren't exposed may be reported as 0.
## Usage ## Usage
``` ```

2
go.mod
View file

@ -1,3 +1,5 @@
module github.com/systemli/prometheus-jitsi-meet-exporter module github.com/systemli/prometheus-jitsi-meet-exporter
go 1.14 go 1.14
require github.com/google/go-cmp v0.4.0

3
go.sum Normal file
View file

@ -0,0 +1,3 @@
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

125
main.go
View file

@ -14,33 +14,122 @@ var (
) )
type videoBridgeStats struct { type videoBridgeStats struct {
LargestConference int `json:"largest_conference"` Threads int `json:"threads"`
TotalParticipants int `json:"total_participants"` BitRateDownload int `json:"bit_rate_download"`
ConferenceSizes []int `json:"conference_sizes"` BitRateUpload int `json:"bit_rate_upload"`
TotalConferencesCreated int `json:"total_conferences_created"` PacketRateDownload int `json:"packet_rate_download"`
Conferences int `json:"conferences"` PacketRateUpload int `json:"packet_rate_upload"`
Participants int `json:"participants"` LossRateDownload float64 `json:"loss_rate_download"`
LossRateUpload float64 `json:"loss_rate_upload"`
JitterAggregate float64 `json:"jitter_aggregate"`
RTTAggregate float64 `json:"rtt_aggregate"`
LargestConference int `json:"largest_conference"`
ConferenceSizes []int `json:"conference_sizes"`
AudioChannels int `json:"audiochannels"`
VideoChannels int `json:"videochannels"`
Conferences int `json:"conferences"`
Participants int `json:"participants"`
Videostreams int `json:"videostreams"`
TotalLossControlledParticipantSeconds int `json:"total_loss_controlled_participant_seconds"`
TotalLossLimitedParticipantSeconds int `json:"total_loss_limited_participant_seconds"`
TotalLossDegradedParticipantSeconds int `json:"total_loss_degraded_participant_seconds"`
TotalConferenceSeconds int `json:"total_conference_seconds"`
TotalConferencesCreated int `json:"total_conferences_created"`
TotalFailedConferences int `json:"total_failed_conferences"`
TotalPartiallyFailedConferences int `json:"total_partially_failed_conferences"`
TotalDataChannelMessagesReceived int `json:"total_data_channel_messages_received"`
TotalDataChannelMessagesSent int `json:"total_data_channel_messages_sent"`
TotalColibriWebSocketMessagesReceived int `json:"total_colibri_web_socket_messages_received"`
TotalColibriWebSocketMessagesSent int `json:"total_colibri_web_socket_messages_sent"`
TotalParticipants int `json:"total_participants"`
} }
var tpl = template.Must(template.New("stats").Parse(`# HELP jitsi_total_participants Participants counter var tpl = template.Must(template.New("stats").Parse(`# HELP jitsi_threads The number of Java threads that the video bridge is using.
# TYPE jitsi_total_participants counter # TYPE jitsi_threads gauge
jitsi_total_participants {{.TotalParticipants}} jitsi_threads {{.Threads}}
# HELP jitsi_total_conferences_created Number of conferences created # HELP jitsi_bit_rate_download The total incoming bitrate for the video bridge in kilobits per second.
# TYPE jitsi_total_conferences_created counter # TYPE jitsi_bit_rate_download gauge
jitsi_total_conferences_created {{.TotalConferencesCreated}} jitsi_bit_rate_download {{.BitRateDownload}}
# HELP jitsi_largest_conference Participants in the largest conference # HELP jitsi_bit_rate_upload The total outgoing bitrate for the video bridge in kilobits per second.
# TYPE jitsi_bit_rate_upload gauge
jitsi_bit_rate_upload {{.BitRateUpload}}
# HELP jitsi_packet_rate_download The total incoming packet rate for the video bridge in packets per second.
# TYPE jitsi_packet_rate_download gauge
jitsi_packet_rate_download {{.PacketRateDownload}}
# HELP jitsi_packet_rate_upload The total outgoing packet rate for the video bridge in packets per second.
# TYPE jitsi_packet_rate_upload gauge
jitsi_packet_rate_upload {{.PacketRateUpload}}
# HELP jitsi_loss_rate_download The fraction of lost incoming RTP packets. This is based on RTP sequence numbers and is relatively accurate.
# TYPE jitsi_loss_rate_download gauge
jitsi_loss_rate_download {{.LossRateDownload}}
# HELP jitsi_loss_rate_upload The fraction of lost outgoing RTP packets. This is based on incoming RTCP Receiver Reports, and an attempt to subtract the fraction of packets that were not sent (i.e. were lost before they reached the bridge). Further, this is averaged over all streams of all users as opposed to all packets, so it is not correctly weighted. This is not accurate, but may be a useful metric nonetheless.
# TYPE jitsi_loss_rate_upload gauge
jitsi_loss_rate_upload {{.LossRateUpload}}
# HELP jitsi_jitter_aggregate Experimental. An average value (in milliseconds) of the jitter calculated for incoming and outgoing streams. This hasn't been tested and it is currently not known whether the values are correct or not.
# TYPE jitsi_jitter_aggregate gauge
jitsi_jitter_aggregate {{.JitterAggregate}}
# HELP jitsi_rtt_aggregate An average value (in milliseconds) of the RTT across all streams.
# TYPE jitsi_rtt_aggregate gauge
jitsi_rtt_aggregate {{.RTTAggregate}}
# HELP jitsi_largest_conference The number of participants in the largest conference currently hosted on the bridge.
# TYPE jitsi_largest_conference gauge # TYPE jitsi_largest_conference gauge
jitsi_largest_conference {{.LargestConference}} jitsi_largest_conference {{.LargestConference}}
# HELP jitsi_conferences Current number of active conferences # HELP jitsi_audiochannels The current number of audio channels.
# TYPE jitsi_audiochannels gauge
jitsi_audiochannels {{.AudioChannels}}
# HELP jitsi_videochannels The current number of video channels.
# TYPE jitsi_videochannels gauge
jitsi_videochannels {{.VideoChannels}}
# HELP jitsi_conferences The current number of conferences.
# TYPE jitsi_conferences gauge # TYPE jitsi_conferences gauge
jitsi_conferences {{.Conferences}} jitsi_conferences {{.Conferences}}
# HELP jitsi_participants Current number of active participants # HELP jitsi_participants The current number of participants.
# TYPE jitsi_participants gauge # TYPE jitsi_participants gauge
jitsi_participants {{.Participants}} jitsi_participants {{.Participants}}
# HELP jitsi_videostreams An estimation of the number of current video streams forwarded by the bridge.
# TYPE jitsi_videostreams gauge
jitsi_videostreams {{.Videostreams}}
# HELP jitsi_total_loss_controlled_participant_seconds The total number of participant-seconds that are loss-controlled.
# TYPE jitsi_total_loss_controlled_participant_seconds counter
jitsi_total_loss_controlled_participant_seconds {{.TotalLossControlledParticipantSeconds}}
# HELP jitsi_total_loss_limited_participant_seconds The total number of participant-seconds that are loss-limited.
# TYPE jitsi_total_loss_limited_participant_seconds counter
jitsi_total_loss_limited_participant_seconds {{.TotalLossLimitedParticipantSeconds}}
# HELP jitsi_total_loss_degraded_participant_seconds The total number of participant-seconds that are loss-degraded.
# TYPE jitsi_total_loss_degraded_participant_seconds counter
jitsi_total_loss_degraded_participant_seconds {{.TotalLossDegradedParticipantSeconds}}
# HELP jitsi_total_conference_seconds The sum of the lengths of all completed conferences, in seconds.
# TYPE jitsi_total_conference_seconds counter
jitsi_total_conference_seconds {{.TotalConferenceSeconds}}
# HELP jitsi_total_conferences_created The total number of conferences created on the bridge.
# TYPE jitsi_total_conferences_created counter
jitsi_total_conferences_created {{.TotalConferencesCreated}}
# HELP jitsi_total_failed_conferences The total number of failed conferences on the bridge. A conference is marked as failed when all of its channels have failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_failed_conferences counter
jitsi_total_failed_conferences {{.TotalFailedConferences}}
# HELP jitsi_total_partially_failed_conferences The total number of partially failed conferences on the bridge. A conference is marked as partially failed when some of its channels has failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_partially_failed_conferences counter
jitsi_total_partially_failed_conferences {{.TotalPartiallyFailedConferences}}
# HELP jitsi_total_data_channel_messages_received The total number messages received through data channels.
# TYPE jitsi_total_data_channel_messages_received counter
jitsi_total_data_channel_messages_received {{.TotalDataChannelMessagesReceived}}
# HELP jitsi_total_data_channel_messages_sent The total number messages sent through data channels.
# TYPE jitsi_total_data_channel_messages_sent counter
jitsi_total_data_channel_messages_sent {{.TotalDataChannelMessagesSent}}
# HELP jitsi_total_colibri_web_socket_messages_received The total number messages received through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_received counter
jitsi_total_colibri_web_socket_messages_received {{.TotalColibriWebSocketMessagesReceived}}
# HELP jitsi_total_colibri_web_socket_messages_sent The total number messages sent through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_sent counter
jitsi_total_colibri_web_socket_messages_sent {{.TotalColibriWebSocketMessagesSent}}
`)) `))
func serveMetrics(w http.ResponseWriter, req *http.Request) { type handler struct {
resp, err := http.Get(*videoBridgeURL) sourceURL string
}
func (h handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
resp, err := http.Get(h.sourceURL)
if err != nil { if err != nil {
log.Printf("scrape error: %v", err) log.Printf("scrape error: %v", err)
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
@ -63,7 +152,7 @@ func main() {
log.SetFlags(0) log.SetFlags(0)
flag.Parse() flag.Parse()
http.HandleFunc("/metrics", serveMetrics) http.Handle("/metrics", handler{sourceURL: *videoBridgeURL})
if err := http.ListenAndServe(*addr, nil); err != nil { if err := http.ListenAndServe(*addr, nil); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View file

@ -1,55 +1,261 @@
package main package main
import ( import (
"log"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"testing" "testing"
"github.com/google/go-cmp/cmp"
) )
type constHandler struct {
s string
}
func (h constHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(h.s))
}
func TestGetMetrics(t *testing.T) { func TestGetMetrics(t *testing.T) {
req, err := http.NewRequest("GET", "/metrics", nil) tcs := []struct {
if err != nil { statsJson string
t.Fatal(err) expected string
} }{
{
go func() { statsJson: `{"largest_conference":3,"total_sip_call_failures":0,"total_participants":18,"conference_sizes":[0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bridge_selector":{"total_least_loaded_in_region":0,"total_split_due_to_load":0,"total_not_loaded_in_region_in_conference":0,"total_least_loaded_in_region_in_conference":0,"total_not_loaded_in_region":0,"total_split_due_to_region":0,"bridge_count":1,"operational_bridge_count":1,"total_least_loaded_in_conference":0,"total_least_loaded":3},"total_conferences_created":14,"total_recording_failures":0,"conferences":2,"total_live_streaming_failures":0,"participants":4}`,
http.HandleFunc("/stats", getJitsiVideobridgeStats) expected: `# HELP jitsi_threads The number of Java threads that the video bridge is using.
if err := http.ListenAndServe(":8888", nil); err != nil { # TYPE jitsi_threads gauge
log.Fatal(err) jitsi_threads 0
} # HELP jitsi_bit_rate_download The total incoming bitrate for the video bridge in kilobits per second.
}() # TYPE jitsi_bit_rate_download gauge
jitsi_bit_rate_download 0
rr := httptest.NewRecorder() # HELP jitsi_bit_rate_upload The total outgoing bitrate for the video bridge in kilobits per second.
handler := http.HandlerFunc(serveMetrics) # TYPE jitsi_bit_rate_upload gauge
handler.ServeHTTP(rr, req) jitsi_bit_rate_upload 0
# HELP jitsi_packet_rate_download The total incoming packet rate for the video bridge in packets per second.
if status := rr.Code; status != http.StatusOK { # TYPE jitsi_packet_rate_download gauge
t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK) jitsi_packet_rate_download 0
} # HELP jitsi_packet_rate_upload The total outgoing packet rate for the video bridge in packets per second.
# TYPE jitsi_packet_rate_upload gauge
var expected = `# HELP jitsi_total_participants Participants counter jitsi_packet_rate_upload 0
# TYPE jitsi_total_participants counter # HELP jitsi_loss_rate_download The fraction of lost incoming RTP packets. This is based on RTP sequence numbers and is relatively accurate.
jitsi_total_participants 18 # TYPE jitsi_loss_rate_download gauge
# HELP jitsi_total_conferences_created Number of conferences created jitsi_loss_rate_download 0
# TYPE jitsi_total_conferences_created counter # HELP jitsi_loss_rate_upload The fraction of lost outgoing RTP packets. This is based on incoming RTCP Receiver Reports, and an attempt to subtract the fraction of packets that were not sent (i.e. were lost before they reached the bridge). Further, this is averaged over all streams of all users as opposed to all packets, so it is not correctly weighted. This is not accurate, but may be a useful metric nonetheless.
jitsi_total_conferences_created 14 # TYPE jitsi_loss_rate_upload gauge
# HELP jitsi_largest_conference Participants in the largest conference jitsi_loss_rate_upload 0
# HELP jitsi_jitter_aggregate Experimental. An average value (in milliseconds) of the jitter calculated for incoming and outgoing streams. This hasn't been tested and it is currently not known whether the values are correct or not.
# TYPE jitsi_jitter_aggregate gauge
jitsi_jitter_aggregate 0
# HELP jitsi_rtt_aggregate An average value (in milliseconds) of the RTT across all streams.
# TYPE jitsi_rtt_aggregate gauge
jitsi_rtt_aggregate 0
# HELP jitsi_largest_conference The number of participants in the largest conference currently hosted on the bridge.
# TYPE jitsi_largest_conference gauge # TYPE jitsi_largest_conference gauge
jitsi_largest_conference 3 jitsi_largest_conference 3
# HELP jitsi_conferences Current number of active conferences # HELP jitsi_audiochannels The current number of audio channels.
# TYPE jitsi_audiochannels gauge
jitsi_audiochannels 0
# HELP jitsi_videochannels The current number of video channels.
# TYPE jitsi_videochannels gauge
jitsi_videochannels 0
# HELP jitsi_conferences The current number of conferences.
# TYPE jitsi_conferences gauge # TYPE jitsi_conferences gauge
jitsi_conferences 2 jitsi_conferences 2
# HELP jitsi_participants Current number of active participants # HELP jitsi_participants The current number of participants.
# TYPE jitsi_participants gauge # TYPE jitsi_participants gauge
jitsi_participants 4 jitsi_participants 4
` # HELP jitsi_videostreams An estimation of the number of current video streams forwarded by the bridge.
# TYPE jitsi_videostreams gauge
jitsi_videostreams 0
# HELP jitsi_total_loss_controlled_participant_seconds The total number of participant-seconds that are loss-controlled.
# TYPE jitsi_total_loss_controlled_participant_seconds counter
jitsi_total_loss_controlled_participant_seconds 0
# HELP jitsi_total_loss_limited_participant_seconds The total number of participant-seconds that are loss-limited.
# TYPE jitsi_total_loss_limited_participant_seconds counter
jitsi_total_loss_limited_participant_seconds 0
# HELP jitsi_total_loss_degraded_participant_seconds The total number of participant-seconds that are loss-degraded.
# TYPE jitsi_total_loss_degraded_participant_seconds counter
jitsi_total_loss_degraded_participant_seconds 0
# HELP jitsi_total_conference_seconds The sum of the lengths of all completed conferences, in seconds.
# TYPE jitsi_total_conference_seconds counter
jitsi_total_conference_seconds 0
# HELP jitsi_total_conferences_created The total number of conferences created on the bridge.
# TYPE jitsi_total_conferences_created counter
jitsi_total_conferences_created 14
# HELP jitsi_total_failed_conferences The total number of failed conferences on the bridge. A conference is marked as failed when all of its channels have failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_failed_conferences counter
jitsi_total_failed_conferences 0
# HELP jitsi_total_partially_failed_conferences The total number of partially failed conferences on the bridge. A conference is marked as partially failed when some of its channels has failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_partially_failed_conferences counter
jitsi_total_partially_failed_conferences 0
# HELP jitsi_total_data_channel_messages_received The total number messages received through data channels.
# TYPE jitsi_total_data_channel_messages_received counter
jitsi_total_data_channel_messages_received 0
# HELP jitsi_total_data_channel_messages_sent The total number messages sent through data channels.
# TYPE jitsi_total_data_channel_messages_sent counter
jitsi_total_data_channel_messages_sent 0
# HELP jitsi_total_colibri_web_socket_messages_received The total number messages received through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_received counter
jitsi_total_colibri_web_socket_messages_received 0
# HELP jitsi_total_colibri_web_socket_messages_sent The total number messages sent through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_sent counter
jitsi_total_colibri_web_socket_messages_sent 0
`,
},
{
statsJson: `{
"audiochannels": 0,
"bit_rate_download": 0,
"bit_rate_upload": 0,
"conference_sizes": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"conferences": 0,
"current_timestamp": "2019-03-14 11:02:15.184",
"graceful_shutdown": false,
"jitter_aggregate": 0,
"largest_conference": 0,
"loss_rate_download": 0,
"loss_rate_upload": 0,
"packet_rate_download": 0,
"packet_rate_upload": 0,
"participants": 0,
"region": "eu-west-1",
"relay_id": "10.0.0.5:4096",
"rtp_loss": 0,
"rtt_aggregate": 0,
"threads": 59,
"total_bytes_received": 257628359,
"total_bytes_received_octo": 0,
"total_bytes_sent": 257754048,
"total_bytes_sent_octo": 0,
"total_colibri_web_socket_messages_received": 0,
"total_colibri_web_socket_messages_sent": 0,
"total_conference_seconds": 470,
"total_conferences_completed": 1,
"total_conferences_created": 1,
"total_data_channel_messages_received": 602,
"total_data_channel_messages_sent": 600,
"total_failed_conferences": 0,
"total_ice_failed": 0,
"total_ice_succeeded": 2,
"total_ice_succeeded_tcp": 0,
"total_loss_controlled_participant_seconds": 847,
"total_loss_degraded_participant_seconds": 1,
"total_loss_limited_participant_seconds": 0,
"total_packets_dropped_octo": 0,
"total_packets_received": 266644,
"total_packets_received_octo": 0,
"total_packets_sent": 266556,
"total_packets_sent_octo": 0,
"total_partially_failed_conferences": 0,
"total_participants": 2,
"videochannels": 0,
"videostreams": 0
}`,
expected: `# HELP jitsi_threads The number of Java threads that the video bridge is using.
# TYPE jitsi_threads gauge
jitsi_threads 59
# HELP jitsi_bit_rate_download The total incoming bitrate for the video bridge in kilobits per second.
# TYPE jitsi_bit_rate_download gauge
jitsi_bit_rate_download 0
# HELP jitsi_bit_rate_upload The total outgoing bitrate for the video bridge in kilobits per second.
# TYPE jitsi_bit_rate_upload gauge
jitsi_bit_rate_upload 0
# HELP jitsi_packet_rate_download The total incoming packet rate for the video bridge in packets per second.
# TYPE jitsi_packet_rate_download gauge
jitsi_packet_rate_download 0
# HELP jitsi_packet_rate_upload The total outgoing packet rate for the video bridge in packets per second.
# TYPE jitsi_packet_rate_upload gauge
jitsi_packet_rate_upload 0
# HELP jitsi_loss_rate_download The fraction of lost incoming RTP packets. This is based on RTP sequence numbers and is relatively accurate.
# TYPE jitsi_loss_rate_download gauge
jitsi_loss_rate_download 0
# HELP jitsi_loss_rate_upload The fraction of lost outgoing RTP packets. This is based on incoming RTCP Receiver Reports, and an attempt to subtract the fraction of packets that were not sent (i.e. were lost before they reached the bridge). Further, this is averaged over all streams of all users as opposed to all packets, so it is not correctly weighted. This is not accurate, but may be a useful metric nonetheless.
# TYPE jitsi_loss_rate_upload gauge
jitsi_loss_rate_upload 0
# HELP jitsi_jitter_aggregate Experimental. An average value (in milliseconds) of the jitter calculated for incoming and outgoing streams. This hasn't been tested and it is currently not known whether the values are correct or not.
# TYPE jitsi_jitter_aggregate gauge
jitsi_jitter_aggregate 0
# HELP jitsi_rtt_aggregate An average value (in milliseconds) of the RTT across all streams.
# TYPE jitsi_rtt_aggregate gauge
jitsi_rtt_aggregate 0
# HELP jitsi_largest_conference The number of participants in the largest conference currently hosted on the bridge.
# TYPE jitsi_largest_conference gauge
jitsi_largest_conference 0
# HELP jitsi_audiochannels The current number of audio channels.
# TYPE jitsi_audiochannels gauge
jitsi_audiochannels 0
# HELP jitsi_videochannels The current number of video channels.
# TYPE jitsi_videochannels gauge
jitsi_videochannels 0
# HELP jitsi_conferences The current number of conferences.
# TYPE jitsi_conferences gauge
jitsi_conferences 0
# HELP jitsi_participants The current number of participants.
# TYPE jitsi_participants gauge
jitsi_participants 0
# HELP jitsi_videostreams An estimation of the number of current video streams forwarded by the bridge.
# TYPE jitsi_videostreams gauge
jitsi_videostreams 0
# HELP jitsi_total_loss_controlled_participant_seconds The total number of participant-seconds that are loss-controlled.
# TYPE jitsi_total_loss_controlled_participant_seconds counter
jitsi_total_loss_controlled_participant_seconds 847
# HELP jitsi_total_loss_limited_participant_seconds The total number of participant-seconds that are loss-limited.
# TYPE jitsi_total_loss_limited_participant_seconds counter
jitsi_total_loss_limited_participant_seconds 0
# HELP jitsi_total_loss_degraded_participant_seconds The total number of participant-seconds that are loss-degraded.
# TYPE jitsi_total_loss_degraded_participant_seconds counter
jitsi_total_loss_degraded_participant_seconds 1
# HELP jitsi_total_conference_seconds The sum of the lengths of all completed conferences, in seconds.
# TYPE jitsi_total_conference_seconds counter
jitsi_total_conference_seconds 470
# HELP jitsi_total_conferences_created The total number of conferences created on the bridge.
# TYPE jitsi_total_conferences_created counter
jitsi_total_conferences_created 1
# HELP jitsi_total_failed_conferences The total number of failed conferences on the bridge. A conference is marked as failed when all of its channels have failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_failed_conferences counter
jitsi_total_failed_conferences 0
# HELP jitsi_total_partially_failed_conferences The total number of partially failed conferences on the bridge. A conference is marked as partially failed when some of its channels has failed. A channel is marked as failed if it had no payload activity.
# TYPE jitsi_total_partially_failed_conferences counter
jitsi_total_partially_failed_conferences 0
# HELP jitsi_total_data_channel_messages_received The total number messages received through data channels.
# TYPE jitsi_total_data_channel_messages_received counter
jitsi_total_data_channel_messages_received 602
# HELP jitsi_total_data_channel_messages_sent The total number messages sent through data channels.
# TYPE jitsi_total_data_channel_messages_sent counter
jitsi_total_data_channel_messages_sent 600
# HELP jitsi_total_colibri_web_socket_messages_received The total number messages received through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_received counter
jitsi_total_colibri_web_socket_messages_received 0
# HELP jitsi_total_colibri_web_socket_messages_sent The total number messages sent through COLIBRI web sockets.
# TYPE jitsi_total_colibri_web_socket_messages_sent counter
jitsi_total_colibri_web_socket_messages_sent 0
`,
},
}
if rr.Body.String() != expected { for _, tc := range tcs {
t.Error("Response does not match the expected string") srv := httptest.NewServer(constHandler{tc.statsJson})
h := handler{
sourceURL: srv.URL,
}
req, err := http.NewRequest("GET", "/metrics", nil)
if err != nil {
t.Fatal(err)
}
rr := httptest.NewRecorder()
h.ServeHTTP(rr, req)
if status := rr.Code; status != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK)
}
if rr.Body.String() != tc.expected {
t.Errorf("Response does not match the expected string:\n%s", cmp.Diff(rr.Body.String(), tc.expected))
}
srv.Close()
} }
} }
func getJitsiVideobridgeStats(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(`{"largest_conference":3,"total_sip_call_failures":0,"total_participants":18,"conference_sizes":[0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bridge_selector":{"total_least_loaded_in_region":0,"total_split_due_to_load":0,"total_not_loaded_in_region_in_conference":0,"total_least_loaded_in_region_in_conference":0,"total_not_loaded_in_region":0,"total_split_due_to_region":0,"bridge_count":1,"operational_bridge_count":1,"total_least_loaded_in_conference":0,"total_least_loaded":3},"total_conferences_created":14,"total_recording_failures":0,"conferences":2,"total_live_streaming_failures":0,"participants":4}`))
}