diff --git a/.changeset/ten-planets-listen.md b/.changeset/ten-planets-listen.md new file mode 100644 index 000000000..faf464d0d --- /dev/null +++ b/.changeset/ten-planets-listen.md @@ -0,0 +1,5 @@ +--- +"@livekit/protocol": patch +--- + +codegen observability parent tx accessors diff --git a/observability/agentsobs/gen_reporter.go b/observability/agentsobs/gen_reporter.go index 55d9da48f..6b9587e65 100644 --- a/observability/agentsobs/gen_reporter.go +++ b/observability/agentsobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,16 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithCloudAgent(id string) CloudAgentReporter WithDeferredCloudAgent() (CloudAgentReporter, KeyResolver) - ProjectTx + projectReporter } -type CloudAgentTx interface{} +type cloudAgentReporter interface { +} + +type CloudAgentTx interface { + Project() ProjectTx + cloudAgentReporter +} type CloudAgentReporter interface { RegisterFunc(func(ts time.Time, tx CloudAgentTx) bool) @@ -37,10 +48,16 @@ type CloudAgentReporter interface { TxAt(time.Time, func(tx CloudAgentTx)) WithAgent(name string) AgentReporter WithDeferredAgent() (AgentReporter, KeyResolver) - CloudAgentTx + cloudAgentReporter +} + +type agentReporter interface { } -type AgentTx interface{} +type AgentTx interface { + CloudAgent() CloudAgentTx + agentReporter +} type AgentReporter interface { RegisterFunc(func(ts time.Time, tx AgentTx) bool) @@ -48,10 +65,10 @@ type AgentReporter interface { TxAt(time.Time, func(tx AgentTx)) WithWorker(id string) WorkerReporter WithDeferredWorker() (WorkerReporter, KeyResolver) - AgentTx + agentReporter } -type WorkerTx interface { +type workerReporter interface { ReportLoad(v float32) ReportStatus(v WorkerStatus) ReportStartTime(v time.Time) @@ -68,16 +85,21 @@ type WorkerTx interface { ReportState(v WorkerState) } +type WorkerTx interface { + Agent() AgentTx + workerReporter +} + type WorkerReporter interface { RegisterFunc(func(ts time.Time, tx WorkerTx) bool) Tx(func(tx WorkerTx)) TxAt(time.Time, func(tx WorkerTx)) WithJob(id string) JobReporter WithDeferredJob() (JobReporter, KeyResolver) - WorkerTx + workerReporter } -type JobTx interface { +type jobReporter interface { ReportRoomSessionID(v string) ReportKind(v JobKind) ReportWorkerKind(v WorkerKind) @@ -89,9 +111,14 @@ type JobTx interface { ReportJoinLatency(v uint32) } +type JobTx interface { + Worker() WorkerTx + jobReporter +} + type JobReporter interface { RegisterFunc(func(ts time.Time, tx JobTx) bool) Tx(func(tx JobTx)) TxAt(time.Time, func(tx JobTx)) - JobTx + jobReporter } diff --git a/observability/agentsobs/gen_reporter_noop.go b/observability/agentsobs/gen_reporter_noop.go index 09a5a595e..832a13829 100644 --- a/observability/agentsobs/gen_reporter_noop.go +++ b/observability/agentsobs/gen_reporter_noop.go @@ -9,10 +9,15 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ CloudAgentReporter = (*noopCloudAgentReporter)(nil) + _ CloudAgentTx = (*noopCloudAgentTx)(nil) _ AgentReporter = (*noopAgentReporter)(nil) + _ AgentTx = (*noopAgentTx)(nil) _ WorkerReporter = (*noopWorkerReporter)(nil) + _ WorkerTx = (*noopWorkerTx)(nil) _ JobReporter = (*noopJobReporter)(nil) + _ JobTx = (*noopJobTx)(nil) ) type noopKeyResolver struct{} @@ -50,6 +55,8 @@ func (r *noopProjectReporter) WithDeferredCloudAgent() (CloudAgentReporter, KeyR return &noopCloudAgentReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopCloudAgentReporter struct{} func NewNoopCloudAgentReporter() CloudAgentReporter { @@ -66,6 +73,12 @@ func (r *noopCloudAgentReporter) WithDeferredAgent() (AgentReporter, KeyResolver return &noopAgentReporter{}, noopKeyResolver{} } +type noopCloudAgentTx struct{} + +func (t *noopCloudAgentTx) Project() ProjectTx { + return &noopProjectTx{} +} + type noopAgentReporter struct{} func NewNoopAgentReporter() AgentReporter { @@ -82,6 +95,12 @@ func (r *noopAgentReporter) WithDeferredWorker() (WorkerReporter, KeyResolver) { return &noopWorkerReporter{}, noopKeyResolver{} } +type noopAgentTx struct{} + +func (t *noopAgentTx) CloudAgent() CloudAgentTx { + return &noopCloudAgentTx{} +} + type noopWorkerReporter struct{} func NewNoopWorkerReporter() WorkerReporter { @@ -112,6 +131,27 @@ func (r *noopWorkerReporter) WithDeferredJob() (JobReporter, KeyResolver) { return &noopJobReporter{}, noopKeyResolver{} } +type noopWorkerTx struct{} + +func (t *noopWorkerTx) Agent() AgentTx { + return &noopAgentTx{} +} + +func (t *noopWorkerTx) ReportLoad(v float32) {} +func (t *noopWorkerTx) ReportStatus(v WorkerStatus) {} +func (t *noopWorkerTx) ReportStartTime(v time.Time) {} +func (t *noopWorkerTx) ReportEndTime(v time.Time) {} +func (t *noopWorkerTx) ReportJobsCurrent(v uint32) {} +func (t *noopWorkerTx) ReportLive(v uint8) {} +func (t *noopWorkerTx) ReportCPU(v int64) {} +func (t *noopWorkerTx) ReportCPULimit(v int64) {} +func (t *noopWorkerTx) ReportMem(v int64) {} +func (t *noopWorkerTx) ReportMemLimit(v int64) {} +func (t *noopWorkerTx) ReportRegion(v string) {} +func (t *noopWorkerTx) ReportVersion(v string) {} +func (t *noopWorkerTx) ReportSdkVersion(v string) {} +func (t *noopWorkerTx) ReportState(v WorkerState) {} + type noopJobReporter struct{} func NewNoopJobReporter() JobReporter { @@ -130,3 +170,19 @@ func (r *noopJobReporter) ReportDurationMinutes(v uint8) {} func (r *noopJobReporter) ReportStartTime(v time.Time) {} func (r *noopJobReporter) ReportEndTime(v time.Time) {} func (r *noopJobReporter) ReportJoinLatency(v uint32) {} + +type noopJobTx struct{} + +func (t *noopJobTx) Worker() WorkerTx { + return &noopWorkerTx{} +} + +func (t *noopJobTx) ReportRoomSessionID(v string) {} +func (t *noopJobTx) ReportKind(v JobKind) {} +func (t *noopJobTx) ReportWorkerKind(v WorkerKind) {} +func (t *noopJobTx) ReportStatus(v JobStatus) {} +func (t *noopJobTx) ReportDuration(v uint32) {} +func (t *noopJobTx) ReportDurationMinutes(v uint8) {} +func (t *noopJobTx) ReportStartTime(v time.Time) {} +func (t *noopJobTx) ReportEndTime(v time.Time) {} +func (t *noopJobTx) ReportJoinLatency(v uint32) {} diff --git a/observability/corecallobs/gen_reporter.go b/observability/corecallobs/gen_reporter.go index 2252f7e0c..92fa41df2 100644 --- a/observability/corecallobs/gen_reporter.go +++ b/observability/corecallobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,10 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithCall(id string) CallReporter WithDeferredCall() (CallReporter, KeyResolver) - ProjectTx + projectReporter } -type CallTx interface { +type callReporter interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) ReportDuration(v uint64) @@ -45,9 +50,14 @@ type CallTx interface { ReportStatus(v CallStatus) } +type CallTx interface { + Project() ProjectTx + callReporter +} + type CallReporter interface { RegisterFunc(func(ts time.Time, tx CallTx) bool) Tx(func(tx CallTx)) TxAt(time.Time, func(tx CallTx)) - CallTx + callReporter } diff --git a/observability/corecallobs/gen_reporter_noop.go b/observability/corecallobs/gen_reporter_noop.go index 191a955ed..24d2a54f9 100644 --- a/observability/corecallobs/gen_reporter_noop.go +++ b/observability/corecallobs/gen_reporter_noop.go @@ -9,7 +9,9 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ CallReporter = (*noopCallReporter)(nil) + _ CallTx = (*noopCallTx)(nil) ) type noopKeyResolver struct{} @@ -47,6 +49,8 @@ func (r *noopProjectReporter) WithDeferredCall() (CallReporter, KeyResolver) { return &noopCallReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopCallReporter struct{} func NewNoopCallReporter() CallReporter { @@ -69,3 +73,23 @@ func (r *noopCallReporter) ReportRoomID(v string) {} func (r *noopCallReporter) ReportRoomName(v string) {} func (r *noopCallReporter) ReportError(v string) {} func (r *noopCallReporter) ReportStatus(v CallStatus) {} + +type noopCallTx struct{} + +func (t *noopCallTx) Project() ProjectTx { + return &noopProjectTx{} +} + +func (t *noopCallTx) ReportStartTime(v time.Time) {} +func (t *noopCallTx) ReportEndTime(v time.Time) {} +func (t *noopCallTx) ReportDuration(v uint64) {} +func (t *noopCallTx) ReportDurationMinutes(v uint16) {} +func (t *noopCallTx) ReportDirection(v CallDirection) {} +func (t *noopCallTx) ReportCallType(v CallCallType) {} +func (t *noopCallTx) ReportFrom(v string) {} +func (t *noopCallTx) ReportTo(v string) {} +func (t *noopCallTx) ReportRegion(v string) {} +func (t *noopCallTx) ReportRoomID(v string) {} +func (t *noopCallTx) ReportRoomName(v string) {} +func (t *noopCallTx) ReportError(v string) {} +func (t *noopCallTx) ReportStatus(v CallStatus) {} diff --git a/observability/egressobs/gen_reporter.go b/observability/egressobs/gen_reporter.go index b97649e54..3ef2b9890 100644 --- a/observability/egressobs/gen_reporter.go +++ b/observability/egressobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,10 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithEgress(id string) EgressReporter WithDeferredEgress() (EgressReporter, KeyResolver) - ProjectTx + projectReporter } -type EgressTx interface { +type egressReporter interface { ReportRequestType(v EgressRequestType) ReportRoomName(v string) ReportRequest(v string) @@ -45,16 +50,21 @@ type EgressTx interface { ReportManifestLocation(v string) } +type EgressTx interface { + Project() ProjectTx + egressReporter +} + type EgressReporter interface { RegisterFunc(func(ts time.Time, tx EgressTx) bool) Tx(func(tx EgressTx)) TxAt(time.Time, func(tx EgressTx)) WithSession(id string) SessionReporter WithDeferredSession() (SessionReporter, KeyResolver) - EgressTx + egressReporter } -type SessionTx interface { +type sessionReporter interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) ReportUpdateTime(v time.Time) @@ -72,9 +82,14 @@ type SessionTx interface { ReportResult(v string) } +type SessionTx interface { + Egress() EgressTx + sessionReporter +} + type SessionReporter interface { RegisterFunc(func(ts time.Time, tx SessionTx) bool) Tx(func(tx SessionTx)) TxAt(time.Time, func(tx SessionTx)) - SessionTx + sessionReporter } diff --git a/observability/egressobs/gen_reporter_noop.go b/observability/egressobs/gen_reporter_noop.go index 10043d3b5..7b00af3b0 100644 --- a/observability/egressobs/gen_reporter_noop.go +++ b/observability/egressobs/gen_reporter_noop.go @@ -9,8 +9,11 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ EgressReporter = (*noopEgressReporter)(nil) + _ EgressTx = (*noopEgressTx)(nil) _ SessionReporter = (*noopSessionReporter)(nil) + _ SessionTx = (*noopSessionTx)(nil) ) type noopKeyResolver struct{} @@ -48,6 +51,8 @@ func (r *noopProjectReporter) WithDeferredEgress() (EgressReporter, KeyResolver) return &noopEgressReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopEgressReporter struct{} func NewNoopEgressReporter() EgressReporter { @@ -77,6 +82,26 @@ func (r *noopEgressReporter) WithDeferredSession() (SessionReporter, KeyResolver return &noopSessionReporter{}, noopKeyResolver{} } +type noopEgressTx struct{} + +func (t *noopEgressTx) Project() ProjectTx { + return &noopProjectTx{} +} + +func (t *noopEgressTx) ReportRequestType(v EgressRequestType) {} +func (t *noopEgressTx) ReportRoomName(v string) {} +func (t *noopEgressTx) ReportRequest(v string) {} +func (t *noopEgressTx) ReportAudioOnly(v bool) {} +func (t *noopEgressTx) ReportStartTime(v time.Time) {} +func (t *noopEgressTx) ReportEndTime(v time.Time) {} +func (t *noopEgressTx) ReportUpdateTime(v time.Time) {} +func (t *noopEgressTx) ReportStatus(v string) {} +func (t *noopEgressTx) ReportDetails(v string) {} +func (t *noopEgressTx) ReportError(v string) {} +func (t *noopEgressTx) ReportErrorCode(v int32) {} +func (t *noopEgressTx) ReportResult(v string) {} +func (t *noopEgressTx) ReportManifestLocation(v string) {} + type noopSessionReporter struct{} func NewNoopSessionReporter() SessionReporter { @@ -101,3 +126,25 @@ func (r *noopSessionReporter) ReportErrorCode(v int32) func (r *noopSessionReporter) ReportManifestLocation(v string) {} func (r *noopSessionReporter) ReportBackupStorageUsed(v bool) {} func (r *noopSessionReporter) ReportResult(v string) {} + +type noopSessionTx struct{} + +func (t *noopSessionTx) Egress() EgressTx { + return &noopEgressTx{} +} + +func (t *noopSessionTx) ReportStartTime(v time.Time) {} +func (t *noopSessionTx) ReportEndTime(v time.Time) {} +func (t *noopSessionTx) ReportUpdateTime(v time.Time) {} +func (t *noopSessionTx) ReportDuration(v uint64) {} +func (t *noopSessionTx) ReportRetryCount(v uint32) {} +func (t *noopSessionTx) ReportSourceType(v SessionSourceType) {} +func (t *noopSessionTx) ReportRegion(v string) {} +func (t *noopSessionTx) ReportRoomID(v string) {} +func (t *noopSessionTx) ReportStatus(v string) {} +func (t *noopSessionTx) ReportDetails(v string) {} +func (t *noopSessionTx) ReportError(v string) {} +func (t *noopSessionTx) ReportErrorCode(v int32) {} +func (t *noopSessionTx) ReportManifestLocation(v string) {} +func (t *noopSessionTx) ReportBackupStorageUsed(v bool) {} +func (t *noopSessionTx) ReportResult(v string) {} diff --git a/observability/gatewayobs/gen_reporter.go b/observability/gatewayobs/gen_reporter.go index 68084852e..4f7808701 100644 --- a/observability/gatewayobs/gen_reporter.go +++ b/observability/gatewayobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,16 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithRequestedPriority(priority string) RequestedPriorityReporter WithDeferredRequestedPriority() (RequestedPriorityReporter, KeyResolver) - ProjectTx + projectReporter +} + +type requestedPriorityReporter interface { } -type RequestedPriorityTx interface{} +type RequestedPriorityTx interface { + Project() ProjectTx + requestedPriorityReporter +} type RequestedPriorityReporter interface { RegisterFunc(func(ts time.Time, tx RequestedPriorityTx) bool) @@ -37,10 +48,16 @@ type RequestedPriorityReporter interface { TxAt(time.Time, func(tx RequestedPriorityTx)) WithGrantedPriority(priority string) GrantedPriorityReporter WithDeferredGrantedPriority() (GrantedPriorityReporter, KeyResolver) - RequestedPriorityTx + requestedPriorityReporter } -type GrantedPriorityTx interface{} +type grantedPriorityReporter interface { +} + +type GrantedPriorityTx interface { + RequestedPriority() RequestedPriorityTx + grantedPriorityReporter +} type GrantedPriorityReporter interface { RegisterFunc(func(ts time.Time, tx GrantedPriorityTx) bool) @@ -48,10 +65,16 @@ type GrantedPriorityReporter interface { TxAt(time.Time, func(tx GrantedPriorityTx)) WithBillablePriority(priority string) BillablePriorityReporter WithDeferredBillablePriority() (BillablePriorityReporter, KeyResolver) - GrantedPriorityTx + grantedPriorityReporter } -type BillablePriorityTx interface{} +type billablePriorityReporter interface { +} + +type BillablePriorityTx interface { + GrantedPriority() GrantedPriorityTx + billablePriorityReporter +} type BillablePriorityReporter interface { RegisterFunc(func(ts time.Time, tx BillablePriorityTx) bool) @@ -59,10 +82,16 @@ type BillablePriorityReporter interface { TxAt(time.Time, func(tx BillablePriorityTx)) WithProvider(name string) ProviderReporter WithDeferredProvider() (ProviderReporter, KeyResolver) - BillablePriorityTx + billablePriorityReporter } -type ProviderTx interface{} +type providerReporter interface { +} + +type ProviderTx interface { + BillablePriority() BillablePriorityTx + providerReporter +} type ProviderReporter interface { RegisterFunc(func(ts time.Time, tx ProviderTx) bool) @@ -70,10 +99,10 @@ type ProviderReporter interface { TxAt(time.Time, func(tx ProviderTx)) WithModel(name string) ModelReporter WithDeferredModel() (ModelReporter, KeyResolver) - ProviderTx + providerReporter } -type ModelTx interface { +type modelReporter interface { ReportInferencePromptTokens(v uint64) ReportInferencePromptCacheTokens(v uint64) ReportInferenceCompletionTokens(v uint64) @@ -87,9 +116,14 @@ type ModelTx interface { ReportVoiceCloneRequests(v uint64) } +type ModelTx interface { + Provider() ProviderTx + modelReporter +} + type ModelReporter interface { RegisterFunc(func(ts time.Time, tx ModelTx) bool) Tx(func(tx ModelTx)) TxAt(time.Time, func(tx ModelTx)) - ModelTx + modelReporter } diff --git a/observability/gatewayobs/gen_reporter_noop.go b/observability/gatewayobs/gen_reporter_noop.go index 328b69560..5086ad87b 100644 --- a/observability/gatewayobs/gen_reporter_noop.go +++ b/observability/gatewayobs/gen_reporter_noop.go @@ -9,11 +9,17 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ RequestedPriorityReporter = (*noopRequestedPriorityReporter)(nil) + _ RequestedPriorityTx = (*noopRequestedPriorityTx)(nil) _ GrantedPriorityReporter = (*noopGrantedPriorityReporter)(nil) + _ GrantedPriorityTx = (*noopGrantedPriorityTx)(nil) _ BillablePriorityReporter = (*noopBillablePriorityReporter)(nil) + _ BillablePriorityTx = (*noopBillablePriorityTx)(nil) _ ProviderReporter = (*noopProviderReporter)(nil) + _ ProviderTx = (*noopProviderTx)(nil) _ ModelReporter = (*noopModelReporter)(nil) + _ ModelTx = (*noopModelTx)(nil) ) type noopKeyResolver struct{} @@ -51,6 +57,8 @@ func (r *noopProjectReporter) WithDeferredRequestedPriority() (RequestedPriority return &noopRequestedPriorityReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopRequestedPriorityReporter struct{} func NewNoopRequestedPriorityReporter() RequestedPriorityReporter { @@ -68,6 +76,12 @@ func (r *noopRequestedPriorityReporter) WithDeferredGrantedPriority() (GrantedPr return &noopGrantedPriorityReporter{}, noopKeyResolver{} } +type noopRequestedPriorityTx struct{} + +func (t *noopRequestedPriorityTx) Project() ProjectTx { + return &noopProjectTx{} +} + type noopGrantedPriorityReporter struct{} func NewNoopGrantedPriorityReporter() GrantedPriorityReporter { @@ -84,6 +98,12 @@ func (r *noopGrantedPriorityReporter) WithDeferredBillablePriority() (BillablePr return &noopBillablePriorityReporter{}, noopKeyResolver{} } +type noopGrantedPriorityTx struct{} + +func (t *noopGrantedPriorityTx) RequestedPriority() RequestedPriorityTx { + return &noopRequestedPriorityTx{} +} + type noopBillablePriorityReporter struct{} func NewNoopBillablePriorityReporter() BillablePriorityReporter { @@ -101,6 +121,12 @@ func (r *noopBillablePriorityReporter) WithDeferredProvider() (ProviderReporter, return &noopProviderReporter{}, noopKeyResolver{} } +type noopBillablePriorityTx struct{} + +func (t *noopBillablePriorityTx) GrantedPriority() GrantedPriorityTx { + return &noopGrantedPriorityTx{} +} + type noopProviderReporter struct{} func NewNoopProviderReporter() ProviderReporter { @@ -117,6 +143,12 @@ func (r *noopProviderReporter) WithDeferredModel() (ModelReporter, KeyResolver) return &noopModelReporter{}, noopKeyResolver{} } +type noopProviderTx struct{} + +func (t *noopProviderTx) BillablePriority() BillablePriorityTx { + return &noopBillablePriorityTx{} +} + type noopModelReporter struct{} func NewNoopModelReporter() ModelReporter { @@ -137,3 +169,21 @@ func (r *noopModelReporter) ReportTtsChars(v uint32) func (r *noopModelReporter) ReportBargeInRequests(v uint64) {} func (r *noopModelReporter) ReportBargeInRequestTypes(v ModelBargeInRequestTypes) {} func (r *noopModelReporter) ReportVoiceCloneRequests(v uint64) {} + +type noopModelTx struct{} + +func (t *noopModelTx) Provider() ProviderTx { + return &noopProviderTx{} +} + +func (t *noopModelTx) ReportInferencePromptTokens(v uint64) {} +func (t *noopModelTx) ReportInferencePromptCacheTokens(v uint64) {} +func (t *noopModelTx) ReportInferenceCompletionTokens(v uint64) {} +func (t *noopModelTx) ReportInferenceTotalTokens(v uint64) {} +func (t *noopModelTx) ReportInferenceCacheCreateTokens(v uint64) {} +func (t *noopModelTx) ReportInferenceCacheReadTokens(v uint64) {} +func (t *noopModelTx) ReportSttDuration(v uint32) {} +func (t *noopModelTx) ReportTtsChars(v uint32) {} +func (t *noopModelTx) ReportBargeInRequests(v uint64) {} +func (t *noopModelTx) ReportBargeInRequestTypes(v ModelBargeInRequestTypes) {} +func (t *noopModelTx) ReportVoiceCloneRequests(v uint64) {} diff --git a/observability/ingressobs/gen_reporter.go b/observability/ingressobs/gen_reporter.go index b08069591..56edd5a99 100644 --- a/observability/ingressobs/gen_reporter.go +++ b/observability/ingressobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,16 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithIngress(id string) IngressReporter WithDeferredIngress() (IngressReporter, KeyResolver) - ProjectTx + projectReporter +} + +type ingressReporter interface { } -type IngressTx interface{} +type IngressTx interface { + Project() ProjectTx + ingressReporter +} type IngressReporter interface { RegisterFunc(func(ts time.Time, tx IngressTx) bool) @@ -37,10 +48,10 @@ type IngressReporter interface { TxAt(time.Time, func(tx IngressTx)) WithSession(id string) SessionReporter WithDeferredSession() (SessionReporter, KeyResolver) - IngressTx + ingressReporter } -type SessionTx interface { +type sessionReporter interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) ReportDuration(v uint64) @@ -55,9 +66,14 @@ type SessionTx interface { ReportReusable(v bool) } +type SessionTx interface { + Ingress() IngressTx + sessionReporter +} + type SessionReporter interface { RegisterFunc(func(ts time.Time, tx SessionTx) bool) Tx(func(tx SessionTx)) TxAt(time.Time, func(tx SessionTx)) - SessionTx + sessionReporter } diff --git a/observability/ingressobs/gen_reporter_noop.go b/observability/ingressobs/gen_reporter_noop.go index 3ca12a56d..c36cff894 100644 --- a/observability/ingressobs/gen_reporter_noop.go +++ b/observability/ingressobs/gen_reporter_noop.go @@ -9,8 +9,11 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ IngressReporter = (*noopIngressReporter)(nil) + _ IngressTx = (*noopIngressTx)(nil) _ SessionReporter = (*noopSessionReporter)(nil) + _ SessionTx = (*noopSessionTx)(nil) ) type noopKeyResolver struct{} @@ -48,6 +51,8 @@ func (r *noopProjectReporter) WithDeferredIngress() (IngressReporter, KeyResolve return &noopIngressReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopIngressReporter struct{} func NewNoopIngressReporter() IngressReporter { @@ -64,6 +69,12 @@ func (r *noopIngressReporter) WithDeferredSession() (SessionReporter, KeyResolve return &noopSessionReporter{}, noopKeyResolver{} } +type noopIngressTx struct{} + +func (t *noopIngressTx) Project() ProjectTx { + return &noopProjectTx{} +} + type noopSessionReporter struct{} func NewNoopSessionReporter() SessionReporter { @@ -85,3 +96,22 @@ func (r *noopSessionReporter) ReportStatus(v SessionStatus) func (r *noopSessionReporter) ReportAudioOnly(v bool) {} func (r *noopSessionReporter) ReportTranscoded(v bool) {} func (r *noopSessionReporter) ReportReusable(v bool) {} + +type noopSessionTx struct{} + +func (t *noopSessionTx) Ingress() IngressTx { + return &noopIngressTx{} +} + +func (t *noopSessionTx) ReportStartTime(v time.Time) {} +func (t *noopSessionTx) ReportEndTime(v time.Time) {} +func (t *noopSessionTx) ReportDuration(v uint64) {} +func (t *noopSessionTx) ReportInputType(v SessionInputType) {} +func (t *noopSessionTx) ReportRegion(v string) {} +func (t *noopSessionTx) ReportRoomName(v string) {} +func (t *noopSessionTx) ReportRoomID(v string) {} +func (t *noopSessionTx) ReportError(v string) {} +func (t *noopSessionTx) ReportStatus(v SessionStatus) {} +func (t *noopSessionTx) ReportAudioOnly(v bool) {} +func (t *noopSessionTx) ReportTranscoded(v bool) {} +func (t *noopSessionTx) ReportReusable(v bool) {} diff --git a/observability/roomobs/gen_reporter.go b/observability/roomobs/gen_reporter.go index a9b5f9bd1..7efe7eb8f 100644 --- a/observability/roomobs/gen_reporter.go +++ b/observability/roomobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,16 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithRoom(name string) RoomReporter WithDeferredRoom() (RoomReporter, KeyResolver) - ProjectTx + projectReporter } -type RoomTx interface{} +type roomReporter interface { +} + +type RoomTx interface { + Project() ProjectTx + roomReporter +} type RoomReporter interface { RegisterFunc(func(ts time.Time, tx RoomTx) bool) @@ -37,10 +48,10 @@ type RoomReporter interface { TxAt(time.Time, func(tx RoomTx)) WithRoomSession(id string) RoomSessionReporter WithDeferredRoomSession() (RoomSessionReporter, KeyResolver) - RoomTx + roomReporter } -type RoomSessionTx interface { +type roomSessionReporter interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) ReportFeatures(v uint16) @@ -49,16 +60,27 @@ type RoomSessionTx interface { ReportClosed(v bool) } +type RoomSessionTx interface { + Room() RoomTx + roomSessionReporter +} + type RoomSessionReporter interface { RegisterFunc(func(ts time.Time, tx RoomSessionTx) bool) Tx(func(tx RoomSessionTx)) TxAt(time.Time, func(tx RoomSessionTx)) WithParticipant(identity string) ParticipantReporter WithDeferredParticipant() (ParticipantReporter, KeyResolver) - RoomSessionTx + roomSessionReporter } -type ParticipantTx interface{} +type participantReporter interface { +} + +type ParticipantTx interface { + RoomSession() RoomSessionTx + participantReporter +} type ParticipantReporter interface { RegisterFunc(func(ts time.Time, tx ParticipantTx) bool) @@ -66,10 +88,10 @@ type ParticipantReporter interface { TxAt(time.Time, func(tx ParticipantTx)) WithParticipantSession(id string) ParticipantSessionReporter WithDeferredParticipantSession() (ParticipantSessionReporter, KeyResolver) - ParticipantTx + participantReporter } -type ParticipantSessionTx interface { +type participantSessionReporter interface { ReportRegion(v string) ReportClientConnectTime(v uint16) ReportConnectResult(v ConnectionResult) @@ -89,16 +111,21 @@ type ParticipantSessionTx interface { ReportFeatures(v uint16) } +type ParticipantSessionTx interface { + Participant() ParticipantTx + participantSessionReporter +} + type ParticipantSessionReporter interface { RegisterFunc(func(ts time.Time, tx ParticipantSessionTx) bool) Tx(func(tx ParticipantSessionTx)) TxAt(time.Time, func(tx ParticipantSessionTx)) WithTrack(id string) TrackReporter WithDeferredTrack() (TrackReporter, KeyResolver) - ParticipantSessionTx + participantSessionReporter } -type TrackTx interface { +type trackReporter interface { ReportName(v string) ReportKind(v TrackKind) ReportType(v TrackType) @@ -115,9 +142,14 @@ type TrackTx interface { ReportScore(v float32) } +type TrackTx interface { + ParticipantSession() ParticipantSessionTx + trackReporter +} + type TrackReporter interface { RegisterFunc(func(ts time.Time, tx TrackTx) bool) Tx(func(tx TrackTx)) TxAt(time.Time, func(tx TrackTx)) - TrackTx + trackReporter } diff --git a/observability/roomobs/gen_reporter_noop.go b/observability/roomobs/gen_reporter_noop.go index 85c74c0c2..b35833e01 100644 --- a/observability/roomobs/gen_reporter_noop.go +++ b/observability/roomobs/gen_reporter_noop.go @@ -9,11 +9,17 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ RoomReporter = (*noopRoomReporter)(nil) + _ RoomTx = (*noopRoomTx)(nil) _ RoomSessionReporter = (*noopRoomSessionReporter)(nil) + _ RoomSessionTx = (*noopRoomSessionTx)(nil) _ ParticipantReporter = (*noopParticipantReporter)(nil) + _ ParticipantTx = (*noopParticipantTx)(nil) _ ParticipantSessionReporter = (*noopParticipantSessionReporter)(nil) + _ ParticipantSessionTx = (*noopParticipantSessionTx)(nil) _ TrackReporter = (*noopTrackReporter)(nil) + _ TrackTx = (*noopTrackTx)(nil) ) type noopKeyResolver struct{} @@ -51,6 +57,8 @@ func (r *noopProjectReporter) WithDeferredRoom() (RoomReporter, KeyResolver) { return &noopRoomReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopRoomReporter struct{} func NewNoopRoomReporter() RoomReporter { @@ -67,6 +75,12 @@ func (r *noopRoomReporter) WithDeferredRoomSession() (RoomSessionReporter, KeyRe return &noopRoomSessionReporter{}, noopKeyResolver{} } +type noopRoomTx struct{} + +func (t *noopRoomTx) Project() ProjectTx { + return &noopProjectTx{} +} + type noopRoomSessionReporter struct{} func NewNoopRoomSessionReporter() RoomSessionReporter { @@ -89,6 +103,19 @@ func (r *noopRoomSessionReporter) WithDeferredParticipant() (ParticipantReporter return &noopParticipantReporter{}, noopKeyResolver{} } +type noopRoomSessionTx struct{} + +func (t *noopRoomSessionTx) Room() RoomTx { + return &noopRoomTx{} +} + +func (t *noopRoomSessionTx) ReportStartTime(v time.Time) {} +func (t *noopRoomSessionTx) ReportEndTime(v time.Time) {} +func (t *noopRoomSessionTx) ReportFeatures(v uint16) {} +func (t *noopRoomSessionTx) ReportRoomDuration(v uint32) {} +func (t *noopRoomSessionTx) ReportTags(v []string) {} +func (t *noopRoomSessionTx) ReportClosed(v bool) {} + type noopParticipantReporter struct{} func NewNoopParticipantReporter() ParticipantReporter { @@ -105,6 +132,12 @@ func (r *noopParticipantReporter) WithDeferredParticipantSession() (ParticipantS return &noopParticipantSessionReporter{}, noopKeyResolver{} } +type noopParticipantTx struct{} + +func (t *noopParticipantTx) RoomSession() RoomSessionTx { + return &noopRoomSessionTx{} +} + type noopParticipantSessionReporter struct{} func NewNoopParticipantSessionReporter() ParticipantSessionReporter { @@ -139,6 +172,30 @@ func (r *noopParticipantSessionReporter) WithDeferredTrack() (TrackReporter, Key return &noopTrackReporter{}, noopKeyResolver{} } +type noopParticipantSessionTx struct{} + +func (t *noopParticipantSessionTx) Participant() ParticipantTx { + return &noopParticipantTx{} +} + +func (t *noopParticipantSessionTx) ReportRegion(v string) {} +func (t *noopParticipantSessionTx) ReportClientConnectTime(v uint16) {} +func (t *noopParticipantSessionTx) ReportConnectResult(v ConnectionResult) {} +func (t *noopParticipantSessionTx) ReportConnectionType(v ConnectionType) {} +func (t *noopParticipantSessionTx) ReportOs(v ClientOS) {} +func (t *noopParticipantSessionTx) ReportDeviceModel(v string) {} +func (t *noopParticipantSessionTx) ReportBrowser(v string) {} +func (t *noopParticipantSessionTx) ReportSdkVersion(v string) {} +func (t *noopParticipantSessionTx) ReportCountry(v uint16) {} +func (t *noopParticipantSessionTx) ReportIspAsn(v uint32) {} +func (t *noopParticipantSessionTx) ReportStartTime(v time.Time) {} +func (t *noopParticipantSessionTx) ReportEndTime(v time.Time) {} +func (t *noopParticipantSessionTx) ReportDuration(v uint16) {} +func (t *noopParticipantSessionTx) ReportDurationMinutes(v uint8) {} +func (t *noopParticipantSessionTx) ReportKind(v string) {} +func (t *noopParticipantSessionTx) ReportName(v string) {} +func (t *noopParticipantSessionTx) ReportFeatures(v uint16) {} + type noopTrackReporter struct{} func NewNoopTrackReporter() TrackReporter { @@ -162,3 +219,24 @@ func (r *noopTrackReporter) ReportSendPackets(v uint32) func (r *noopTrackReporter) ReportRecvPackets(v uint32) {} func (r *noopTrackReporter) ReportPacketsLost(v uint32) {} func (r *noopTrackReporter) ReportScore(v float32) {} + +type noopTrackTx struct{} + +func (t *noopTrackTx) ParticipantSession() ParticipantSessionTx { + return &noopParticipantSessionTx{} +} + +func (t *noopTrackTx) ReportName(v string) {} +func (t *noopTrackTx) ReportKind(v TrackKind) {} +func (t *noopTrackTx) ReportType(v TrackType) {} +func (t *noopTrackTx) ReportSource(v TrackSource) {} +func (t *noopTrackTx) ReportMime(v MimeType) {} +func (t *noopTrackTx) ReportLayer(v uint32) {} +func (t *noopTrackTx) ReportDuration(v uint16) {} +func (t *noopTrackTx) ReportFrames(v uint16) {} +func (t *noopTrackTx) ReportSendBytes(v uint32) {} +func (t *noopTrackTx) ReportRecvBytes(v uint32) {} +func (t *noopTrackTx) ReportSendPackets(v uint32) {} +func (t *noopTrackTx) ReportRecvPackets(v uint32) {} +func (t *noopTrackTx) ReportPacketsLost(v uint32) {} +func (t *noopTrackTx) ReportScore(v float32) {} diff --git a/observability/sipcallobs/gen_reporter.go b/observability/sipcallobs/gen_reporter.go index 1682e7074..b616b44db 100644 --- a/observability/sipcallobs/gen_reporter.go +++ b/observability/sipcallobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,10 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithCall(id string) CallReporter WithDeferredCall() (CallReporter, KeyResolver) - ProjectTx + projectReporter } -type CallTx interface { +type callReporter interface { ReportStartTime(v time.Time) ReportEndTime(v time.Time) ReportDuration(v uint64) @@ -70,9 +75,14 @@ type CallTx interface { ReportMediaEncryption(v string) } +type CallTx interface { + Project() ProjectTx + callReporter +} + type CallReporter interface { RegisterFunc(func(ts time.Time, tx CallTx) bool) Tx(func(tx CallTx)) TxAt(time.Time, func(tx CallTx)) - CallTx + callReporter } diff --git a/observability/sipcallobs/gen_reporter_noop.go b/observability/sipcallobs/gen_reporter_noop.go index dc3c83b17..c5e983a48 100644 --- a/observability/sipcallobs/gen_reporter_noop.go +++ b/observability/sipcallobs/gen_reporter_noop.go @@ -9,7 +9,9 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ CallReporter = (*noopCallReporter)(nil) + _ CallTx = (*noopCallTx)(nil) ) type noopKeyResolver struct{} @@ -47,6 +49,8 @@ func (r *noopProjectReporter) WithDeferredCall() (CallReporter, KeyResolver) { return &noopCallReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopCallReporter struct{} func NewNoopCallReporter() CallReporter { @@ -94,3 +98,48 @@ func (r *noopCallReporter) ReportAttributes(v string) func (r *noopCallReporter) ReportFeatures(v uint16) {} func (r *noopCallReporter) ReportMediaEncryptionSettings(v CallMediaEncryptionSettings) {} func (r *noopCallReporter) ReportMediaEncryption(v string) {} + +type noopCallTx struct{} + +func (t *noopCallTx) Project() ProjectTx { + return &noopProjectTx{} +} + +func (t *noopCallTx) ReportStartTime(v time.Time) {} +func (t *noopCallTx) ReportEndTime(v time.Time) {} +func (t *noopCallTx) ReportDuration(v uint64) {} +func (t *noopCallTx) ReportDurationMinutes(v uint16) {} +func (t *noopCallTx) ReportTrunkID(v string) {} +func (t *noopCallTx) ReportTrunkType(v CallTrunkType) {} +func (t *noopCallTx) ReportDispatchID(v string) {} +func (t *noopCallTx) ReportToNumber(v string) {} +func (t *noopCallTx) ReportToHost(v string) {} +func (t *noopCallTx) ReportFromNumber(v string) {} +func (t *noopCallTx) ReportFromHost(v string) {} +func (t *noopCallTx) ReportNumberType(v CallNumberType) {} +func (t *noopCallTx) ReportCountryCode(v string) {} +func (t *noopCallTx) ReportDirection(v CallDirection) {} +func (t *noopCallTx) ReportTransport(v CallTransport) {} +func (t *noopCallTx) ReportProviderCallID(v string) {} +func (t *noopCallTx) ReportProviderName(v string) {} +func (t *noopCallTx) ReportSIPCallID(v string) {} +func (t *noopCallTx) ReportRoomID(v string) {} +func (t *noopCallTx) ReportRoomName(v string) {} +func (t *noopCallTx) ReportParticipantIdentity(v string) {} +func (t *noopCallTx) ReportError(v string) {} +func (t *noopCallTx) ReportStatus(v CallStatus) {} +func (t *noopCallTx) ReportResponseCode(v uint16) {} +func (t *noopCallTx) ReportDisconnectReason(v string) {} +func (t *noopCallTx) ReportTransferID(v string) {} +func (t *noopCallTx) ReportTransferTo(v string) {} +func (t *noopCallTx) ReportTransferDuration(v uint32) {} +func (t *noopCallTx) ReportTransferStatus(v CallTransferStatus) {} +func (t *noopCallTx) ReportTransferStatusCode(v uint16) {} +func (t *noopCallTx) ReportTransferError(v string) {} +func (t *noopCallTx) ReportCodec(v string) {} +func (t *noopCallTx) ReportRegion(v string) {} +func (t *noopCallTx) ReportPcapLink(v string) {} +func (t *noopCallTx) ReportAttributes(v string) {} +func (t *noopCallTx) ReportFeatures(v uint16) {} +func (t *noopCallTx) ReportMediaEncryptionSettings(v CallMediaEncryptionSettings) {} +func (t *noopCallTx) ReportMediaEncryption(v string) {} diff --git a/observability/storageobs/gen_reporter.go b/observability/storageobs/gen_reporter.go index 29ec00777..eb8a41ed6 100644 --- a/observability/storageobs/gen_reporter.go +++ b/observability/storageobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,10 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithEvent(id string) EventReporter WithDeferredEvent() (EventReporter, KeyResolver) - ProjectTx + projectReporter } -type EventTx interface { +type eventReporter interface { ReportService(v EventService) ReportServiceID(v string) ReportOperation(v EventOperation) @@ -38,9 +43,14 @@ type EventTx interface { ReportLifetime(v uint64) } +type EventTx interface { + Project() ProjectTx + eventReporter +} + type EventReporter interface { RegisterFunc(func(ts time.Time, tx EventTx) bool) Tx(func(tx EventTx)) TxAt(time.Time, func(tx EventTx)) - EventTx + eventReporter } diff --git a/observability/storageobs/gen_reporter_noop.go b/observability/storageobs/gen_reporter_noop.go index 077ce8260..4bec217f2 100644 --- a/observability/storageobs/gen_reporter_noop.go +++ b/observability/storageobs/gen_reporter_noop.go @@ -9,7 +9,9 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ EventReporter = (*noopEventReporter)(nil) + _ EventTx = (*noopEventTx)(nil) ) type noopKeyResolver struct{} @@ -47,6 +49,8 @@ func (r *noopProjectReporter) WithDeferredEvent() (EventReporter, KeyResolver) { return &noopEventReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopEventReporter struct{} func NewNoopEventReporter() EventReporter { @@ -62,3 +66,16 @@ func (r *noopEventReporter) ReportOperation(v EventOperation) func (r *noopEventReporter) ReportPath(v string) {} func (r *noopEventReporter) ReportSize(v uint64) {} func (r *noopEventReporter) ReportLifetime(v uint64) {} + +type noopEventTx struct{} + +func (t *noopEventTx) Project() ProjectTx { + return &noopProjectTx{} +} + +func (t *noopEventTx) ReportService(v EventService) {} +func (t *noopEventTx) ReportServiceID(v string) {} +func (t *noopEventTx) ReportOperation(v EventOperation) {} +func (t *noopEventTx) ReportPath(v string) {} +func (t *noopEventTx) ReportSize(v uint64) {} +func (t *noopEventTx) ReportLifetime(v uint64) {} diff --git a/observability/telephonyobs/gen_reporter.go b/observability/telephonyobs/gen_reporter.go index 1cd8f5578..0c068a45d 100644 --- a/observability/telephonyobs/gen_reporter.go +++ b/observability/telephonyobs/gen_reporter.go @@ -18,7 +18,12 @@ type Reporter interface { WithDeferredProject() (ProjectReporter, KeyResolver) } -type ProjectTx interface{} +type projectReporter interface { +} + +type ProjectTx interface { + projectReporter +} type ProjectReporter interface { RegisterFunc(func(ts time.Time, tx ProjectTx) bool) @@ -26,10 +31,16 @@ type ProjectReporter interface { TxAt(time.Time, func(tx ProjectTx)) WithCarrier(id string) CarrierReporter WithDeferredCarrier() (CarrierReporter, KeyResolver) - ProjectTx + projectReporter +} + +type carrierReporter interface { } -type CarrierTx interface{} +type CarrierTx interface { + Project() ProjectTx + carrierReporter +} type CarrierReporter interface { RegisterFunc(func(ts time.Time, tx CarrierTx) bool) @@ -37,10 +48,16 @@ type CarrierReporter interface { TxAt(time.Time, func(tx CarrierTx)) WithCountry(code string) CountryReporter WithDeferredCountry() (CountryReporter, KeyResolver) - CarrierTx + carrierReporter +} + +type countryReporter interface { } -type CountryTx interface{} +type CountryTx interface { + Carrier() CarrierTx + countryReporter +} type CountryReporter interface { RegisterFunc(func(ts time.Time, tx CountryTx) bool) @@ -48,10 +65,16 @@ type CountryReporter interface { TxAt(time.Time, func(tx CountryTx)) WithPhone(number string) PhoneReporter WithDeferredPhone() (PhoneReporter, KeyResolver) - CountryTx + countryReporter +} + +type phoneReporter interface { } -type PhoneTx interface{} +type PhoneTx interface { + Country() CountryTx + phoneReporter +} type PhoneReporter interface { RegisterFunc(func(ts time.Time, tx PhoneTx) bool) @@ -59,10 +82,10 @@ type PhoneReporter interface { TxAt(time.Time, func(tx PhoneTx)) WithCall(id string) CallReporter WithDeferredCall() (CallReporter, KeyResolver) - PhoneTx + phoneReporter } -type CallTx interface { +type callReporter interface { ReportDirection(v DirectionType) ReportNumberType(v NumberType) ReportStatus(v CallStatus) @@ -75,9 +98,14 @@ type CallTx interface { ReportEndTime(v time.Time) } +type CallTx interface { + Phone() PhoneTx + callReporter +} + type CallReporter interface { RegisterFunc(func(ts time.Time, tx CallTx) bool) Tx(func(tx CallTx)) TxAt(time.Time, func(tx CallTx)) - CallTx + callReporter } diff --git a/observability/telephonyobs/gen_reporter_noop.go b/observability/telephonyobs/gen_reporter_noop.go index bccaac97b..280bf01d9 100644 --- a/observability/telephonyobs/gen_reporter_noop.go +++ b/observability/telephonyobs/gen_reporter_noop.go @@ -9,10 +9,15 @@ import ( var ( _ Reporter = (*noopReporter)(nil) _ ProjectReporter = (*noopProjectReporter)(nil) + _ ProjectTx = (*noopProjectTx)(nil) _ CarrierReporter = (*noopCarrierReporter)(nil) + _ CarrierTx = (*noopCarrierTx)(nil) _ CountryReporter = (*noopCountryReporter)(nil) + _ CountryTx = (*noopCountryTx)(nil) _ PhoneReporter = (*noopPhoneReporter)(nil) + _ PhoneTx = (*noopPhoneTx)(nil) _ CallReporter = (*noopCallReporter)(nil) + _ CallTx = (*noopCallTx)(nil) ) type noopKeyResolver struct{} @@ -50,6 +55,8 @@ func (r *noopProjectReporter) WithDeferredCarrier() (CarrierReporter, KeyResolve return &noopCarrierReporter{}, noopKeyResolver{} } +type noopProjectTx struct{} + type noopCarrierReporter struct{} func NewNoopCarrierReporter() CarrierReporter { @@ -66,6 +73,12 @@ func (r *noopCarrierReporter) WithDeferredCountry() (CountryReporter, KeyResolve return &noopCountryReporter{}, noopKeyResolver{} } +type noopCarrierTx struct{} + +func (t *noopCarrierTx) Project() ProjectTx { + return &noopProjectTx{} +} + type noopCountryReporter struct{} func NewNoopCountryReporter() CountryReporter { @@ -82,6 +95,12 @@ func (r *noopCountryReporter) WithDeferredPhone() (PhoneReporter, KeyResolver) { return &noopPhoneReporter{}, noopKeyResolver{} } +type noopCountryTx struct{} + +func (t *noopCountryTx) Carrier() CarrierTx { + return &noopCarrierTx{} +} + type noopPhoneReporter struct{} func NewNoopPhoneReporter() PhoneReporter { @@ -98,6 +117,12 @@ func (r *noopPhoneReporter) WithDeferredCall() (CallReporter, KeyResolver) { return &noopCallReporter{}, noopKeyResolver{} } +type noopPhoneTx struct{} + +func (t *noopPhoneTx) Country() CountryTx { + return &noopCountryTx{} +} + type noopCallReporter struct{} func NewNoopCallReporter() CallReporter { @@ -117,3 +142,20 @@ func (r *noopCallReporter) ReportDuration(v uint32) {} func (r *noopCallReporter) ReportDurationMinutes(v uint16) {} func (r *noopCallReporter) ReportStartTime(v time.Time) {} func (r *noopCallReporter) ReportEndTime(v time.Time) {} + +type noopCallTx struct{} + +func (t *noopCallTx) Phone() PhoneTx { + return &noopPhoneTx{} +} + +func (t *noopCallTx) ReportDirection(v DirectionType) {} +func (t *noopCallTx) ReportNumberType(v NumberType) {} +func (t *noopCallTx) ReportStatus(v CallStatus) {} +func (t *noopCallTx) ReportTrunkType(v TrunkType) {} +func (t *noopCallTx) ReportCountryCode(v string) {} +func (t *noopCallTx) ReportPhoneNumber(v string) {} +func (t *noopCallTx) ReportDuration(v uint32) {} +func (t *noopCallTx) ReportDurationMinutes(v uint16) {} +func (t *noopCallTx) ReportStartTime(v time.Time) {} +func (t *noopCallTx) ReportEndTime(v time.Time) {}