diff --git a/package.json b/package.json index a8e5bfc5..c0d64f86 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "i18next-browser-languagedetector": "^6.1.8", "i18next-http-backend": "^1.4.4", "lodash": "^4.17.21", - "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#e89467c9fbf98182def2088a947155f30fdc7d1f", + "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#170a52b09f02096f7c877323622d685a2d586065", "matrix-widget-api": "^1.3.1", "mermaid": "^8.13.8", "normalize.css": "^8.0.1", diff --git a/src/otel/OTelGroupCallMembership.ts b/src/otel/OTelGroupCallMembership.ts index d252c315..f32a075b 100644 --- a/src/otel/OTelGroupCallMembership.ts +++ b/src/otel/OTelGroupCallMembership.ts @@ -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: [] }; } } } diff --git a/yarn.lock b/yarn.lock index 84a1c952..73f44b8f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1821,7 +1821,7 @@ resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.3.1.tgz#b50a781709c81e10701004214340f25475a171a0" integrity sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw== -"@matrix-org/matrix-sdk-crypto-js@^0.1.0-alpha.5": +"@matrix-org/matrix-sdk-crypto-js@^0.1.0-alpha.6": version "0.1.0-alpha.6" resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-js/-/matrix-sdk-crypto-js-0.1.0-alpha.6.tgz#c0bdb9ab0d30179b8ef744d1b4010b0ad0ab9c3a" integrity sha512-7hMffzw7KijxDyyH/eUyTfrLeCQHuyU3kaPOKGhcl3DZ3vx7bCncqjGMGTnxNPoP23I6gosvKSbO+3wYOT24Xg== @@ -10550,12 +10550,12 @@ matrix-events-sdk@0.0.1: resolved "https://registry.yarnpkg.com/matrix-events-sdk/-/matrix-events-sdk-0.0.1.tgz#c8c38911e2cb29023b0bbac8d6f32e0de2c957dd" integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== -"matrix-js-sdk@github:matrix-org/matrix-js-sdk#e89467c9fbf98182def2088a947155f30fdc7d1f": +"matrix-js-sdk@github:matrix-org/matrix-js-sdk#1e2be686d0e8cce444b0befc742e724155276147": version "24.0.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/e89467c9fbf98182def2088a947155f30fdc7d1f" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/1e2be686d0e8cce444b0befc742e724155276147" dependencies: "@babel/runtime" "^7.12.5" - "@matrix-org/matrix-sdk-crypto-js" "^0.1.0-alpha.5" + "@matrix-org/matrix-sdk-crypto-js" "^0.1.0-alpha.6" another-json "^0.2.0" bs58 "^5.0.0" content-type "^1.0.4"