Use single metrics for selected candidates.

This commit is contained in:
Joachim Bauch 2025-11-13 14:43:15 +01:00
commit 826d6244f3
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
3 changed files with 8 additions and 16 deletions

View file

@ -60,8 +60,7 @@ The following metrics are available:
| `signaling_mcu_backend_bandwidth` | Gauge | 2.0.5 | The current bandwidth of signaling proxy backends in bytes per second | `url`, `direction` |
| `signaling_proxy_load` | Gauge | 2.0.5 | The current load of the signaling proxy | |
| `signaling_client_rtt` | Histogram | 2.0.5 | The roundtrip time of WebSocket ping messages in milliseconds | |
| `signaling_mcu_selected_local_candidate_total` | Counter | 2.0.5 | Total number of selected local candidates | `type`, `transport`, `family` |
| `signaling_mcu_selected_remote_candidate_total` | Counter | 2.0.5 | Total number of selected local candidates | `type`, `transport`, `family` |
| `signaling_mcu_selected_candidate_total` | Counter | 2.0.5 | Total number of selected candidates | `origin`, `type`, `transport`, `family` |
| `signaling_mcu_peerconnection_state_total` | Counter | 2.0.5 | Total number PeerConnection states | `state`, `reason` |
| `signaling_mcu_ice_state_total` | Counter | 2.0.5 | Total number of ICE connection states | `state` |
| `signaling_mcu_dtls_state_total` | Counter | 2.0.5 | Total number of DTLS connection states | `state` |

View file

@ -745,8 +745,8 @@ func (h *JanusEventsHandler) processEvent(event JanusEvent) {
case *JanusEventWebRTCPeerConnection:
statsJanusPeerConnectionStateTotal.WithLabelValues(evt.Connection, evt.Reason).Inc()
case *JanusEventWebRTCSelectedPair:
statsJanusSelectedLocalCandidateTotal.WithLabelValues(evt.Candidates.Local.Type, evt.Candidates.Local.Transport, fmt.Sprintf("ipv%d", evt.Candidates.Local.Family)).Inc()
statsJanusSelectedRemoteCandidateTotal.WithLabelValues(evt.Candidates.Remote.Type, evt.Candidates.Remote.Transport, fmt.Sprintf("ipv%d", evt.Candidates.Remote.Family)).Inc()
statsJanusSelectedCandidateTotal.WithLabelValues("local", evt.Candidates.Local.Type, evt.Candidates.Local.Transport, fmt.Sprintf("ipv%d", evt.Candidates.Local.Family)).Inc()
statsJanusSelectedCandidateTotal.WithLabelValues("remote", evt.Candidates.Remote.Type, evt.Candidates.Remote.Transport, fmt.Sprintf("ipv%d", evt.Candidates.Remote.Family)).Inc()
case *JanusEventMediaSlowLink:
var direction string
// "uplink" is Janus -> client, "downlink" is client -> Janus.

View file

@ -92,18 +92,12 @@ var (
Name: "bandwidth",
Help: "The current bandwidth in bytes per second",
}, []string{"direction"})
statsJanusSelectedLocalCandidateTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
statsJanusSelectedCandidateTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "signaling",
Subsystem: "mcu",
Name: "selected_local_candidate_total",
Help: "Total number of selected local candidates",
}, []string{"type", "transport", "family"})
statsJanusSelectedRemoteCandidateTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "signaling",
Subsystem: "mcu",
Name: "selected_remote_candidate_total",
Help: "Total number of selected remote candidates",
}, []string{"type", "transport", "family"})
Name: "selected_candidate_total",
Help: "Total number of selected candidates",
}, []string{"origin", "type", "transport", "family"})
statsJanusPeerConnectionStateTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "signaling",
Subsystem: "mcu",
@ -145,8 +139,7 @@ var (
janusMcuStats = []prometheus.Collector{
statsJanusBandwidthCurrent,
statsJanusSelectedLocalCandidateTotal,
statsJanusSelectedRemoteCandidateTotal,
statsJanusSelectedCandidateTotal,
statsJanusPeerConnectionStateTotal,
statsJanusICEStateTotal,
statsJanusDTLSStateTotal,