@rustrak/client 0.14.3 → 0.14.4
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/index.cjs +108 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +108 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -59,8 +59,40 @@ var agentTraceSummarySchema = zod.z.object({
|
|
|
59
59
|
duration_ms: zod.z.number().nullable(),
|
|
60
60
|
total_tokens: zod.z.number(),
|
|
61
61
|
tool_call_count: zod.z.number().int(),
|
|
62
|
+
/** `ai_client` spans: how many times a model was actually called. */
|
|
63
|
+
llm_call_count: zod.z.number().int(),
|
|
64
|
+
/** AI spans in this trace whose status is set and not `ok`. */
|
|
65
|
+
error_count: zod.z.number().int(),
|
|
62
66
|
started_at: dateTimeSchema
|
|
63
67
|
});
|
|
68
|
+
var agentSummarySchema = zod.z.object({
|
|
69
|
+
agent_runs: zod.z.number().int(),
|
|
70
|
+
llm_calls: zod.z.number().int(),
|
|
71
|
+
tool_calls: zod.z.number().int(),
|
|
72
|
+
error_count: zod.z.number().int(),
|
|
73
|
+
total_tokens: zod.z.number(),
|
|
74
|
+
avg_duration_ms: zod.z.number(),
|
|
75
|
+
p95_duration_ms: zod.z.number()
|
|
76
|
+
});
|
|
77
|
+
var agentModelRowSchema = zod.z.object({
|
|
78
|
+
model: zod.z.string(),
|
|
79
|
+
requests: zod.z.number().int(),
|
|
80
|
+
errors: zod.z.number().int(),
|
|
81
|
+
avg_ms: zod.z.number(),
|
|
82
|
+
p95_ms: zod.z.number(),
|
|
83
|
+
input_tokens: zod.z.number(),
|
|
84
|
+
cached_input_tokens: zod.z.number(),
|
|
85
|
+
output_tokens: zod.z.number(),
|
|
86
|
+
reasoning_output_tokens: zod.z.number(),
|
|
87
|
+
total_tokens: zod.z.number()
|
|
88
|
+
});
|
|
89
|
+
var agentToolRowSchema = zod.z.object({
|
|
90
|
+
tool: zod.z.string(),
|
|
91
|
+
calls: zod.z.number().int(),
|
|
92
|
+
errors: zod.z.number().int(),
|
|
93
|
+
avg_ms: zod.z.number(),
|
|
94
|
+
p95_ms: zod.z.number()
|
|
95
|
+
});
|
|
64
96
|
var providerTypeSchema = zod.z.enum(["webhook", "email", "slack"]);
|
|
65
97
|
var alertTypeSchema = zod.z.enum(["new_issue", "regression", "unmute"]);
|
|
66
98
|
var alertStatusSchema = zod.z.enum([
|
|
@@ -598,7 +630,7 @@ var spanSchema = zod.z.object({
|
|
|
598
630
|
exclusive_time_ms: zod.z.number().nullable(),
|
|
599
631
|
is_segment: zod.z.boolean(),
|
|
600
632
|
segment_id: zod.z.string().nullable(),
|
|
601
|
-
/**
|
|
633
|
+
/** Reported by the span itself, or stamped from its parent transaction. Null only for rows ingested before that stamping existed. */
|
|
602
634
|
platform: zod.z.string().nullable(),
|
|
603
635
|
release: zod.z.string().nullable(),
|
|
604
636
|
environment: zod.z.string().nullable(),
|
|
@@ -613,6 +645,11 @@ var spanSchema = zod.z.object({
|
|
|
613
645
|
gen_ai_usage_output_tokens: zod.z.number().nullable(),
|
|
614
646
|
gen_ai_usage_total_tokens: zod.z.number().nullable()
|
|
615
647
|
});
|
|
648
|
+
var spanDetailSchema = spanSchema.extend({
|
|
649
|
+
attributes: zod.z.record(zod.z.string(), zod.z.any()),
|
|
650
|
+
/** Always absent for a Spans Protocol v2 span: v2 has no tags concept. */
|
|
651
|
+
tags: zod.z.record(zod.z.string(), zod.z.any()).nullish()
|
|
652
|
+
});
|
|
616
653
|
var transactionStatsSchema = zod.z.object({
|
|
617
654
|
transaction_name: zod.z.string(),
|
|
618
655
|
op: zod.z.string().nullable(),
|
|
@@ -1005,6 +1042,9 @@ function timeseriesSearchParams(options) {
|
|
|
1005
1042
|
if (options?.interval_hours) {
|
|
1006
1043
|
searchParams.interval_hours = String(options.interval_hours);
|
|
1007
1044
|
}
|
|
1045
|
+
if (options?.environment) {
|
|
1046
|
+
searchParams.environment = options.environment;
|
|
1047
|
+
}
|
|
1008
1048
|
return searchParams;
|
|
1009
1049
|
}
|
|
1010
1050
|
function breakdownSearchParams(options) {
|
|
@@ -1015,6 +1055,9 @@ function breakdownSearchParams(options) {
|
|
|
1015
1055
|
if (options?.limit) {
|
|
1016
1056
|
searchParams.limit = String(options.limit);
|
|
1017
1057
|
}
|
|
1058
|
+
if (options?.environment) {
|
|
1059
|
+
searchParams.environment = options.environment;
|
|
1060
|
+
}
|
|
1018
1061
|
return searchParams;
|
|
1019
1062
|
}
|
|
1020
1063
|
var AgentsResource = class extends BaseResource {
|
|
@@ -1085,6 +1128,12 @@ var AgentsResource = class extends BaseResource {
|
|
|
1085
1128
|
if (options?.per_page) {
|
|
1086
1129
|
searchParams.per_page = String(options.per_page);
|
|
1087
1130
|
}
|
|
1131
|
+
if (options?.period_hours) {
|
|
1132
|
+
searchParams.period_hours = String(options.period_hours);
|
|
1133
|
+
}
|
|
1134
|
+
if (options?.environment) {
|
|
1135
|
+
searchParams.environment = options.environment;
|
|
1136
|
+
}
|
|
1088
1137
|
return this.request(
|
|
1089
1138
|
() => this.http.get(`api/projects/${projectId}/agents/traces`, {
|
|
1090
1139
|
searchParams
|
|
@@ -1092,6 +1141,50 @@ var AgentsResource = class extends BaseResource {
|
|
|
1092
1141
|
offsetPaginatedResponseSchema(agentTraceSummarySchema)
|
|
1093
1142
|
);
|
|
1094
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Headline totals over the selected window — the numbers the charts show
|
|
1146
|
+
* the shape of but cannot state.
|
|
1147
|
+
*/
|
|
1148
|
+
async getSummary(projectId, options) {
|
|
1149
|
+
return this.request(
|
|
1150
|
+
() => this.http.get(`api/projects/${projectId}/agents/summary`, {
|
|
1151
|
+
searchParams: breakdownSearchParams(options)
|
|
1152
|
+
}),
|
|
1153
|
+
agentSummarySchema
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Per-model table: volume, failures, latency and the full token split.
|
|
1158
|
+
*/
|
|
1159
|
+
async getModelsTable(projectId, options) {
|
|
1160
|
+
return this.request(
|
|
1161
|
+
() => this.http.get(`api/projects/${projectId}/agents/models`, {
|
|
1162
|
+
searchParams: breakdownSearchParams(options)
|
|
1163
|
+
}),
|
|
1164
|
+
zod.z.array(agentModelRowSchema)
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Per-tool table: call volume, failures and latency.
|
|
1169
|
+
*/
|
|
1170
|
+
async getToolsTable(projectId, options) {
|
|
1171
|
+
return this.request(
|
|
1172
|
+
() => this.http.get(`api/projects/${projectId}/agents/tools/stats`, {
|
|
1173
|
+
searchParams: breakdownSearchParams(options)
|
|
1174
|
+
}),
|
|
1175
|
+
zod.z.array(agentToolRowSchema)
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Environments present in this project's AI spans — the options the filter
|
|
1180
|
+
* offers, read from the data rather than hardcoded.
|
|
1181
|
+
*/
|
|
1182
|
+
async getEnvironments(projectId) {
|
|
1183
|
+
return this.request(
|
|
1184
|
+
() => this.http.get(`api/projects/${projectId}/agents/environments`),
|
|
1185
|
+
zod.z.array(zod.z.string())
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1095
1188
|
};
|
|
1096
1189
|
var AlertIntegrationsResource = class extends BaseResource {
|
|
1097
1190
|
/**
|
|
@@ -2024,6 +2117,20 @@ var SpansResource = class extends BaseResource {
|
|
|
2024
2117
|
offsetPaginatedResponseSchema(spanSchema)
|
|
2025
2118
|
);
|
|
2026
2119
|
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Fetch one span together with its raw attribute bag — the `gen_ai.*`
|
|
2122
|
+
* payload (prompts, responses, tool arguments and results) that `list()`
|
|
2123
|
+
* omits so a trace's worth of spans stays cheap to load.
|
|
2124
|
+
*
|
|
2125
|
+
* `spanId` is the row id from a list item's `id`, not the SDK's 16-hex
|
|
2126
|
+
* `span_id`.
|
|
2127
|
+
*/
|
|
2128
|
+
async get(projectId, spanId) {
|
|
2129
|
+
return this.request(
|
|
2130
|
+
() => this.http.get(`api/projects/${projectId}/spans/${spanId}`),
|
|
2131
|
+
spanDetailSchema
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2027
2134
|
};
|
|
2028
2135
|
|
|
2029
2136
|
// src/resources/stats.ts
|