Address review feedback

This commit is contained in:
Robin Townsend 2023-04-05 12:56:50 -04:00
parent 711cdf9a60
commit 928f1c1d6f
2 changed files with 12 additions and 3 deletions

View file

@ -126,6 +126,10 @@ export class OTelGroupCallMembership {
public onJoinCall() {
if (!ElementCallOpenTelemetry.instance) return;
if (this.callMembershipSpan !== undefined) {
logger.warn("Call membership span is already started");
return;
}
// Create the main span that tracks the time we intend to be in the call
this.callMembershipSpan =
@ -152,9 +156,14 @@ export class OTelGroupCallMembership {
}
public onLeaveCall() {
this.callMembershipSpan!.addEvent("matrix.leaveCall");
if (this.callMembershipSpan === undefined) {
logger.warn("Call membership span is already ended");
return;
}
this.callMembershipSpan.addEvent("matrix.leaveCall");
// and end the span to indicate we've left
this.callMembershipSpan!.end();
this.callMembershipSpan.end();
this.callMembershipSpan = undefined;
this.groupCallContext = undefined;
}

View file

@ -24,7 +24,7 @@ import { useMediaStream } from "./useMediaStream";
interface Props {
tileDescriptor: TileDescriptor;
audioOutput: string;
otelGroupCallMembership: OTelGroupCallMembership;
otelGroupCallMembership?: OTelGroupCallMembership;
}
// Renders and <audio> element on the page playing the given stream