Use a Twirp server hook to send API call details to telemetry. (#3401)
* Use a Twirp server hook to send API call details to telemetry. * mage generate and clean up * Add project_id * deps * - Redact requests - Do not store responses - Extract top level fields room_name, room_id, participant_identity, participant_id, track_id as appropriate - Store status as int * deps
This commit is contained in:
@@ -10,6 +10,12 @@ import (
|
||||
)
|
||||
|
||||
type FakeTelemetryService struct {
|
||||
APICallStub func(context.Context, *livekit.APICallInfo)
|
||||
aPICallMutex sync.RWMutex
|
||||
aPICallArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.APICallInfo
|
||||
}
|
||||
EgressEndedStub func(context.Context, *livekit.EgressInfo)
|
||||
egressEndedMutex sync.RWMutex
|
||||
egressEndedArgsForCall []struct {
|
||||
@@ -263,6 +269,39 @@ type FakeTelemetryService struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) APICall(arg1 context.Context, arg2 *livekit.APICallInfo) {
|
||||
fake.aPICallMutex.Lock()
|
||||
fake.aPICallArgsForCall = append(fake.aPICallArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.APICallInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.APICallStub
|
||||
fake.recordInvocation("APICall", []interface{}{arg1, arg2})
|
||||
fake.aPICallMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.APICallStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) APICallCallCount() int {
|
||||
fake.aPICallMutex.RLock()
|
||||
defer fake.aPICallMutex.RUnlock()
|
||||
return len(fake.aPICallArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) APICallCalls(stub func(context.Context, *livekit.APICallInfo)) {
|
||||
fake.aPICallMutex.Lock()
|
||||
defer fake.aPICallMutex.Unlock()
|
||||
fake.APICallStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) APICallArgsForCall(i int) (context.Context, *livekit.APICallInfo) {
|
||||
fake.aPICallMutex.RLock()
|
||||
defer fake.aPICallMutex.RUnlock()
|
||||
argsForCall := fake.aPICallArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressEnded(arg1 context.Context, arg2 *livekit.EgressInfo) {
|
||||
fake.egressEndedMutex.Lock()
|
||||
fake.egressEndedArgsForCall = append(fake.egressEndedArgsForCall, struct {
|
||||
@@ -1458,6 +1497,8 @@ func (fake *FakeTelemetryService) TrackUnsubscribedArgsForCall(i int) (context.C
|
||||
func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.aPICallMutex.RLock()
|
||||
defer fake.aPICallMutex.RUnlock()
|
||||
fake.egressEndedMutex.RLock()
|
||||
defer fake.egressEndedMutex.RUnlock()
|
||||
fake.egressStartedMutex.RLock()
|
||||
|
||||
Reference in New Issue
Block a user