Skip to content

Commit d5a32be

Browse files
committed
strip crumbs
1 parent e4ae511 commit d5a32be

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

apps/webapp/app/v3/otlpExporter.server.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import type {
3838
import { startSpan } from "./tracing.server";
3939
import { enrichCreatableEvents } from "./utils/enrichCreatableEvents.server";
4040
import "./llmPricingRegistry.server"; // Initialize LLM pricing registry on startup
41-
import { trail } from "agentcrumbs"; // @crumbs
42-
const crumbOtlp = trail("webapp:otlp-exporter"); // @crumbs
4341
import { env } from "~/env.server";
4442
import { detectBadJsonStrings } from "~/utils/detectBadJsonStrings";
4543
import { singleton } from "~/utils/singleton";
@@ -396,22 +394,6 @@ function convertSpansToCreateableEvents(
396394

397395
const runTags = extractArrayAttribute(span.attributes ?? [], SemanticInternalAttributes.RUN_TAGS);
398396

399-
// #region @crumbs
400-
if (span.attributes) {
401-
crumbOtlp("span raw OTEL attrs", {
402-
spanName: span.name,
403-
spanId: binaryToHex(span.spanId),
404-
attrCount: span.attributes.length,
405-
attrs: span.attributes.map((a) => ({
406-
key: a.key,
407-
type: a.value?.stringValue !== undefined ? "string" : a.value?.intValue !== undefined ? "int" : a.value?.doubleValue !== undefined ? "double" : a.value?.boolValue !== undefined ? "bool" : a.value?.arrayValue ? "array" : a.value?.bytesValue ? "bytes" : "unknown",
408-
...(a.value?.arrayValue ? { arrayLen: a.value.arrayValue.values?.length } : {}),
409-
...(a.value?.stringValue !== undefined ? { strLen: a.value.stringValue.length } : {}),
410-
})),
411-
});
412-
}
413-
// #endregion @crumbs
414-
415397
const properties =
416398
truncateAttributes(
417399
convertKeyValueItemsToMap(span.attributes ?? [], [], undefined, [

apps/webapp/seed-ai-spans.mts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { trail } from "agentcrumbs"; // @crumbs
2-
const crumb = trail("webapp"); // @crumbs
31
import { prisma } from "./app/db.server";
42
import { createOrganization } from "./app/models/organization.server";
53
import { createProject } from "./app/models/project.server";
@@ -169,22 +167,18 @@ function eventToLlmMetricsRow(event: CreateEventInput): LlmMetricsV1Input {
169167

170168
async function seedAiSpans() {
171169
const seedUserId = randomUserId();
172-
crumb("seed started"); // @crumbs
173170
console.log(`Starting AI span seed (userId: ${seedUserId})...\n`);
174171

175172
// 1. Find user
176-
crumb("finding user"); // @crumbs
177173
const user = await prisma.user.findUnique({
178174
where: { email: "local@trigger.dev" },
179175
});
180176
if (!user) {
181177
console.error("User local@trigger.dev not found. Run `pnpm run db:seed` first.");
182178
process.exit(1);
183179
}
184-
crumb("user found", { userId: user.id }); // @crumbs
185180

186181
// 2. Find or create org
187-
crumb("finding/creating org"); // @crumbs
188182
let org = await prisma.organization.findFirst({
189183
where: { title: ORG_TITLE, members: { some: { userId: user.id } } },
190184
});
@@ -194,10 +188,8 @@ async function seedAiSpans() {
194188
} else {
195189
console.log(`Org exists: ${org.title} (${org.slug})`);
196190
}
197-
crumb("org ready", { orgId: org.id, slug: org.slug }); // @crumbs
198191

199192
// 3. Find or create project
200-
crumb("finding/creating project"); // @crumbs
201193
let project = await prisma.project.findFirst({
202194
where: { name: PROJECT_NAME, organizationId: org.id },
203195
});
@@ -212,21 +204,17 @@ async function seedAiSpans() {
212204
} else {
213205
console.log(`Project exists: ${project.name} (${project.externalRef})`);
214206
}
215-
crumb("project ready", { projectId: project.id, ref: project.externalRef }); // @crumbs
216207

217208
// 4. Get DEVELOPMENT environment
218-
crumb("finding dev environment"); // @crumbs
219209
const runtimeEnv = await prisma.runtimeEnvironment.findFirst({
220210
where: { projectId: project.id, type: "DEVELOPMENT" },
221211
});
222212
if (!runtimeEnv) {
223213
console.error("No DEVELOPMENT environment found for project.");
224214
process.exit(1);
225215
}
226-
crumb("dev env found", { envId: runtimeEnv.id }); // @crumbs
227216

228217
// 5. Upsert background worker
229-
crumb("upserting worker/task/queue"); // @crumbs
230218
const worker = await prisma.backgroundWorker.upsert({
231219
where: {
232220
projectId_runtimeEnvironmentId_version: {
@@ -281,10 +269,7 @@ async function seedAiSpans() {
281269
},
282270
});
283271

284-
crumb("infra upserts done"); // @crumbs
285-
286272
// 8. Create the TaskRun
287-
crumb("creating TaskRun"); // @crumbs
288273
const traceId = generateTraceId();
289274
const rootSpanId = generateSpanId();
290275
const now = Date.now();
@@ -367,11 +352,9 @@ Please structure your response with clear headings, use tables for comparative d
367352
},
368353
});
369354

370-
crumb("TaskRun created", { runId: run.friendlyId, traceId }); // @crumbs
371355
console.log(`Created TaskRun: ${run.friendlyId}`);
372356

373357
// 9. Build span tree
374-
crumb("building span tree"); // @crumbs
375358
const events = buildAiSpanTree({
376359
traceId,
377360
rootSpanId,
@@ -384,22 +367,18 @@ Please structure your response with clear headings, use tables for comparative d
384367
seedUserId,
385368
});
386369

387-
crumb("span tree built", { spanCount: events.length }); // @crumbs
388370
console.log(`Built ${events.length} spans`);
389371

390372
// 10. Seed LLM pricing and enrich
391-
crumb("seeding LLM pricing"); // @crumbs
392373
const seedResult = await seedLlmPricing(prisma);
393374
console.log(
394375
`LLM pricing: ${seedResult.modelsCreated} created, ${seedResult.modelsSkipped} skipped`
395376
);
396377

397-
crumb("loading pricing registry"); // @crumbs
398378
const registry = new ModelPricingRegistry(prisma);
399379
setLlmPricingRegistry(registry);
400380
await registry.loadFromDatabase();
401381

402-
crumb("enriching events"); // @crumbs
403382
const enriched = enrichCreatableEvents(events);
404383

405384
const enrichedCount = enriched.filter((e) => e._llmMetrics != null).length;
@@ -408,10 +387,7 @@ Please structure your response with clear headings, use tables for comparative d
408387
`Enriched ${enrichedCount} spans with LLM cost (total: $${totalCost.toFixed(6)})`
409388
);
410389

411-
crumb("enrichment done", { enrichedCount, totalCost }); // @crumbs
412-
413390
// 11. Insert into ClickHouse
414-
crumb("inserting into ClickHouse"); // @crumbs
415391
const clickhouseUrl = process.env.CLICKHOUSE_URL ?? process.env.EVENTS_CLICKHOUSE_URL;
416392
if (!clickhouseUrl) {
417393
console.error("CLICKHOUSE_URL or EVENTS_CLICKHOUSE_URL not set");
@@ -426,13 +402,10 @@ Please structure your response with clear headings, use tables for comparative d
426402
const chRows = enriched.map(eventToClickhouseRow);
427403
await clickhouse.taskEventsV2.insert(chRows);
428404

429-
crumb("task events inserted", { rowCount: chRows.length }); // @crumbs
430-
431405
// Insert LLM usage rows
432406
const llmRows = enriched.filter((e) => e._llmMetrics != null).map(eventToLlmMetricsRow);
433407
if (llmRows.length > 0) {
434408
await clickhouse.llmMetrics.insert(llmRows);
435-
crumb("llm metrics inserted", { rowCount: llmRows.length }); // @crumbs
436409
}
437410

438411
// 12. Output
@@ -443,7 +416,6 @@ Please structure your response with clear headings, use tables for comparative d
443416
console.log(`Spans: ${events.length}`);
444417
console.log(`LLM cost enriched: ${enrichedCount}`);
445418
console.log(`Total cost: $${totalCost.toFixed(6)}`);
446-
crumb("seed complete"); // @crumbs
447419
process.exit(0);
448420
}
449421

0 commit comments

Comments
 (0)