Include unended spans in rageshakes

By turning the RageshakeSpanExporter into a SpanProcessor, it can now be notified of spans as soon as they're started.
This commit is contained in:
Robin Townsend
2023-04-12 17:07:18 -04:00
parent d211d27817
commit a17ffcc327
3 changed files with 26 additions and 22 deletions

View File

@@ -28,7 +28,7 @@ import { logger } from "matrix-js-sdk/src/logger";
import { PosthogSpanExporter } from "../analytics/OtelPosthogExporter";
import { Anonymity } from "../analytics/PosthogAnalytics";
import { Config } from "../config/Config";
import { RageshakeSpanExporter } from "../analytics/RageshakeSpanExporter";
import { RageshakeSpanProcessor } from "../analytics/RageshakeSpanProcessor";
const SERVICE_NAME = "element-call";
@@ -39,7 +39,7 @@ export class ElementCallOpenTelemetry {
private _tracer: Tracer;
private _anonymity: Anonymity;
private otlpExporter: OTLPTraceExporter;
public readonly rageshakeExporter?: RageshakeSpanExporter;
public readonly rageshakeProcessor?: RageshakeSpanProcessor;
static globalInit(): void {
const config = Config.get();
@@ -89,11 +89,8 @@ export class ElementCallOpenTelemetry {
}
if (rageshakeUrl) {
logger.info("Enabling rageshake collector");
this.rageshakeExporter = new RageshakeSpanExporter();
this._provider.addSpanProcessor(
new SimpleSpanProcessor(this.rageshakeExporter)
);
this.rageshakeProcessor = new RageshakeSpanProcessor();
this._provider.addSpanProcessor(this.rageshakeProcessor);
}
const consoleExporter = new ConsoleSpanExporter();