convex-tracer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/helpers.d.ts.map +1 -1
- package/dist/client/helpers.js +9 -0
- package/dist/client/helpers.js.map +1 -1
- package/dist/client/index.d.ts +24 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +18 -1
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +55 -10
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/lib.d.ts +38 -5
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +60 -21
- package/dist/component/lib.js.map +1 -1
- package/dist/component/schema.d.ts +11 -4
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +6 -1
- package/dist/component/schema.js.map +1 -1
- package/dist/component/types.d.ts +71 -13
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component/types.js +2 -0
- package/dist/component/types.js.map +1 -1
- package/package.json +1 -1
- package/src/client/helpers.ts +11 -1
- package/src/client/index.ts +42 -9
- package/src/component/_generated/component.ts +61 -10
- package/src/component/lib.ts +72 -28
- package/src/component/schema.ts +6 -1
- package/src/component/types.ts +4 -0
|
@@ -5,6 +5,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
5
5
|
traces: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
6
6
|
metadata?: Record<string, any> | undefined;
|
|
7
7
|
userId?: string | undefined;
|
|
8
|
+
functionName?: string | undefined;
|
|
8
9
|
preserve?: boolean | undefined;
|
|
9
10
|
status: "error" | "success" | "pending";
|
|
10
11
|
sampleRate: number;
|
|
@@ -15,20 +16,26 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
15
16
|
preserve: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
16
17
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
17
18
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
19
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
18
20
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
19
|
-
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "preserve" | "updatedAt" | `metadata.${string}`>, {
|
|
21
|
+
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "functionName" | "preserve" | "updatedAt" | `metadata.${string}`>, {
|
|
20
22
|
by_status: ["status", "_creationTime"];
|
|
21
23
|
by_userId: ["userId", "_creationTime"];
|
|
22
24
|
by_status_and_userId: ["status", "userId", "_creationTime"];
|
|
23
|
-
}, {
|
|
25
|
+
}, {
|
|
26
|
+
by_function_name: {
|
|
27
|
+
searchField: "functionName";
|
|
28
|
+
filterFields: "status" | "userId";
|
|
29
|
+
};
|
|
30
|
+
}, {}>;
|
|
24
31
|
spans: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
25
32
|
error?: string | undefined;
|
|
26
33
|
duration?: number | undefined;
|
|
27
34
|
endTime?: number | undefined;
|
|
28
35
|
result?: any;
|
|
29
36
|
metadata?: Record<string, any> | undefined;
|
|
30
|
-
parentSpanId?: import("convex/values").GenericId<"spans"> | undefined;
|
|
31
37
|
functionName?: string | undefined;
|
|
38
|
+
parentSpanId?: import("convex/values").GenericId<"spans"> | undefined;
|
|
32
39
|
args?: any;
|
|
33
40
|
traceId: import("convex/values").GenericId<"traces">;
|
|
34
41
|
status: "error" | "success" | "pending";
|
|
@@ -49,7 +56,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
49
56
|
result: import("convex/values").VAny<any, "optional", string>;
|
|
50
57
|
error: import("convex/values").VString<string | undefined, "optional">;
|
|
51
58
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
52
|
-
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | `metadata.${string}` | "parentSpanId" | "spanName" | "startTime" | "
|
|
59
|
+
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | "functionName" | `metadata.${string}` | "parentSpanId" | "spanName" | "startTime" | "args" | `result.${string}` | `args.${string}`>, {
|
|
53
60
|
by_traceId: ["traceId", "_creationTime"];
|
|
54
61
|
by_parentSpanId: ["parentSpanId", "_creationTime"];
|
|
55
62
|
by_status: ["status", "_creationTime"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,+PAI3B,CAAC;AAEF,eAAO,MAAM,eAAe,gMAG3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,mPAI7B,CAAC
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,+PAI3B,CAAC;AAEF,eAAO,MAAM,eAAe,gMAG3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,mPAI7B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,wBA8CG"}
|
package/dist/component/schema.js
CHANGED
|
@@ -10,11 +10,16 @@ export default defineSchema({
|
|
|
10
10
|
preserve: v.optional(v.boolean()),
|
|
11
11
|
updatedAt: v.number(),
|
|
12
12
|
metadata: v.optional(v.record(v.string(), v.any())),
|
|
13
|
+
functionName: v.optional(v.string()),
|
|
13
14
|
userId: v.optional(v.string()),
|
|
14
15
|
})
|
|
15
16
|
.index("by_status", ["status"])
|
|
16
17
|
.index("by_userId", ["userId"])
|
|
17
|
-
.index("by_status_and_userId", ["status", "userId"])
|
|
18
|
+
.index("by_status_and_userId", ["status", "userId"])
|
|
19
|
+
.searchIndex("by_function_name", {
|
|
20
|
+
searchField: "functionName",
|
|
21
|
+
filterFields: ["status", "userId"],
|
|
22
|
+
}),
|
|
18
23
|
spans: defineTable({
|
|
19
24
|
traceId: v.id("traces"),
|
|
20
25
|
parentSpanId: v.optional(v.id("spans")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CACpC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CACpC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACtC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CACnB,CAAC;AAEF,eAAe,YAAY,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,eAAe;QACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EA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,CAAC;QACzB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QAC3B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;KACpD,CAAC;SACC,KAAK,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC;SAChC,KAAK,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,CAAC;SAC1C,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEjC,IAAI,EAAE,WAAW,CAAC;QAChB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC;QACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,iBAAiB;QAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;KACpD,CAAC;SACC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;SAC9B,KAAK,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC;CACtC,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { type Infer } from "convex/values";
|
|
|
2
2
|
export declare const vTrace: import("convex/values").VObject<{
|
|
3
3
|
metadata?: Record<string, any> | undefined;
|
|
4
4
|
userId?: string | undefined;
|
|
5
|
+
functionName?: string | undefined;
|
|
5
6
|
preserve?: boolean | undefined;
|
|
6
7
|
status: "error" | "success" | "pending";
|
|
7
8
|
sampleRate: number;
|
|
@@ -14,10 +15,64 @@ export declare const vTrace: import("convex/values").VObject<{
|
|
|
14
15
|
preserve: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
15
16
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
16
17
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
18
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
17
19
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
18
20
|
_id: import("convex/values").VString<string, "required">;
|
|
19
21
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
20
|
-
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "preserve" | "updatedAt" | `metadata.${string}` | "_creationTime" | "_id">;
|
|
22
|
+
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "functionName" | "preserve" | "updatedAt" | `metadata.${string}` | "_creationTime" | "_id">;
|
|
23
|
+
export declare const vPaginatedTraces: import("convex/values").VObject<{
|
|
24
|
+
splitCursor?: string | null;
|
|
25
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
26
|
+
page: {
|
|
27
|
+
metadata?: Record<string, any> | undefined;
|
|
28
|
+
userId?: string | undefined;
|
|
29
|
+
functionName?: string | undefined;
|
|
30
|
+
preserve?: boolean | undefined;
|
|
31
|
+
status: "error" | "success" | "pending";
|
|
32
|
+
sampleRate: number;
|
|
33
|
+
updatedAt: number;
|
|
34
|
+
_creationTime: number;
|
|
35
|
+
_id: string;
|
|
36
|
+
}[];
|
|
37
|
+
continueCursor: string;
|
|
38
|
+
isDone: boolean;
|
|
39
|
+
}, {
|
|
40
|
+
page: import("convex/values").VArray<{
|
|
41
|
+
metadata?: Record<string, any> | undefined;
|
|
42
|
+
userId?: string | undefined;
|
|
43
|
+
functionName?: string | undefined;
|
|
44
|
+
preserve?: boolean | undefined;
|
|
45
|
+
status: "error" | "success" | "pending";
|
|
46
|
+
sampleRate: number;
|
|
47
|
+
updatedAt: number;
|
|
48
|
+
_creationTime: number;
|
|
49
|
+
_id: string;
|
|
50
|
+
}[], import("convex/values").VObject<{
|
|
51
|
+
metadata?: Record<string, any> | undefined;
|
|
52
|
+
userId?: string | undefined;
|
|
53
|
+
functionName?: string | undefined;
|
|
54
|
+
preserve?: boolean | undefined;
|
|
55
|
+
status: "error" | "success" | "pending";
|
|
56
|
+
sampleRate: number;
|
|
57
|
+
updatedAt: number;
|
|
58
|
+
_creationTime: number;
|
|
59
|
+
_id: string;
|
|
60
|
+
}, {
|
|
61
|
+
status: import("convex/values").VUnion<"error" | "success" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"error", "required">], "required", never>;
|
|
62
|
+
sampleRate: import("convex/values").VFloat64<number, "required">;
|
|
63
|
+
preserve: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
64
|
+
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
65
|
+
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
66
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
67
|
+
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
68
|
+
_id: import("convex/values").VString<string, "required">;
|
|
69
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
70
|
+
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "functionName" | "preserve" | "updatedAt" | `metadata.${string}` | "_creationTime" | "_id">, "required">;
|
|
71
|
+
continueCursor: import("convex/values").VString<string, "required">;
|
|
72
|
+
isDone: import("convex/values").VBoolean<boolean, "required">;
|
|
73
|
+
splitCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
74
|
+
pageStatus: import("convex/values").VUnion<"SplitRecommended" | "SplitRequired" | null | undefined, [import("convex/values").VLiteral<"SplitRecommended", "required">, import("convex/values").VLiteral<"SplitRequired", "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
75
|
+
}, "required", "page" | "continueCursor" | "isDone" | "splitCursor" | "pageStatus">;
|
|
21
76
|
export declare const vSpan: import("convex/values").VObject<{
|
|
22
77
|
error?: string | undefined;
|
|
23
78
|
duration?: number | undefined;
|
|
@@ -26,9 +81,9 @@ export declare const vSpan: import("convex/values").VObject<{
|
|
|
26
81
|
status: "error" | "success" | "pending";
|
|
27
82
|
metadata?: Record<string, any> | undefined;
|
|
28
83
|
source: "frontend" | "backend";
|
|
84
|
+
functionName?: string | undefined;
|
|
29
85
|
spanName: string;
|
|
30
86
|
startTime: number;
|
|
31
|
-
functionName?: string | undefined;
|
|
32
87
|
args?: any;
|
|
33
88
|
parentSpanId?: string | undefined;
|
|
34
89
|
traceId: string;
|
|
@@ -42,15 +97,15 @@ export declare const vSpan: import("convex/values").VObject<{
|
|
|
42
97
|
status: import("convex/values").VUnion<"error" | "success" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"error", "required">], "required", never>;
|
|
43
98
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
44
99
|
source: import("convex/values").VUnion<"frontend" | "backend", [import("convex/values").VLiteral<"frontend", "required">, import("convex/values").VLiteral<"backend", "required">], "required", never>;
|
|
100
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
45
101
|
spanName: import("convex/values").VString<string, "required">;
|
|
46
102
|
startTime: import("convex/values").VFloat64<number, "required">;
|
|
47
|
-
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
48
103
|
args: import("convex/values").VAny<any, "optional", string>;
|
|
49
104
|
_id: import("convex/values").VString<string, "required">;
|
|
50
105
|
traceId: import("convex/values").VString<string, "required">;
|
|
51
106
|
parentSpanId: import("convex/values").VString<string | undefined, "optional">;
|
|
52
107
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
53
|
-
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "
|
|
108
|
+
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | "functionName" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "args" | `result.${string}` | `args.${string}` | "_id">;
|
|
54
109
|
export declare const vLog: import("convex/values").VObject<{
|
|
55
110
|
metadata?: Record<string, any> | undefined;
|
|
56
111
|
severity: "info" | "warn" | "error";
|
|
@@ -76,9 +131,9 @@ export declare const vSpanWithLogs: import("convex/values").VObject<{
|
|
|
76
131
|
status: "error" | "success" | "pending";
|
|
77
132
|
metadata?: Record<string, any> | undefined;
|
|
78
133
|
source: "frontend" | "backend";
|
|
134
|
+
functionName?: string | undefined;
|
|
79
135
|
spanName: string;
|
|
80
136
|
startTime: number;
|
|
81
|
-
functionName?: string | undefined;
|
|
82
137
|
args?: any;
|
|
83
138
|
parentSpanId?: string | undefined;
|
|
84
139
|
traceId: string;
|
|
@@ -102,9 +157,9 @@ export declare const vSpanWithLogs: import("convex/values").VObject<{
|
|
|
102
157
|
status: import("convex/values").VUnion<"error" | "success" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"error", "required">], "required", never>;
|
|
103
158
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
104
159
|
source: import("convex/values").VUnion<"frontend" | "backend", [import("convex/values").VLiteral<"frontend", "required">, import("convex/values").VLiteral<"backend", "required">], "required", never>;
|
|
160
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
105
161
|
spanName: import("convex/values").VString<string, "required">;
|
|
106
162
|
startTime: import("convex/values").VFloat64<number, "required">;
|
|
107
|
-
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
108
163
|
args: import("convex/values").VAny<any, "optional", string>;
|
|
109
164
|
_id: import("convex/values").VString<string, "required">;
|
|
110
165
|
traceId: import("convex/values").VString<string, "required">;
|
|
@@ -136,10 +191,11 @@ export declare const vSpanWithLogs: import("convex/values").VObject<{
|
|
|
136
191
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
137
192
|
}, "required", "spanId" | "metadata" | `metadata.${string}` | "_creationTime" | "severity" | "timestamp" | "message" | "_id">, "optional">;
|
|
138
193
|
children: import("convex/values").VArray<any[] | undefined, import("convex/values").VAny<any, "required", string>, "optional">;
|
|
139
|
-
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "
|
|
194
|
+
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | "functionName" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "args" | `result.${string}` | `args.${string}` | "logs" | "_id" | "children">;
|
|
140
195
|
export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
141
196
|
metadata?: Record<string, any> | undefined;
|
|
142
197
|
userId?: string | undefined;
|
|
198
|
+
functionName?: string | undefined;
|
|
143
199
|
preserve?: boolean | undefined;
|
|
144
200
|
status: "error" | "success" | "pending";
|
|
145
201
|
sampleRate: number;
|
|
@@ -154,9 +210,9 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
154
210
|
status: "error" | "success" | "pending";
|
|
155
211
|
metadata?: Record<string, any> | undefined;
|
|
156
212
|
source: "frontend" | "backend";
|
|
213
|
+
functionName?: string | undefined;
|
|
157
214
|
spanName: string;
|
|
158
215
|
startTime: number;
|
|
159
|
-
functionName?: string | undefined;
|
|
160
216
|
args?: any;
|
|
161
217
|
parentSpanId?: string | undefined;
|
|
162
218
|
traceId: string;
|
|
@@ -179,6 +235,7 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
179
235
|
preserve: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
180
236
|
updatedAt: import("convex/values").VFloat64<number, "required">;
|
|
181
237
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
238
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
182
239
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
183
240
|
_id: import("convex/values").VString<string, "required">;
|
|
184
241
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
@@ -190,9 +247,9 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
190
247
|
status: "error" | "success" | "pending";
|
|
191
248
|
metadata?: Record<string, any> | undefined;
|
|
192
249
|
source: "frontend" | "backend";
|
|
250
|
+
functionName?: string | undefined;
|
|
193
251
|
spanName: string;
|
|
194
252
|
startTime: number;
|
|
195
|
-
functionName?: string | undefined;
|
|
196
253
|
args?: any;
|
|
197
254
|
parentSpanId?: string | undefined;
|
|
198
255
|
traceId: string;
|
|
@@ -216,9 +273,9 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
216
273
|
status: "error" | "success" | "pending";
|
|
217
274
|
metadata?: Record<string, any> | undefined;
|
|
218
275
|
source: "frontend" | "backend";
|
|
276
|
+
functionName?: string | undefined;
|
|
219
277
|
spanName: string;
|
|
220
278
|
startTime: number;
|
|
221
|
-
functionName?: string | undefined;
|
|
222
279
|
args?: any;
|
|
223
280
|
parentSpanId?: string | undefined;
|
|
224
281
|
traceId: string;
|
|
@@ -242,9 +299,9 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
242
299
|
status: import("convex/values").VUnion<"error" | "success" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"success", "required">, import("convex/values").VLiteral<"error", "required">], "required", never>;
|
|
243
300
|
metadata: import("convex/values").VRecord<Record<string, any> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "optional", string>;
|
|
244
301
|
source: import("convex/values").VUnion<"frontend" | "backend", [import("convex/values").VLiteral<"frontend", "required">, import("convex/values").VLiteral<"backend", "required">], "required", never>;
|
|
302
|
+
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
245
303
|
spanName: import("convex/values").VString<string, "required">;
|
|
246
304
|
startTime: import("convex/values").VFloat64<number, "required">;
|
|
247
|
-
functionName: import("convex/values").VString<string | undefined, "optional">;
|
|
248
305
|
args: import("convex/values").VAny<any, "optional", string>;
|
|
249
306
|
_id: import("convex/values").VString<string, "required">;
|
|
250
307
|
traceId: import("convex/values").VString<string, "required">;
|
|
@@ -276,11 +333,12 @@ export declare const vCompleteTrace: import("convex/values").VObject<{
|
|
|
276
333
|
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
277
334
|
}, "required", "spanId" | "metadata" | `metadata.${string}` | "_creationTime" | "severity" | "timestamp" | "message" | "_id">, "optional">;
|
|
278
335
|
children: import("convex/values").VArray<any[] | undefined, import("convex/values").VAny<any, "required", string>, "optional">;
|
|
279
|
-
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "
|
|
280
|
-
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "preserve" | "updatedAt" | `metadata.${string}` | "_creationTime" | "spans" | "_id">;
|
|
336
|
+
}, "required", "error" | "traceId" | "duration" | "endTime" | "result" | "status" | "metadata" | "source" | "functionName" | `metadata.${string}` | "_creationTime" | "parentSpanId" | "spanName" | "startTime" | "args" | `result.${string}` | `args.${string}` | "logs" | "_id" | "children">, "required">;
|
|
337
|
+
}, "required", "status" | "metadata" | "sampleRate" | "userId" | "functionName" | "preserve" | "updatedAt" | `metadata.${string}` | "_creationTime" | "spans" | "_id">;
|
|
281
338
|
export type Trace = Infer<typeof vTrace>;
|
|
282
339
|
export type Span = Infer<typeof vSpan>;
|
|
283
340
|
export type Log = Infer<typeof vLog>;
|
|
284
341
|
export type SpanWithLogs = Infer<typeof vSpanWithLogs>;
|
|
285
342
|
export type CompleteTrace = Infer<typeof vCompleteTrace>;
|
|
343
|
+
export type paginatedTraces = Infer<typeof vPaginatedTraces>;
|
|
286
344
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/component/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/component/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAG9C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;4JAGjB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFAAoC,CAAC;AAElE,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yQAQd,CAAC;AAEL,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;6HAIf,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+RAGxB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sKAEzB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AACzC,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AACvC,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACrC,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/component/types.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { paginationResultValidator } from "convex/server";
|
|
1
2
|
import { v } from "convex/values";
|
|
2
3
|
import schema from "./schema";
|
|
3
4
|
export const vTrace = schema.tables.traces.validator.extend({
|
|
4
5
|
_id: v.string(),
|
|
5
6
|
_creationTime: v.number(),
|
|
6
7
|
});
|
|
8
|
+
export const vPaginatedTraces = paginationResultValidator(vTrace);
|
|
7
9
|
export const vSpan = schema.tables.spans.validator
|
|
8
10
|
.omit("parentSpanId")
|
|
9
11
|
.omit("traceId")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/component/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAc,MAAM,eAAe,CAAC;AAC9C,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;IAC1D,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS;KAC/C,IAAI,CAAC,cAAc,CAAC;KACpB,IAAI,CAAC,SAAS,CAAC;KACf,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,YAAY,EAAE,CAA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B,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS;KAC/C,IAAI,CAAC,cAAc,CAAC;KACpB,IAAI,CAAC,SAAS,CAAC;KACf,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IACrE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CAC9B,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/client/helpers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GenericDataModel } from "convex/server";
|
|
1
|
+
import type { Auth, GenericDataModel } from "convex/server";
|
|
2
2
|
import type { ObjectType, PropertyValidators } from "convex/values";
|
|
3
3
|
import type { ComponentApi } from "../component/_generated/component";
|
|
4
4
|
import TracerAPI from "./tracer-api/index";
|
|
@@ -25,6 +25,14 @@ function pick<T extends Record<string, any>, Keys extends (keyof T)[]>(
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
async function getAuthUserId(ctx: { auth: Auth }) {
|
|
29
|
+
const identity = await ctx.auth.getUserIdentity();
|
|
30
|
+
if (identity === null) return "anonymous";
|
|
31
|
+
|
|
32
|
+
const [userId] = identity.subject.split("|");
|
|
33
|
+
return userId;
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
export function extractTraceContext<Args extends Record<string, unknown>>(
|
|
29
37
|
allArgs: ArgsWithTraceContext<Args>,
|
|
30
38
|
): { existingContext?: TraceContext; args: Args } {
|
|
@@ -90,11 +98,13 @@ export async function setupTraceContext(
|
|
|
90
98
|
};
|
|
91
99
|
}
|
|
92
100
|
|
|
101
|
+
const userId = await getAuthUserId(ctx);
|
|
93
102
|
const traceId = await ctx.runMutation(component.lib.createTrace, {
|
|
94
103
|
status: "pending",
|
|
95
104
|
sampleRate,
|
|
96
105
|
metadata: {},
|
|
97
106
|
source: "backend",
|
|
107
|
+
userId,
|
|
98
108
|
});
|
|
99
109
|
|
|
100
110
|
const spanId = await ctx.runMutation(component.lib.createSpan, {
|
package/src/client/index.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
FunctionType,
|
|
3
|
+
GenericQueryCtx,
|
|
4
|
+
paginationOptsValidator,
|
|
5
|
+
} from "convex/server";
|
|
2
6
|
import {
|
|
3
7
|
actionGeneric,
|
|
4
|
-
type GenericActionCtx,
|
|
5
|
-
type GenericDataModel,
|
|
6
|
-
type GenericMutationCtx,
|
|
7
8
|
internalActionGeneric,
|
|
8
9
|
internalMutationGeneric,
|
|
9
10
|
mutationGeneric,
|
|
11
|
+
type GenericActionCtx,
|
|
12
|
+
type GenericDataModel,
|
|
13
|
+
type GenericMutationCtx,
|
|
10
14
|
type RegisteredAction,
|
|
11
15
|
type RegisteredMutation,
|
|
12
16
|
} from "convex/server";
|
|
@@ -14,7 +18,7 @@ import type { Infer, PropertyValidators } from "convex/values";
|
|
|
14
18
|
import { v } from "convex/values";
|
|
15
19
|
import type { ComponentApi } from "../component/_generated/component";
|
|
16
20
|
import { statusValidator } from "../component/schema";
|
|
17
|
-
import type
|
|
21
|
+
import { type CompleteTrace, type paginatedTraces } from "../component/types";
|
|
18
22
|
import type { EmptyObject } from "../react/types";
|
|
19
23
|
import {
|
|
20
24
|
executeTracedHandler,
|
|
@@ -40,6 +44,11 @@ import type {
|
|
|
40
44
|
TracerHandler,
|
|
41
45
|
} from "./types";
|
|
42
46
|
|
|
47
|
+
export {
|
|
48
|
+
severityValidator,
|
|
49
|
+
sourceValidator,
|
|
50
|
+
statusValidator,
|
|
51
|
+
} from "../component/schema";
|
|
43
52
|
export * from "../component/types";
|
|
44
53
|
|
|
45
54
|
const DEFAULT_CONFIG: Required<TracerConfig> = {
|
|
@@ -571,6 +580,9 @@ export class Tracer<DataModel extends GenericDataModel> {
|
|
|
571
580
|
* @param status - The status of the traces to retrieve.
|
|
572
581
|
* @param limit - The maximum number of traces to retrieve.
|
|
573
582
|
* @param userId - The ID of the user to retrieve traces for.
|
|
583
|
+
* @param paginationOpts - Convex pagination options.
|
|
584
|
+
* @returns A pagination result containing the page of results and a
|
|
585
|
+
* cursor to continue paginating.
|
|
574
586
|
* @example
|
|
575
587
|
* ```ts
|
|
576
588
|
* // In a convex function (query, mutation, or action)
|
|
@@ -580,13 +592,34 @@ export class Tracer<DataModel extends GenericDataModel> {
|
|
|
580
592
|
*/
|
|
581
593
|
listTraces: async (
|
|
582
594
|
ctx: GenericFunctionContext<DataModel>,
|
|
583
|
-
args
|
|
595
|
+
args: {
|
|
584
596
|
status?: Infer<typeof statusValidator>;
|
|
585
|
-
limit?: number;
|
|
586
597
|
userId?: string;
|
|
598
|
+
paginationOpts: Infer<typeof paginationOptsValidator>;
|
|
599
|
+
},
|
|
600
|
+
): Promise<paginatedTraces> => {
|
|
601
|
+
return await ctx.runQuery(this.component.lib.listTraces, args);
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Searches for traces by function name.
|
|
606
|
+
* @param functionName - The name of the function to search for.
|
|
607
|
+
* @param userId - The ID of the user to search for.
|
|
608
|
+
* @param status - The status of the traces to search for.
|
|
609
|
+
* @param paginationOpts - Convex pagination options.
|
|
610
|
+
* @returns A pagination result containing the page of results and a
|
|
611
|
+
* cursor to continue paginating.
|
|
612
|
+
*/
|
|
613
|
+
searchTraces: async (
|
|
614
|
+
ctx: GenericFunctionContext<DataModel>,
|
|
615
|
+
args: {
|
|
616
|
+
functionName: string;
|
|
617
|
+
userId?: string;
|
|
618
|
+
status?: Infer<typeof statusValidator>;
|
|
619
|
+
paginationOpts: Infer<typeof paginationOptsValidator>;
|
|
587
620
|
},
|
|
588
|
-
): Promise<
|
|
589
|
-
return await ctx.runQuery(this.component.lib.
|
|
621
|
+
): Promise<paginatedTraces> => {
|
|
622
|
+
return await ctx.runQuery(this.component.lib.searchTraces, args);
|
|
590
623
|
},
|
|
591
624
|
};
|
|
592
625
|
}
|
|
@@ -86,6 +86,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
86
86
|
sampleRate: number;
|
|
87
87
|
source: "frontend" | "backend";
|
|
88
88
|
status: "pending" | "success" | "error";
|
|
89
|
+
userId: "anonymous" | string;
|
|
89
90
|
},
|
|
90
91
|
string,
|
|
91
92
|
Name
|
|
@@ -97,6 +98,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
97
98
|
null | {
|
|
98
99
|
_creationTime: number;
|
|
99
100
|
_id: string;
|
|
101
|
+
functionName?: string;
|
|
100
102
|
metadata?: Record<string, any>;
|
|
101
103
|
preserve?: boolean;
|
|
102
104
|
sampleRate: number;
|
|
@@ -137,20 +139,69 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
|
137
139
|
"query",
|
|
138
140
|
"internal",
|
|
139
141
|
{
|
|
140
|
-
|
|
142
|
+
paginationOpts: {
|
|
143
|
+
cursor: string | null;
|
|
144
|
+
endCursor?: string | null;
|
|
145
|
+
id?: number;
|
|
146
|
+
maximumBytesRead?: number;
|
|
147
|
+
maximumRowsRead?: number;
|
|
148
|
+
numItems: number;
|
|
149
|
+
};
|
|
141
150
|
status?: "pending" | "success" | "error";
|
|
142
151
|
userId?: string;
|
|
143
152
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
{
|
|
154
|
+
continueCursor: string;
|
|
155
|
+
isDone: boolean;
|
|
156
|
+
page: Array<{
|
|
157
|
+
_creationTime: number;
|
|
158
|
+
_id: string;
|
|
159
|
+
functionName?: string;
|
|
160
|
+
metadata?: Record<string, any>;
|
|
161
|
+
preserve?: boolean;
|
|
162
|
+
sampleRate: number;
|
|
163
|
+
status: "pending" | "success" | "error";
|
|
164
|
+
updatedAt: number;
|
|
165
|
+
userId?: string;
|
|
166
|
+
}>;
|
|
167
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
168
|
+
splitCursor?: string | null;
|
|
169
|
+
},
|
|
170
|
+
Name
|
|
171
|
+
>;
|
|
172
|
+
searchTraces: FunctionReference<
|
|
173
|
+
"query",
|
|
174
|
+
"internal",
|
|
175
|
+
{
|
|
176
|
+
functionName: string;
|
|
177
|
+
paginationOpts: {
|
|
178
|
+
cursor: string | null;
|
|
179
|
+
endCursor?: string | null;
|
|
180
|
+
id?: number;
|
|
181
|
+
maximumBytesRead?: number;
|
|
182
|
+
maximumRowsRead?: number;
|
|
183
|
+
numItems: number;
|
|
184
|
+
};
|
|
185
|
+
status?: "pending" | "success" | "error";
|
|
152
186
|
userId?: string;
|
|
153
|
-
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
continueCursor: string;
|
|
190
|
+
isDone: boolean;
|
|
191
|
+
page: Array<{
|
|
192
|
+
_creationTime: number;
|
|
193
|
+
_id: string;
|
|
194
|
+
functionName?: string;
|
|
195
|
+
metadata?: Record<string, any>;
|
|
196
|
+
preserve?: boolean;
|
|
197
|
+
sampleRate: number;
|
|
198
|
+
status: "pending" | "success" | "error";
|
|
199
|
+
updatedAt: number;
|
|
200
|
+
userId?: string;
|
|
201
|
+
}>;
|
|
202
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
203
|
+
splitCursor?: string | null;
|
|
204
|
+
},
|
|
154
205
|
Name
|
|
155
206
|
>;
|
|
156
207
|
updateSpanMetadata: FunctionReference<
|