Add sdk lable to session start time and participant join (#4885)
This commit is contained in:
@@ -1480,9 +1480,9 @@ func (p *ParticipantImpl) recordRTCState(closeReason types.ParticipantCloseReaso
|
|||||||
}
|
}
|
||||||
|
|
||||||
if p.IsConnectionCanceled(closeReason) {
|
if p.IsConnectionCanceled(closeReason) {
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, p.params.EnableWarp)
|
prometheus.IncrementParticipantRtcCanceled(1, p.params.EnableWarp, p.GetClientInfo().GetSdk())
|
||||||
} else {
|
} else {
|
||||||
prometheus.IncrementParticipantRtcFailure(1, p.params.EnableWarp)
|
prometheus.IncrementParticipantRtcFailure(1, p.params.EnableWarp, p.GetClientInfo().GetSdk())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2718,8 +2718,8 @@ func (p *ParticipantImpl) onPrimaryTransportInitialConnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !p.sessionStartRecorded.Swap(true) {
|
if !p.sessionStartRecorded.Swap(true) {
|
||||||
prometheus.RecordSessionStartTime(int(p.ProtocolVersion()), p.params.EnableWarp, time.Since(p.params.SessionStartTime))
|
prometheus.RecordSessionStartTime(int(p.ProtocolVersion()), p.params.EnableWarp, p.GetClientInfo().GetSdk(), time.Since(p.params.SessionStartTime))
|
||||||
prometheus.IncrementParticipantRtcSuccess(1, p.params.EnableWarp)
|
prometheus.IncrementParticipantRtcSuccess(1, p.params.EnableWarp, p.GetClientInfo().GetSdk())
|
||||||
}
|
}
|
||||||
p.updateState(livekit.ParticipantInfo_ACTIVE)
|
p.updateState(livekit.ParticipantInfo_ACTIVE)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ func (r *RoomManager) StartSession(
|
|||||||
room, err := r.getOrCreateRoom(ctx, createRoom)
|
room, err := r.getOrCreateRoom(ctx, createRoom)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if pi.Identity != "" {
|
if pi.Identity != "" {
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, false)
|
prometheus.IncrementParticipantRtcCanceled(1, false, pi.Client.GetSdk())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ func (r *RoomManager) StartSession(
|
|||||||
Leave: leave,
|
Leave: leave,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, participant.IsWarpEnabled())
|
prometheus.IncrementParticipantRtcCanceled(1, participant.IsWarpEnabled(), participant.GetClientInfo().GetSdk())
|
||||||
return errors.New("could not restart closed participant")
|
return errors.New("could not restart closed participant")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ func (r *RoomManager) StartSession(
|
|||||||
pi.ReconnectReason,
|
pi.ReconnectReason,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
participant.GetLogger().Warnw("could not resume participant", err)
|
participant.GetLogger().Warnw("could not resume participant", err)
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, participant.IsWarpEnabled())
|
prometheus.IncrementParticipantRtcCanceled(1, participant.IsWarpEnabled(), participant.GetClientInfo().GetSdk())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
r.telemetry.ParticipantResumed(ctx, room.ToProto(), participant.ToProto(), r.currentNode.NodeID(), pi.ReconnectReason)
|
r.telemetry.ParticipantResumed(ctx, room.ToProto(), participant.ToProto(), r.currentNode.NodeID(), pi.ReconnectReason)
|
||||||
@@ -419,7 +419,7 @@ func (r *RoomManager) StartSession(
|
|||||||
Leave: leave,
|
Leave: leave,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, false)
|
prometheus.IncrementParticipantRtcCanceled(1, false, pi.Client.GetSdk())
|
||||||
return errors.New("could not restart participant")
|
return errors.New("could not restart participant")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ func (r *RoomManager) StartSession(
|
|||||||
EnableWarp: enableWarp,
|
EnableWarp: enableWarp,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, enableWarp)
|
prometheus.IncrementParticipantRtcCanceled(1, enableWarp, pi.Client.GetSdk())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iceConfig := r.setIceConfig(room.Name(), participant)
|
iceConfig := r.setIceConfig(room.Name(), participant)
|
||||||
@@ -561,7 +561,7 @@ func (r *RoomManager) StartSession(
|
|||||||
if err = room.Join(participant, requestSource, &opts, iceServers); err != nil {
|
if err = room.Join(participant, requestSource, &opts, iceServers); err != nil {
|
||||||
pLogger.Errorw("could not join room", err)
|
pLogger.Errorw("could not join room", err)
|
||||||
_ = participant.Close(true, types.ParticipantCloseReasonJoinFailed, false)
|
_ = participant.Close(true, types.ParticipantCloseReasonJoinFailed, false)
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, enableWarp)
|
prometheus.IncrementParticipantRtcCanceled(1, enableWarp, pi.Client.GetSdk())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ func (r *RoomManager) StartSession(
|
|||||||
participantServerClosers.Close()
|
participantServerClosers.Close()
|
||||||
pLogger.Errorw("could not join register participant topic", err)
|
pLogger.Errorw("could not join register participant topic", err)
|
||||||
_ = participant.Close(true, types.ParticipantCloseReasonMessageBusFailed, false)
|
_ = participant.Close(true, types.ParticipantCloseReasonMessageBusFailed, false)
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, enableWarp)
|
prometheus.IncrementParticipantRtcCanceled(1, enableWarp, pi.Client.GetSdk())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ func (r *RoomManager) StartSession(
|
|||||||
participantServerClosers.Close()
|
participantServerClosers.Close()
|
||||||
pLogger.Errorw("could not join register participant topic for rtc rest participant server", err)
|
pLogger.Errorw("could not join register participant topic for rtc rest participant server", err)
|
||||||
_ = participant.Close(true, types.ParticipantCloseReasonMessageBusFailed, false)
|
_ = participant.Close(true, types.ParticipantCloseReasonMessageBusFailed, false)
|
||||||
prometheus.IncrementParticipantRtcCanceled(1, enableWarp)
|
prometheus.IncrementParticipantRtcCanceled(1, enableWarp, pi.Client.GetSdk())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ func (t *telemetryService) ParticipantJoined(
|
|||||||
guard,
|
guard,
|
||||||
)
|
)
|
||||||
if !found {
|
if !found {
|
||||||
prometheus.IncrementParticipantRtcConnected(1)
|
prometheus.IncrementParticipantRtcConnected(1, clientInfo.GetSdk())
|
||||||
prometheus.AddParticipant()
|
prometheus.AddParticipant()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ func initPacketStats(nodeID string, nodeType livekit.NodeType) {
|
|||||||
Subsystem: "participant_join",
|
Subsystem: "participant_join",
|
||||||
Name: "total",
|
Name: "total",
|
||||||
ConstLabels: prometheus.Labels{"node_id": nodeID, "node_type": nodeType.String()},
|
ConstLabels: prometheus.Labels{"node_id": nodeID, "node_type": nodeType.String()},
|
||||||
}, []string{"state", "warp"})
|
}, []string{"state", "warp", "sdk"})
|
||||||
promConnections = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
promConnections = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Namespace: livekitNamespace,
|
Namespace: livekitNamespace,
|
||||||
Subsystem: "connection",
|
Subsystem: "connection",
|
||||||
@@ -299,72 +299,72 @@ func RecordRTT(country string, direction Direction, trackSource livekit.TrackSou
|
|||||||
func IncrementParticipantJoin(join uint32) {
|
func IncrementParticipantJoin(join uint32) {
|
||||||
if join > 0 {
|
if join > 0 {
|
||||||
participantSignalConnected.Add(uint64(join))
|
participantSignalConnected.Add(uint64(join))
|
||||||
promParticipantJoin.WithLabelValues("signal_connected", "").Add(float64(join))
|
promParticipantJoin.WithLabelValues("signal_connected", "", "").Add(float64(join))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantJoinFail(fail uint32) {
|
func IncrementParticipantJoinFail(fail uint32) {
|
||||||
if fail > 0 {
|
if fail > 0 {
|
||||||
promParticipantJoin.WithLabelValues("signal_failed", "").Add(float64(fail))
|
promParticipantJoin.WithLabelValues("signal_failed", "", "").Add(float64(fail))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantJoinValidationFail(validationFail uint32) {
|
func IncrementParticipantJoinValidationFail(validationFail uint32) {
|
||||||
if validationFail > 0 {
|
if validationFail > 0 {
|
||||||
promParticipantJoin.WithLabelValues("signal_validation_failed", "").Add(float64(validationFail))
|
promParticipantJoin.WithLabelValues("signal_validation_failed", "", "").Add(float64(validationFail))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantJoinUpgradeFail(upgradeFail uint32) {
|
func IncrementParticipantJoinUpgradeFail(upgradeFail uint32) {
|
||||||
if upgradeFail > 0 {
|
if upgradeFail > 0 {
|
||||||
promParticipantJoin.WithLabelValues("signal_upgrade_failed", "").Add(float64(upgradeFail))
|
promParticipantJoin.WithLabelValues("signal_upgrade_failed", "", "").Add(float64(upgradeFail))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantJoinWriteInitialResponseFail(writeInitialResponseFail uint32) {
|
func IncrementParticipantJoinWriteInitialResponseFail(writeInitialResponseFail uint32) {
|
||||||
if writeInitialResponseFail > 0 {
|
if writeInitialResponseFail > 0 {
|
||||||
promParticipantJoin.WithLabelValues("signal_write_initial_response_failed", "").Add(float64(writeInitialResponseFail))
|
promParticipantJoin.WithLabelValues("signal_write_initial_response_failed", "", "").Add(float64(writeInitialResponseFail))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantRtcInit(init uint32) {
|
func IncrementParticipantRtcInit(init uint32) {
|
||||||
if init > 0 {
|
if init > 0 {
|
||||||
participantRTCInit.Add(uint64(init))
|
participantRTCInit.Add(uint64(init))
|
||||||
promParticipantJoin.WithLabelValues("rtc_init", "").Add(float64(init))
|
promParticipantJoin.WithLabelValues("rtc_init", "", "").Add(float64(init))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantRtcConnected(connected uint32) {
|
func IncrementParticipantRtcConnected(connected uint32, sdk livekit.ClientInfo_SDK) {
|
||||||
if connected > 0 {
|
if connected > 0 {
|
||||||
participantRTCConnected.Add(uint64(connected))
|
participantRTCConnected.Add(uint64(connected))
|
||||||
promParticipantJoin.WithLabelValues("rtc_connected", "").Add(float64(connected))
|
promParticipantJoin.WithLabelValues("rtc_connected", "", sdk.String()).Add(float64(connected))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantRtcActive(active uint32, warp bool) {
|
func IncrementParticipantRtcActive(active uint32, warp bool) {
|
||||||
if active > 0 {
|
if active > 0 {
|
||||||
participantRTCActive.Add(uint64(active))
|
participantRTCActive.Add(uint64(active))
|
||||||
promParticipantJoin.WithLabelValues("rtc_active", strconv.FormatBool(warp)).Add(float64(active))
|
promParticipantJoin.WithLabelValues("rtc_active", strconv.FormatBool(warp), "").Add(float64(active))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantRtcCanceled(canceled uint64, warp bool) {
|
func IncrementParticipantRtcCanceled(canceled uint64, warp bool, sdk livekit.ClientInfo_SDK) {
|
||||||
if canceled > 0 {
|
if canceled > 0 {
|
||||||
participantRTCCanceled.Add(canceled)
|
participantRTCCanceled.Add(canceled)
|
||||||
promParticipantJoin.WithLabelValues("rtc_canceled", strconv.FormatBool(warp)).Add(float64(canceled))
|
promParticipantJoin.WithLabelValues("rtc_canceled", strconv.FormatBool(warp), sdk.String()).Add(float64(canceled))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: check if need to record warp to rtcSucc/Failure
|
// todo: check if need to record warp to rtcSucc/Failure
|
||||||
func IncrementParticipantRtcSuccess(success uint64, warp bool) {
|
func IncrementParticipantRtcSuccess(success uint64, warp bool, sdk livekit.ClientInfo_SDK) {
|
||||||
if success > 0 {
|
if success > 0 {
|
||||||
promParticipantJoin.WithLabelValues("rtc_success", strconv.FormatBool(warp)).Add(float64(success))
|
promParticipantJoin.WithLabelValues("rtc_success", strconv.FormatBool(warp), sdk.String()).Add(float64(success))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IncrementParticipantRtcFailure(failure uint64, warp bool) {
|
func IncrementParticipantRtcFailure(failure uint64, warp bool, sdk livekit.ClientInfo_SDK) {
|
||||||
if failure > 0 {
|
if failure > 0 {
|
||||||
promParticipantJoin.WithLabelValues("rtc_failure", strconv.FormatBool(warp)).Add(float64(failure))
|
promParticipantJoin.WithLabelValues("rtc_failure", strconv.FormatBool(warp), sdk.String()).Add(float64(failure))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ func initRoomStats(nodeID string, nodeType livekit.NodeType) {
|
|||||||
Name: "start_time_ms",
|
Name: "start_time_ms",
|
||||||
ConstLabels: prometheus.Labels{"node_id": nodeID, "node_type": nodeType.String()},
|
ConstLabels: prometheus.Labels{"node_id": nodeID, "node_type": nodeType.String()},
|
||||||
Buckets: prometheus.ExponentialBucketsRange(100, 10000, 15),
|
Buckets: prometheus.ExponentialBucketsRange(100, 10000, 15),
|
||||||
}, []string{"protocol_version", "warp"})
|
}, []string{"protocol_version", "warp", "sdk"})
|
||||||
promSessionDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
promSessionDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||||
Namespace: livekitNamespace,
|
Namespace: livekitNamespace,
|
||||||
Subsystem: "session",
|
Subsystem: "session",
|
||||||
@@ -291,8 +291,8 @@ func RecordSessionJoinLatency(protocolVersion int, d time.Duration) {
|
|||||||
promSessionJoinLatency.WithLabelValues(strconv.Itoa(protocolVersion)).Observe(float64(d.Milliseconds()))
|
promSessionJoinLatency.WithLabelValues(strconv.Itoa(protocolVersion)).Observe(float64(d.Milliseconds()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordSessionStartTime(protocolVersion int, warp bool, d time.Duration) {
|
func RecordSessionStartTime(protocolVersion int, warp bool, sdk livekit.ClientInfo_SDK, d time.Duration) {
|
||||||
promSessionStartTime.WithLabelValues(strconv.Itoa(protocolVersion), strconv.FormatBool(warp)).Observe(float64(d.Milliseconds()))
|
promSessionStartTime.WithLabelValues(strconv.Itoa(protocolVersion), strconv.FormatBool(warp), sdk.String()).Observe(float64(d.Milliseconds()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecordSessionDuration(protocolVersion int, d time.Duration) {
|
func RecordSessionDuration(protocolVersion int, d time.Duration) {
|
||||||
|
|||||||
Reference in New Issue
Block a user