separate summary report from stats report (#986)

* stats: separate summary report from stats report

* stats: switch to last summery stats builder

* stats: update matrix-js-sdk
This commit is contained in:
Enrico Schwendig
2023-04-06 13:19:39 +02:00
committed by GitHub
parent dd1485a277
commit bb5c382fd0
3 changed files with 33 additions and 13 deletions

View File

@@ -391,7 +391,28 @@ export class OTelGroupCallMembership {
const type = OTelStatsReportType.SummaryReport;
const data = ObjectFlattener.flattenSummaryStatsReportObject(statsReport);
this.buildStatsEventSpan({ type, data });
if (this.statsReportSpan.span === undefined && this.callMembershipSpan) {
const ctx = setSpan(
opentelemetry.context.active(),
this.callMembershipSpan
);
const span = ElementCallOpenTelemetry.instance?.tracer.startSpan(
"matrix.groupCallMembership.summaryReport",
undefined,
ctx
);
if (span === undefined) {
return;
}
span.setAttribute("matrix.confId", this.groupCall.groupCallId);
span.setAttribute("matrix.userId", this.myUserId);
span.setAttribute(
"matrix.displayName",
this.myMember ? this.myMember.name : "unknown-name"
);
span.addEvent(type, data);
span.end();
}
}
private buildStatsEventSpan(event: OTelStatsReportEvent): void {
@@ -403,11 +424,14 @@ export class OTelGroupCallMembership {
this.callMembershipSpan
);
this.statsReportSpan.span =
ElementCallOpenTelemetry.instance.tracer.startSpan(
ElementCallOpenTelemetry.instance?.tracer.startSpan(
"matrix.groupCallMembership.statsReport",
undefined,
ctx
);
if (this.statsReportSpan.span === undefined) {
return;
}
this.statsReportSpan.span.setAttribute(
"matrix.confId",
this.groupCall.groupCallId
@@ -425,12 +449,8 @@ export class OTelGroupCallMembership {
this.callMembershipSpan
) {
this.statsReportSpan.span.addEvent(event.type, event.data);
this.statsReportSpan.stats.push(event);
// if received all three types of stats close this
if (this.statsReportSpan.stats.length === 3) {
this.statsReportSpan.span.end();
this.statsReportSpan = { span: undefined, stats: [] };
}
this.statsReportSpan.span.end();
this.statsReportSpan = { span: undefined, stats: [] };
}
}
}