@ancplua/qyl-api-schema 0.5.13 → 0.5.15

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/api/routes.tsp CHANGED
@@ -6,6 +6,7 @@ import "../common/errors.tsp";
6
6
  import "../common/pagination.tsp";
7
7
  import "../otel/span.tsp";
8
8
  import "../otel/logs.tsp";
9
+ import "../otel/metrics.tsp";
9
10
  import "../otel/profiles.tsp";
10
11
  import "../models/session.tsp";
11
12
  import "../models/health.tsp";
@@ -19,6 +20,7 @@ using Qyl.Api.Contracts.Common.Errors;
19
20
  using Qyl.Api.Contracts.Common.Pagination;
20
21
  using Qyl.Api.Contracts.OTel.Traces;
21
22
  using Qyl.Api.Contracts.OTel.Logs;
23
+ using Qyl.Api.Contracts.OTel.Metrics;
22
24
  using Qyl.Api.Contracts.OTel.Enums;
23
25
  using Qyl.Api.Contracts.OTel.Profiles;
24
26
  using Qyl.Api.Contracts.Domains.Observe.Session;
@@ -47,23 +49,34 @@ interface TracesApi {
47
49
  @get
48
50
  list(
49
51
  ...ProjectScopeHeader,
50
- @query @minValue(1) @maxValue(1000) limit?: int32 = 100,
52
+
53
+ @query
54
+ @minValue(1)
55
+ @maxValue(1000)
56
+ limit?: int32 = 100,
57
+
51
58
  @query cursor?: string,
52
- ): CursorPage<Trace> | ValidationError | UnauthorizedError | InternalServerError;
59
+ ):
60
+ | CursorPage<Trace>
61
+ | ValidationError
62
+ | UnauthorizedError
63
+ | InternalServerError;
53
64
 
54
65
  @get
55
66
  @route("/{traceId}")
56
- get(
57
- ...ProjectScopeHeader,
58
- @path traceId: TraceId,
59
- ): Trace | NotFoundError | UnauthorizedError | InternalServerError;
67
+ get(...ProjectScopeHeader, @path traceId: TraceId):
68
+ | Trace
69
+ | NotFoundError
70
+ | UnauthorizedError
71
+ | InternalServerError;
60
72
 
61
73
  @get
62
74
  @route("/{traceId}/spans")
63
- getSpans(
64
- ...ProjectScopeHeader,
65
- @path traceId: TraceId,
66
- ): CursorPage<Span> | NotFoundError | UnauthorizedError | InternalServerError;
75
+ getSpans(...ProjectScopeHeader, @path traceId: TraceId):
76
+ | CursorPage<Span>
77
+ | NotFoundError
78
+ | UnauthorizedError
79
+ | InternalServerError;
67
80
  }
68
81
 
69
82
  // -----------------------------------------------------------------------------
@@ -85,8 +98,47 @@ interface LogsApi {
85
98
  @query startTime?: utcDateTime,
86
99
  @query endTime?: utcDateTime,
87
100
  @query query?: string,
88
- @query @minValue(1) @maxValue(10000) limit?: int32 = 100,
89
- ): CursorPage<LogRecord> | ValidationError | UnauthorizedError | InternalServerError;
101
+
102
+ @query
103
+ @minValue(1)
104
+ @maxValue(10000)
105
+ limit?: int32 = 100,
106
+ ):
107
+ | CursorPage<LogRecord>
108
+ | ValidationError
109
+ | UnauthorizedError
110
+ | InternalServerError;
111
+ }
112
+
113
+ // -----------------------------------------------------------------------------
114
+ // Metrics
115
+ // -----------------------------------------------------------------------------
116
+
117
+ @route("/api/v1/metrics")
118
+ @tag("Metrics")
119
+ @useAuth(QylApiKeyHeaderAuth)
120
+ interface MetricsApi {
121
+ @doc("List persisted OTLP metric data points without re-aggregating producer values.")
122
+ @get
123
+ list(
124
+ ...ProjectScopeHeader,
125
+ @query name?: string,
126
+ @query type?: MetricType,
127
+ @query serviceName?: string,
128
+ @query startTime?: utcDateTime,
129
+ @query endTime?: utcDateTime,
130
+
131
+ @query
132
+ @minValue(1)
133
+ @maxValue(1000)
134
+ limit?: int32 = 100,
135
+
136
+ @query cursor?: string,
137
+ ):
138
+ | CursorPage<MetricPoint>
139
+ | ValidationError
140
+ | UnauthorizedError
141
+ | InternalServerError;
90
142
  }
