forked from farhoodlabs/paperclip
Add versioned telemetry events
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { Router } from "express";
|
||||
import type { Db } from "@paperclipai/db";
|
||||
import { createGoalSchema, updateGoalSchema } from "@paperclipai/shared";
|
||||
import { trackGoalCreated } from "@paperclipai/shared/telemetry";
|
||||
import { validate } from "../middleware/validate.js";
|
||||
import { goalService, logActivity } from "../services/index.js";
|
||||
import { assertCompanyAccess, getActorInfo } from "./authz.js";
|
||||
import { getTelemetryClient } from "../telemetry.js";
|
||||
|
||||
export function goalRoutes(db: Db) {
|
||||
const router = Router();
|
||||
@@ -42,6 +44,10 @@ export function goalRoutes(db: Db) {
|
||||
entityId: goal.id,
|
||||
details: { title: goal.title },
|
||||
});
|
||||
const telemetryClient = getTelemetryClient();
|
||||
if (telemetryClient) {
|
||||
trackGoalCreated(telemetryClient, { goalLevel: goal.level });
|
||||
}
|
||||
res.status(201).json(goal);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user