Skip to content

Commit b481130

Browse files
committed
feat(otel): add prisma operation name to tree view for easier scanning
1 parent fc351cb commit b481130

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

apps/webapp/app/v3/utils/enrichCreatableEvents.server.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { accessoryAttributes, flattenAttributes } from "@trigger.dev/core/v3";
12
import type { CreateEventInput } from "../eventRepository/eventRepository.types";
23

34
export function enrichCreatableEvents(events: CreateEventInput[]) {
@@ -23,6 +24,30 @@ function enrichStyle(event: CreateEventInput) {
2324
return baseStyle;
2425
}
2526

27+
if (event.message === "prisma:client:operation") {
28+
const operationName = props["name"];
29+
30+
if (typeof operationName === "string") {
31+
return {
32+
...baseStyle,
33+
...flattenAttributes(
34+
{
35+
items: [
36+
{
37+
text: operationName,
38+
variant: "normal",
39+
},
40+
],
41+
style: "codepath",
42+
},
43+
"accessory"
44+
),
45+
};
46+
}
47+
48+
return { ...baseStyle };
49+
}
50+
2651
// Direct property access and early returns
2752
// GenAI System check
2853
const system = props["gen_ai.system"];

0 commit comments

Comments
 (0)