otel for call start, end and mute

This is send over zipkin.
And it uses a posthog exporter to export events to posthog
using a _otel prefix
This commit is contained in:
Timo K
2023-03-10 10:33:54 +01:00
parent 0423a494c4
commit 4c59638d00
7 changed files with 490 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ import { usePageUnload } from "./usePageUnload";
import { PosthogAnalytics } from "../analytics/PosthogAnalytics";
import { TranslatedError, translatedError } from "../TranslatedError";
import { ElementWidgetActions, ScreenshareStartData, widget } from "../widget";
import { callTracer } from "../telemetry/otel";
export enum ConnectionState {
EstablishingCall = "establishing call", // call hasn't been established yet
@@ -375,6 +376,7 @@ export function useGroupCall(groupCall: GroupCall): UseGroupCallReturnType {
) {
return;
}
callTracer.startCall(groupCall.groupCallId);
PosthogAnalytics.instance.eventCallEnded.cacheStartCall(new Date());
PosthogAnalytics.instance.eventCallStarted.track(groupCall.groupCallId);
@@ -399,6 +401,7 @@ export function useGroupCall(groupCall: GroupCall): UseGroupCallReturnType {
const setMicrophoneMuted = useCallback(
(setMuted) => {
groupCall.setMicrophoneMuted(setMuted);
callTracer.muteMic(setMuted);
PosthogAnalytics.instance.eventMuteMicrophone.track(
setMuted,
groupCall.groupCallId