Set attributes on the root span

Setting them on the context doesn't actually make them show up in
jaeger, it's just a way to propagate the info around between
different things.
This commit is contained in:
David Baker 2023-03-17 19:03:43 +00:00
parent f8f5d2011d
commit 2d91b43a7d

View file

@ -84,11 +84,20 @@ export class OTelGroupCallMembership {
// Create the main span that tracks the time we intend to be in the call // Create the main span that tracks the time we intend to be in the call
this.callMembershipSpan = tracer.startSpan("otel_groupCallMembershipSpan"); this.callMembershipSpan = tracer.startSpan("otel_groupCallMembershipSpan");
this.context = opentelemetry.trace this.callMembershipSpan.setAttribute(
.setSpan(opentelemetry.context.active(), this.callMembershipSpan) "matrix.confId",
.setValue(Symbol("confId"), this.groupCall.groupCallId) this.groupCall.groupCallId
.setValue(Symbol("matrix.userId"), this.myUserId) );
.setValue(Symbol("matrix.displayName"), this.myMember.name); this.callMembershipSpan.setAttribute("matrix.userId", this.myUserId);
this.callMembershipSpan.setAttribute(
"matrix.displayName",
this.myMember.name
);
this.context = opentelemetry.trace.setSpan(
opentelemetry.context.active(),
this.callMembershipSpan
);
// Here we start a very short span. This is a hack to trigger the posthog exporter. // Here we start a very short span. This is a hack to trigger the posthog exporter.
// Only ended spans are processed by the exporter. // Only ended spans are processed by the exporter.