Include OpenTelemetry traces in rageshakes

This commit is contained in:
Robin Townsend
2023-04-11 01:09:52 -04:00
parent 6999765f39
commit 95eca18207
4 changed files with 148 additions and 21 deletions

View File

@@ -25,6 +25,14 @@ import { useClient } from "../ClientContext";
import { InspectorContext } from "../room/GroupCallInspector";
import { useModalTriggerState } from "../Modal";
import { Config } from "../config/Config";
import { ElementCallOpenTelemetry } from "../otel/otel";
const gzip = (text: string): Blob => {
// encode as UTF-8
const buf = new TextEncoder().encode(text);
// compress
return new Blob([pako.gzip(buf)]);
};
interface RageShakeSubmitOptions {
sendLogs: boolean;
@@ -235,14 +243,15 @@ export function useSubmitRageshake(): {
const logs = await getLogsForReport();
for (const entry of logs) {
// encode as UTF-8
let buf = new TextEncoder().encode(entry.lines);
// compress
buf = pako.gzip(buf);
body.append("compressed-log", new Blob([buf]), entry.id);
body.append("compressed-log", gzip(entry.lines), entry.id);
}
body.append(
"file",
gzip(ElementCallOpenTelemetry.instance.rageshakeExporter!.dump()),
"traces.json"
);
if (inspectorState) {
body.append(
"file",