Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

Add projectId to logs (#93)

Marc Klingen8252eeb64ed8
diff --git a/src/pages/api/public/events.ts b/src/pages/api/public/events.ts
index 3b86017788..40ff2f4bf5 100644
--- a/src/pages/api/public/events.ts
+++ b/src/pages/api/public/events.ts
@@ -42,6 +42,13 @@ export default async function handler(
});
// END CHECK AUTH
+ console.log(
+ "trying to create observation for event, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ JSON.stringify(req.body, null, 2)
+ );
+
try {
const obj = ObservationSchema.parse(req.body);
const {
diff --git a/src/pages/api/public/generations.ts b/src/pages/api/public/generations.ts
index 376a21f2f8..3b03ab515b 100644
--- a/src/pages/api/public/generations.ts
+++ b/src/pages/api/public/generations.ts
@@ -87,8 +87,10 @@ export default async function handler(
if (req.method === "POST") {
try {
console.log(
- "trying to create observation for generation" +
- JSON.stringify(req.body, null, 2)
+ "trying to create observation for generation, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ JSON.stringify(req.body, null, 2)
);
const obj = GenerationsCreateSchema.parse(req.body);
const {
@@ -240,8 +242,10 @@ export default async function handler(
}
} else if (req.method === "PATCH") {
console.log(
- "trying to update observation for generation" +
- JSON.stringify(req.body, null, 2)
+ "trying to update observation for generation, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ JSON.stringify(req.body, null, 2)
);
try {
diff --git a/src/pages/api/public/scores.ts b/src/pages/api/public/scores.ts
index 2e99bfe2b1..56c8d6e854 100644
--- a/src/pages/api/public/scores.ts
+++ b/src/pages/api/public/scores.ts
@@ -42,7 +42,12 @@ export default async function handler(
if (req.method === "POST") {
try {
- console.log("trying to create score", req.body);
+ console.log(
+ "trying to create score, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ req.body
+ );
const obj = ScoreCreateSchema.parse(req.body);
diff --git a/src/pages/api/public/spans.ts b/src/pages/api/public/spans.ts
index 56e14d8155..b4cf5fdbf1 100644
--- a/src/pages/api/public/spans.ts
+++ b/src/pages/api/public/spans.ts
@@ -54,7 +54,12 @@ export default async function handler(
if (req.method === "POST") {
try {
- console.log("Trying to generate span: ", req.body);
+ console.log(
+ "Trying to generate span, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ req.body
+ );
const obj = SpanPostSchema.parse(req.body);
const {
id,
@@ -165,7 +170,12 @@ export default async function handler(
}
} else if (req.method === "PATCH") {
try {
- console.log("Trying to update span: ", req.body);
+ console.log(
+ "Trying to update span, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ req.body
+ );
const { spanId, endTime, ...fields } = SpanPatchSchema.parse(req.body);
// Check before upsert as Prisma only upserts in DB transaction when using unique key in select
diff --git a/src/pages/api/public/traces.ts b/src/pages/api/public/traces.ts
index 5d021c90de..5c56b2d9ce 100644
--- a/src/pages/api/public/traces.ts
+++ b/src/pages/api/public/traces.ts
@@ -42,7 +42,12 @@ export default async function handler(
try {
if (req.method === "POST") {
- console.log("Trying to create trace:", req.body);
+ console.log(
+ "Trying to create trace, project ",
+ authCheck.scope.projectId,
+ ", body:",
+ req.body
+ );
const { id, name, metadata, externalId, userId, release, version } =
CreateTraceSchema.parse(req.body);