Group events by project ID

This commit is contained in:
Konstantin Wohlwend 2024-08-15 11:50:48 -07:00
parent 757dea48c0
commit a7c2f2b3a0
2 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,9 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint",
"streetsidesoftware.code-spell-checker"
"streetsidesoftware.code-spell-checker",
"YoavBls.pretty-ts-errors",
"mxsdev.typescript-explorer"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

View File

@ -6,6 +6,7 @@ import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors"
import { prismaClient } from "@/prisma-client";
import withPostHog from "@/analytics";
import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids";
import { filterUndefined } from "@stackframe/stack-shared/dist/utils/objects";
type EventType = {
id: string,
@ -145,6 +146,9 @@ export async function logEvent<T extends EventType[]>(
posthog.capture({
event: postHogEventName,
distinctId,
groups: filterUndefined({
projectId: typeof data === "object" && data && "projectId" in data ? (data.projectId as string) : undefined,
}),
timestamp: timeRange.end,
properties: {
data,