diff --git a/observability/callobs/gen_reporter.go b/observability/callobs/gen_reporter.go new file mode 100644 index 000000000..03396146d --- /dev/null +++ b/observability/callobs/gen_reporter.go @@ -0,0 +1,51 @@ +// Code generated; DO NOT EDIT. + +package callobs + +import ( + "time" +) + +const Version_VR1JFL0 = true + +type KeyResolver interface { + Resolve(string) + Reset() +} + +type Reporter interface { + WithProject(id string) ProjectReporter + WithDeferredProject() (ProjectReporter, KeyResolver) +} + +type ProjectTx interface{} + +type ProjectReporter interface { + RegisterFunc(func(ts time.Time, tx ProjectTx) bool) + Tx(func(tx ProjectTx)) + TxAt(time.Time, func(tx ProjectTx)) + WithCall(id string) CallReporter + WithDeferredCall() (CallReporter, KeyResolver) + ProjectTx +} + +type CallTx interface { + ReportStartTime(v time.Time) + ReportEndTime(v time.Time) + ReportDuration(v uint64) + ReportDurationMinutes(v uint16) + ReportDirection(v CallDirection) + ReportCallType(v CallCallType) + ReportRegion(v string) + ReportRoomID(v string) + ReportRoomName(v string) + ReportError(v string) + ReportStatus(v CallStatus) +} + +type CallReporter interface { + RegisterFunc(func(ts time.Time, tx CallTx) bool) + Tx(func(tx CallTx)) + TxAt(time.Time, func(tx CallTx)) + CallTx +} diff --git a/observability/callobs/gen_reporter_noop.go b/observability/callobs/gen_reporter_noop.go new file mode 100644 index 000000000..f51cf7205 --- /dev/null +++ b/observability/callobs/gen_reporter_noop.go @@ -0,0 +1,69 @@ +// Code generated; DO NOT EDIT. + +package callobs + +import ( + "time" +) + +var ( + _ Reporter = (*noopReporter)(nil) + _ ProjectReporter = (*noopProjectReporter)(nil) + _ CallReporter = (*noopCallReporter)(nil) +) + +type noopKeyResolver struct{} + +func (noopKeyResolver) Resolve(string) {} +func (noopKeyResolver) Reset() {} + +type noopReporter struct{} + +func NewNoopReporter() Reporter { + return &noopReporter{} +} + +func (r *noopReporter) WithProject(id string) ProjectReporter { + return &noopProjectReporter{} +} + +func (r *noopReporter) WithDeferredProject() (ProjectReporter, KeyResolver) { + return &noopProjectReporter{}, noopKeyResolver{} +} + +type noopProjectReporter struct{} + +func NewNoopProjectReporter() ProjectReporter { + return &noopProjectReporter{} +} + +func (r *noopProjectReporter) RegisterFunc(f func(ts time.Time, tx ProjectTx) bool) {} +func (r *noopProjectReporter) Tx(f func(ProjectTx)) {} +func (r *noopProjectReporter) TxAt(ts time.Time, f func(ProjectTx)) {} +func (r *noopProjectReporter) WithCall(id string) CallReporter { + return &noopCallReporter{} +} +func (r *noopProjectReporter) WithDeferredCall() (CallReporter, KeyResolver) { + return &noopCallReporter{}, noopKeyResolver{} +} + +type noopCallReporter struct{} + +func NewNoopCallReporter() CallReporter { + return &noopCallReporter{} +} + +func (r *noopCallReporter) RegisterFunc(f func(ts time.Time, tx CallTx) bool) {} +func (r *noopCallReporter) Tx(f func(CallTx)) {} +func (r *noopCallReporter) TxAt(ts time.Time, f func(CallTx)) {} +func (r *noopCallReporter) ReportStartTime(v time.Time) {} +func (r *noopCallReporter) ReportEndTime(v time.Time) {} +func (r *noopCallReporter) ReportDuration(v uint64) {} +func (r *noopCallReporter) ReportDurationMinutes(v uint16) {} +func (r *noopCallReporter) ReportDirection(v CallDirection) {} +func (r *noopCallReporter) ReportCallType(v CallCallType) {} +func (r *noopCallReporter) ReportRegion(v string) {} +func (r *noopCallReporter) ReportRoomID(v string) {} +func (r *noopCallReporter) ReportRoomName(v string) {} +func (r *noopCallReporter) ReportError(v string) {} +func (r *noopCallReporter) ReportStatus(v CallStatus) {} diff --git a/observability/callobs/gen_source.go b/observability/callobs/gen_source.go new file mode 100644 index 000000000..faae89be5 --- /dev/null +++ b/observability/callobs/gen_source.go @@ -0,0 +1,44 @@ +// Code generated; DO NOT EDIT. +package callobs + +type CallDirection string + +const ( + CallDirectionUndefined CallDirection = "" + CallDirectionUnknown CallDirection = "unknown" + CallDirectionInbound CallDirection = "inbound" + CallDirectionOutbound CallDirection = "outbound" +) + +type CallCallType string + +const ( + CallCallTypeUndefined CallCallType = "" + CallCallTypeSIP CallCallType = "sip" + CallCallTypeTwilio CallCallType = "twilio" + CallCallTypeWhatsapp CallCallType = "whatsapp" +) + +type CallStatus string + +const ( + CallStatusUndefined CallStatus = "" + CallStatusActive CallStatus = "active" + CallStatusCallIncoming CallStatus = "call_incoming" + CallStatusParticipantJoined CallStatus = "participant_joined" + CallStatusDisconnected CallStatus = "disconnected" + CallStatusError CallStatus = "error" + CallStatusPending CallStatus = "pending" + CallStatusSuccess CallStatus = "success" + CallStatusFailed CallStatus = "failed" +) + +type Rollup string + +const ( + RollupUndefined Rollup = "" + RollupProject Rollup = "project" + RollupCallIndex Rollup = "call_index" + RollupStartTimeIndex Rollup = "start_time_index" + RollupEndTimeIndex Rollup = "end_time_index" +) diff --git a/observability/reporter.go b/observability/reporter.go index ceabe88b2..281ae6437 100644 --- a/observability/reporter.go +++ b/observability/reporter.go @@ -2,6 +2,7 @@ package observability import ( "github.com/livekit/protocol/observability/agentsobs" + "github.com/livekit/protocol/observability/callobs" "github.com/livekit/protocol/observability/egressobs" "github.com/livekit/protocol/observability/gatewayobs" "github.com/livekit/protocol/observability/ingressobs" @@ -22,6 +23,7 @@ type Reporter interface { Egress() egressobs.Reporter Ingress() ingressobs.Reporter GatewayMetrics() any // any is a placeholder for the gateway metrics type + Call() callobs.Reporter TelephonyCall() telephonycallobs.Reporter Storage() storageobs.Reporter Close() @@ -65,6 +67,10 @@ func (reporter) GatewayMetrics() any { return nil } +func (reporter) Call() callobs.Reporter { + return callobs.NewNoopReporter() +} + func (reporter) TelephonyCall() telephonycallobs.Reporter { return telephonycallobs.NewNoopReporter() } diff --git a/observability/telephonycallobs/gen_reporter.go b/observability/telephonycallobs/gen_reporter.go index 08946a2be..d4adc5036 100644 --- a/observability/telephonycallobs/gen_reporter.go +++ b/observability/telephonycallobs/gen_reporter.go @@ -6,7 +6,7 @@ import ( "time" ) -const Version_OCEQQJO = true +const Version_T93RR0G = true type KeyResolver interface { Resolve(string) @@ -30,26 +30,20 @@ type ProjectReporter interface { } type CallTx interface { - ReportStartTime(v time.Time) - ReportEndTime(v time.Time) - ReportDuration(v uint64) - ReportDurationMinutes(v uint16) ReportTrunkID(v string) + ReportTrunkType(v CallTrunkType) ReportDispatchID(v string) ReportToNumber(v string) ReportToHost(v string) ReportFromNumber(v string) ReportFromHost(v string) - ReportDirection(v CallDirection) + ReportNumberType(v CallNumberType) + ReportCountryCode(v string) ReportTransport(v CallTransport) ReportProviderCallID(v string) ReportProviderName(v string) ReportSIPCallID(v string) - ReportRoomID(v string) - ReportRoomName(v string) ReportParticipantIdentity(v string) - ReportError(v string) - ReportStatus(v CallStatus) ReportResponseCode(v uint16) ReportDisconnectReason(v string) ReportTransferID(v string) diff --git a/observability/telephonycallobs/gen_reporter_noop.go b/observability/telephonycallobs/gen_reporter_noop.go index 49761e999..8ed967f53 100644 --- a/observability/telephonycallobs/gen_reporter_noop.go +++ b/observability/telephonycallobs/gen_reporter_noop.go @@ -56,26 +56,20 @@ func NewNoopCallReporter() CallReporter { func (r *noopCallReporter) RegisterFunc(f func(ts time.Time, tx CallTx) bool) {} func (r *noopCallReporter) Tx(f func(CallTx)) {} func (r *noopCallReporter) TxAt(ts time.Time, f func(CallTx)) {} -func (r *noopCallReporter) ReportStartTime(v time.Time) {} -func (r *noopCallReporter) ReportEndTime(v time.Time) {} -func (r *noopCallReporter) ReportDuration(v uint64) {} -func (r *noopCallReporter) ReportDurationMinutes(v uint16) {} func (r *noopCallReporter) ReportTrunkID(v string) {} +func (r *noopCallReporter) ReportTrunkType(v CallTrunkType) {} func (r *noopCallReporter) ReportDispatchID(v string) {} func (r *noopCallReporter) ReportToNumber(v string) {} func (r *noopCallReporter) ReportToHost(v string) {} func (r *noopCallReporter) ReportFromNumber(v string) {} func (r *noopCallReporter) ReportFromHost(v string) {} -func (r *noopCallReporter) ReportDirection(v CallDirection) {} +func (r *noopCallReporter) ReportNumberType(v CallNumberType) {} +func (r *noopCallReporter) ReportCountryCode(v string) {} func (r *noopCallReporter) ReportTransport(v CallTransport) {} func (r *noopCallReporter) ReportProviderCallID(v string) {} func (r *noopCallReporter) ReportProviderName(v string) {} func (r *noopCallReporter) ReportSIPCallID(v string) {} -func (r *noopCallReporter) ReportRoomID(v string) {} -func (r *noopCallReporter) ReportRoomName(v string) {} func (r *noopCallReporter) ReportParticipantIdentity(v string) {} -func (r *noopCallReporter) ReportError(v string) {} -func (r *noopCallReporter) ReportStatus(v CallStatus) {} func (r *noopCallReporter) ReportResponseCode(v uint16) {} func (r *noopCallReporter) ReportDisconnectReason(v string) {} func (r *noopCallReporter) ReportTransferID(v string) {} diff --git a/observability/telephonycallobs/gen_source.go b/observability/telephonycallobs/gen_source.go index 066c44fba..d8cddfd9a 100644 --- a/observability/telephonycallobs/gen_source.go +++ b/observability/telephonycallobs/gen_source.go @@ -1,13 +1,20 @@ // Code generated; DO NOT EDIT. package telephonycallobs -type CallDirection string +type CallTrunkType string const ( - CallDirectionUndefined CallDirection = "" - CallDirectionUnknown CallDirection = "unknown" - CallDirectionInbound CallDirection = "inbound" - CallDirectionOutbound CallDirection = "outbound" + CallTrunkTypeUndefined CallTrunkType = "" + CallTrunkTypeInternal CallTrunkType = "internal" + CallTrunkTypeExternal CallTrunkType = "external" +) + +type CallNumberType string + +const ( + CallNumberTypeUndefined CallNumberType = "" + CallNumberTypeTollFree CallNumberType = "toll_free" + CallNumberTypeRegular CallNumberType = "regular" ) type CallTransport string @@ -19,17 +26,6 @@ const ( CallTransportTLS CallTransport = "tls" ) -type CallStatus string - -const ( - CallStatusUndefined CallStatus = "" - CallStatusActive CallStatus = "active" - CallStatusCallIncoming CallStatus = "call_incoming" - CallStatusParticipantJoined CallStatus = "participant_joined" - CallStatusDisconnected CallStatus = "disconnected" - CallStatusError CallStatus = "error" -) - type CallTransferStatus string const (