91
143
 
92
144
  // -----------------------------------------------------------------------------
@@ -104,22 +156,31 @@ interface ProfilesApi {
104
156
  @query traceId?: TraceId,
105
157
  @query serviceName?: string,
106
158
  @query sampleType?: string,
107
- @query @minValue(1) @maxValue(1000) limit?: int32 = 100,
159
+
160
+ @query
161
+ @minValue(1)
162
+ @maxValue(1000)
163
+ limit?: int32 = 100,
108
164
  ): Profile[] | ValidationError | UnauthorizedError | InternalServerError;
109
165
 
110
166
  @get
111
167
  @route("/{profileId}")
112
- get(
113
- ...ProjectScopeHeader,
114
- @path profileId: string,
115
- ): Profile | NotFoundError | UnauthorizedError | InternalServerError;
168
+ get(...ProjectScopeHeader, @path profileId: string):
169
+ | Profile
170
+ | NotFoundError
171
+ | UnauthorizedError
172
+ | InternalServerError;
116
173
 
117
174
  @get
118
175
  @route("/by-trace/{traceId}")
119
176
  getByTrace(
120
177
  ...ProjectScopeHeader,
121
178
  @path traceId: TraceId,
122
- @query @minValue(1) @maxValue(1000) limit?: int32 = 100,
179
+
180
+ @query
181
+ @minValue(1)
182
+ @maxValue(1000)
183
+ limit?: int32 = 100,
123
184
  ): Profile[] | ValidationError | UnauthorizedError | InternalServerError;
124
185
 
125
186
  @get
@@ -127,7 +188,11 @@ interface ProfilesApi {
127
188
  getBySpan(
128
189
  ...ProjectScopeHeader,
129
190
  @path spanId: SpanId,
130
- @query @minValue(1) @maxValue(1000) limit?: int32 = 100,
191
+
192
+ @query
193
+ @minValue(1)
194
+ @maxValue(1000)
195
+ limit?: int32 = 100,
131
196
  ): Profile[] | ValidationError | UnauthorizedError | InternalServerError;
132
197
  }
133
198
 
@@ -145,23 +210,34 @@ interface SessionsApi {
145
210
  @query isActive?: boolean,
146
211
  @query startTime?: utcDateTime,
147
212
  @query endTime?: utcDateTime,
148
- @query @minValue(1) @maxValue(1000) limit?: int32 = 100,
213
+
214
+ @query
215
+ @minValue(1)
216
+ @maxValue(1000)
217
+ limit?: int32 = 100,
218
+
149
219
  @query cursor?: string,
150
- ): CursorPage<SessionEntity> | ValidationError | UnauthorizedError | InternalServerError;
220
+ ):
221
+ | CursorPage<SessionEntity>
222
+ | ValidationError
223
+ | UnauthorizedError
224
+ | InternalServerError;
151
225
 
152
226
  @get
153
227
  @route("/{sessionId}")
154
- get(
155
- ...ProjectScopeHeader,
156
- @path sessionId: SessionId,
157
- ): SessionEntity | NotFoundError | UnauthorizedError | InternalServerError;
228
+ get(...ProjectScopeHeader, @path sessionId: SessionId):
229
+ | SessionEntity
230
+ | NotFoundError
231
+ | UnauthorizedError
232
+ | InternalServerError;
158
233
 
159
234
  @get
160
235
  @route("/{sessionId}/traces")
161
- getTraces(
162
- ...ProjectScopeHeader,
163
- @path sessionId: SessionId,
164
- ): CursorPage<Trace> | NotFoundError | UnauthorizedError | InternalServerError;
236
+ getTraces(...ProjectScopeHeader, @path sessionId: SessionId):
237
+ | CursorPage<Trace>
238
+ | NotFoundError
239
+ | UnauthorizedError
240
+ | InternalServerError;
165
241
 
166
242
  @get
167
243
  @route("/stats")
@@ -183,19 +259,44 @@ interface GenAiEtlAuditApi {
183
259
  @get
184
260
  report(
185
261
  ...ProjectScopeHeader,
186
- @query startTime?: utcDateTime,
187
- @query endTime?: utcDateTime,
188
- @query @minValue(1) @maxValue(100) limit?: int32 = 25,
189
- ): GenAiEtlAuditReport | ValidationError | UnauthorizedError | InternalServerError;
262
+
263
+ @doc("Optional audit-period start. Omitted dates select the previous 30 completed UTC days; an explicit range may not exceed 180 days.")
264
+ @query
265
+ startTime?: utcDateTime,
266
+
267
+ @doc("Optional audit-period end. Omitted dates select the previous 30 completed UTC days; an explicit range may not exceed 180 days.")
268
+ @query
269
+ endTime?: utcDateTime,
270
+
271
+ @query
272
+ @minValue(1)
273
+ @maxValue(100)
274
+ limit?: int32 = 25,
275
+ ):
276
+ | GenAiEtlAuditReport
277
+ | ValidationError
278
+ | UnauthorizedError
279
+ | InternalServerError;
190
280
 
191
281
  @post
192
282
  @route("/evaluate")
193
283
  evaluate(
194
284
  ...ProjectScopeHeader,
195
- @query startTime?: utcDateTime,
196
- @query endTime?: utcDateTime,
285
+
286
+ @doc("Optional audit-period start. Omitted dates select the previous 30 completed UTC days; an explicit range may not exceed 180 days.")
287
+ @query
288
+ startTime?: utcDateTime,
289
+
290
+ @doc("Optional audit-period end. Omitted dates select the previous 30 completed UTC days; an explicit range may not exceed 180 days.")
291
+ @query
292
+ endTime?: utcDateTime,
293
+
197
294
  @body request: GenAiEtlAuditEvaluationRequest,
198
- ): GenAiEtlAuditEvaluationResponse | ValidationError | UnauthorizedError | InternalServerError;
295
+ ):
296
+ | GenAiEtlAuditEvaluationResponse
297
+ | ValidationError
298
+ | UnauthorizedError
299
+ | InternalServerError;
199
300
  }
200
301
 
201
302
  // -----------------------------------------------------------------------------
@@ -207,22 +308,26 @@ interface HealthApi {
207
308
  @get
208
309
  @route("/alive")
209
310
  @operationId("health_alive")
210
- alive(): {
211
- @statusCode statusCode: 200;
212
- @body body: HealthReport;
213
- } | {
214
- @statusCode statusCode: 503;
215
- @body body: HealthReport;
216
- };
311
+ alive():
312
+ | {
313
+ @statusCode statusCode: 200;
314
+ @body body: HealthReport;
315
+ }
316
+ | {
317
+ @statusCode statusCode: 503;
318
+ @body body: HealthReport;
319
+ };
217
320
 
218
321
  @get
219
322
  @route("/health")
220
323
  @operationId("health_ready")
221
- ready(): {
222
- @statusCode statusCode: 200;
223
- @body body: HealthReport;
224
- } | {
225
- @statusCode statusCode: 503;
226
- @body body: HealthReport;
227
- };
324
+ ready():
325
+ | {
326
+ @statusCode statusCode: 200;
327
+ @body body: HealthReport;
328
+ }
329
+ | {
330
+ @statusCode statusCode: 503;
331
+ @body body: HealthReport;
332
+ };
228
333
  }