@ancplua/qyl-api-schema 0.2.0
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/LICENSE +201 -0
- package/README.md +89 -0
- package/VERSIONING.md +74 -0
- package/api/routes.tsp +1052 -0
- package/api/streaming.tsp +335 -0
- package/common/errors.tsp +206 -0
- package/common/pagination.tsp +254 -0
- package/common/types.tsp +345 -0
- package/generated/README.md +26 -0
- package/generated/otel-keys.gen.tsp +1648 -0
- package/index.tsp +55 -0
- package/intelligence/causal-rules.tsp +34 -0
- package/intelligence/diagnostic-patterns.tsp +54 -0
- package/intelligence/investigation-strategies.tsp +37 -0
- package/intelligence/main.tsp +19 -0
- package/intelligence/seed/patterns.tsp +172 -0
- package/intelligence/seed/rules.tsp +44 -0
- package/intelligence/seed/strategies.tsp +56 -0
- package/intelligence/signals.tsp +60 -0
- package/models/agent/agent-run.tsp +154 -0
- package/models/agent/tool-call.tsp +122 -0
- package/models/agent/workflow-checkpoint.tsp +50 -0
- package/models/agent/workflow-execution.tsp +136 -0
- package/models/alerting.tsp +436 -0
- package/models/configurator.tsp +433 -0
- package/models/control-graph.tsp +197 -0
- package/models/db.tsp +810 -0
- package/models/deployment.tsp +365 -0
- package/models/error.tsp +433 -0
- package/models/genai.tsp +1368 -0
- package/models/http.tsp +600 -0
- package/models/identity.tsp +213 -0
- package/models/issues.tsp +484 -0
- package/models/log.tsp +140 -0
- package/models/messaging.tsp +304 -0
- package/models/otel-config.tsp +455 -0
- package/models/retention.tsp +240 -0
- package/models/rpc.tsp +309 -0
- package/models/search.tsp +243 -0
- package/models/session.tsp +274 -0
- package/models/system.tsp +400 -0
- package/models/test.tsp +346 -0
- package/models/triage.tsp +113 -0
- package/models/workflow.tsp +396 -0
- package/models/workspace.tsp +435 -0
- package/otel/enums.tsp +392 -0
- package/otel/logs.tsp +135 -0
- package/otel/metrics.tsp +358 -0
- package/otel/otel-conventions.tsp +14 -0
- package/otel/profiles.tsp +335 -0
- package/otel/resource.tsp +257 -0
- package/otel/span.tsp +307 -0
- package/package.json +88 -0
- package/tspconfig.yaml +49 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// ANcpLua v2.0 - Configurator & Code Generation Entities
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Generation profiles, selections, jobs, schema promotions.
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
import "@typespec/openapi";
|
|
8
|
+
import "../common/types.tsp";
|
|
9
|
+
|
|
10
|
+
using TypeSpec.OpenAPI;
|
|
11
|
+
using Qyl.Api.Contracts.Common;
|
|
12
|
+
|
|
13
|
+
namespace Qyl.Api.Contracts.Domains.Configurator;
|
|
14
|
+
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Generation Profile
|
|
17
|
+
// =============================================================================
|
|
18
|
+
|
|
19
|
+
@doc("Named instrumentation profile for code generation")
|
|
20
|
+
@extension("x-csharp-type", "GenerationProfileEntity")
|
|
21
|
+
model GenerationProfileEntity {
|
|
22
|
+
@doc("Profile ID")
|
|
23
|
+
@key
|
|
24
|
+
@visibility(Lifecycle.Read)
|
|
25
|
+
id: string;
|
|
26
|
+
|
|
27
|
+
@doc("Owning project")
|
|
28
|
+
@visibility(Lifecycle.Read)
|
|
29
|
+
@encodedName("application/json", "project_id")
|
|
30
|
+
projectId: string;
|
|
31
|
+
|
|
32
|
+
@doc("Profile name")
|
|
33
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
34
|
+
name: string;
|
|
35
|
+
|
|
36
|
+
@doc("Profile description")
|
|
37
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
38
|
+
description?: string;
|
|
39
|
+
|
|
40
|
+
@doc("Target framework (e.g. net10.0)")
|
|
41
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
42
|
+
@encodedName("application/json", "target_framework")
|
|
43
|
+
targetFramework: string;
|
|
44
|
+
|
|
45
|
+
@doc("Target language")
|
|
46
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
47
|
+
@encodedName("application/json", "target_language")
|
|
48
|
+
targetLanguage: string;
|
|
49
|
+
|
|
50
|
+
@doc("Semantic conventions version")
|
|
51
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
52
|
+
@encodedName("application/json", "semconv_version")
|
|
53
|
+
semconvVersion: string;
|
|
54
|
+
|
|
55
|
+
@doc("Enabled features/modules")
|
|
56
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
57
|
+
@encodedName("application/json", "features_json")
|
|
58
|
+
featuresJson: string;
|
|
59
|
+
|
|
60
|
+
@doc("Template customizations")
|
|
61
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
62
|
+
@encodedName("application/json", "template_overrides_json")
|
|
63
|
+
templateOverridesJson?: string;
|
|
64
|
+
|
|
65
|
+
@doc("Whether this is the default profile")
|
|
66
|
+
@visibility(Lifecycle.Read, Lifecycle.Update)
|
|
67
|
+
@encodedName("application/json", "is_default")
|
|
68
|
+
isDefault: boolean;
|
|
69
|
+
|
|
70
|
+
@doc("Creation timestamp")
|
|
71
|
+
@visibility(Lifecycle.Read)
|
|
72
|
+
@encodedName("application/json", "created_at")
|
|
73
|
+
createdAt: utcDateTime;
|
|
74
|
+
|
|
75
|
+
@doc("Last update timestamp")
|
|
76
|
+
@visibility(Lifecycle.Read)
|
|
77
|
+
@encodedName("application/json", "updated_at")
|
|
78
|
+
updatedAt: utcDateTime;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Generation Selection
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
@doc("Selected semconv/feature per workspace for code generation")
|
|
86
|
+
@extension("x-csharp-type", "GenerationSelectionEntity")
|
|
87
|
+
model GenerationSelectionEntity {
|
|
88
|
+
@doc("Selection ID")
|
|
89
|
+
@key
|
|
90
|
+
@visibility(Lifecycle.Read)
|
|
91
|
+
id: string;
|
|
92
|
+
|
|
93
|
+
@doc("Workspace")
|
|
94
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
95
|
+
@encodedName("application/json", "workspace_id")
|
|
96
|
+
workspaceId: string;
|
|
97
|
+
|
|
98
|
+
@doc("Profile")
|
|
99
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
100
|
+
@encodedName("application/json", "profile_id")
|
|
101
|
+
profileId: string;
|
|
102
|
+
|
|
103
|
+
@doc("Selection type (semconv_group, feature, custom_attribute)")
|
|
104
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
105
|
+
@encodedName("application/json", "selection_type")
|
|
106
|
+
selectionType: string;
|
|
107
|
+
|
|
108
|
+
@doc("Selection key (e.g. http, db, genai)")
|
|
109
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
110
|
+
@encodedName("application/json", "selection_key")
|
|
111
|
+
selectionKey: string;
|
|
112
|
+
|
|
113
|
+
@doc("Whether enabled")
|
|
114
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
|
|
117
|
+
@doc("Selection-specific configuration")
|
|
118
|
+
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
|
|
119
|
+
@encodedName("application/json", "config_json")
|
|
120
|
+
configJson?: string;
|
|
121
|
+
|
|
122
|
+
@doc("Creation timestamp")
|
|
123
|
+
@visibility(Lifecycle.Read)
|
|
124
|
+
@encodedName("application/json", "created_at")
|
|
125
|
+
createdAt: utcDateTime;
|
|
126
|
+
|
|
127
|
+
@doc("Last update timestamp")
|
|
128
|
+
@visibility(Lifecycle.Read)
|
|
129
|
+
@encodedName("application/json", "updated_at")
|
|
130
|
+
updatedAt: utcDateTime;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// =============================================================================
|
|
134
|
+
// Generation Job
|
|
135
|
+
// =============================================================================
|
|
136
|
+
|
|
137
|
+
@doc("Code generation job entry")
|
|
138
|
+
@extension("x-csharp-type", "GenerationJobEntity")
|
|
139
|
+
model GenerationJobEntity {
|
|
140
|
+
@doc("Job ID")
|
|
141
|
+
@key
|
|
142
|
+
@visibility(Lifecycle.Read)
|
|
143
|
+
id: string;
|
|
144
|
+
|
|
145
|
+
@doc("Workspace")
|
|
146
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
147
|
+
@encodedName("application/json", "workspace_id")
|
|
148
|
+
workspaceId: string;
|
|
149
|
+
|
|
150
|
+
@doc("Profile")
|
|
151
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
152
|
+
@encodedName("application/json", "profile_id")
|
|
153
|
+
profileId: string;
|
|
154
|
+
|
|
155
|
+
@doc("Job type")
|
|
156
|
+
@visibility(Lifecycle.Read, Lifecycle.Create)
|
|
157
|
+
@encodedName("application/json", "job_type")
|
|
158
|
+
jobType: GenerationJobType;
|
|
159
|
+
|
|
160
|
+
@doc("Job status")
|
|
161
|
+
@visibility(Lifecycle.Read)
|
|
162
|
+
status: JobStatus;
|
|
163
|
+
|
|
164
|
+
@doc("Priority (higher = more urgent)")
|
|
165
|
+
@visibility(Lifecycle.Read)
|
|
166
|
+
priority: int32;
|
|
167
|
+
|
|
168
|
+
@doc("Hash of inputs for dedup")
|
|
169
|
+
@visibility(Lifecycle.Read)
|
|
170
|
+
@encodedName("application/json", "input_hash")
|
|
171
|
+
inputHash?: string;
|
|
172
|
+
|
|
173
|
+
@doc("Local path where output was written")
|
|
174
|
+
@visibility(Lifecycle.Read)
|
|
175
|
+
@encodedName("application/json", "output_path")
|
|
176
|
+
outputPath?: string;
|
|
177
|
+
|
|
178
|
+
@doc("Hash of generated output")
|
|
179
|
+
@visibility(Lifecycle.Read)
|
|
180
|
+
@encodedName("application/json", "output_hash")
|
|
181
|
+
outputHash?: string;
|
|
182
|
+
|
|
183
|
+
@doc("Error message if failed")
|
|
184
|
+
@visibility(Lifecycle.Read)
|
|
185
|
+
@encodedName("application/json", "error_message")
|
|
186
|
+
errorMessage?: string;
|
|
187
|
+
|
|
188
|
+
@doc("Queue timestamp")
|
|
189
|
+
@visibility(Lifecycle.Read)
|
|
190
|
+
@encodedName("application/json", "queued_at")
|
|
191
|
+
queuedAt: utcDateTime;
|
|
192
|
+
|
|
193
|
+
@doc("Start timestamp")
|
|
194
|
+
@visibility(Lifecycle.Read)
|
|
195
|
+
@encodedName("application/json", "started_at")
|
|
196
|
+
startedAt?: utcDateTime;
|
|
197
|
+
|
|
198
|
+
@doc("Completion timestamp")
|
|
199
|
+
@visibility(Lifecycle.Read)
|
|
200
|
+
@encodedName("application/json", "completed_at")
|
|
201
|
+
completedAt?: utcDateTime;
|
|
202
|
+
|
|
203
|
+
@doc("Duration in milliseconds")
|
|
204
|
+
@visibility(Lifecycle.Read)
|
|
205
|
+
@encodedName("application/json", "duration_ms")
|
|
206
|
+
durationMs?: int32;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@doc("Generation job types")
|
|
210
|
+
enum GenerationJobType {
|
|
211
|
+
@doc("Full regeneration")
|
|
212
|
+
full: "full",
|
|
213
|
+
|
|
214
|
+
@doc("Incremental update")
|
|
215
|
+
incremental: "incremental",
|
|
216
|
+
|
|
217
|
+
@doc("Preview/dry-run")
|
|
218
|
+
preview: "preview",
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@doc("Job lifecycle status")
|
|
222
|
+
enum JobStatus {
|
|
223
|
+
@doc("Queued for execution")
|
|
224
|
+
queued: "queued",
|
|
225
|
+
|
|
226
|
+
@doc("Currently executing")
|
|
227
|
+
running: "running",
|
|
228
|
+
|
|
229
|
+
@doc("Successfully completed")
|
|
230
|
+
completed: "completed",
|
|
231
|
+
|
|
232
|
+
@doc("Failed with error")
|
|
233
|
+
failed: "failed",
|
|
234
|
+
|
|
235
|
+
@doc("Cancelled by user")
|
|
236
|
+
cancelled: "cancelled",
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// =============================================================================
|
|
240
|
+
// Generation Job Event
|
|
241
|
+
// =============================================================================
|
|
242
|
+
|
|
243
|
+
@doc("Job lifecycle event")
|
|
244
|
+
@extension("x-csharp-type", "GenerationJobEventEntity")
|
|
245
|
+
model GenerationJobEventEntity {
|
|
246
|
+
@doc("Event ID")
|
|
247
|
+
@key
|
|
248
|
+
id: string;
|
|
249
|
+
|
|
250
|
+
@doc("Parent job")
|
|
251
|
+
@encodedName("application/json", "job_id")
|
|
252
|
+
jobId: string;
|
|
253
|
+
|
|
254
|
+
@doc("Event type")
|
|
255
|
+
@encodedName("application/json", "event_type")
|
|
256
|
+
eventType: string;
|
|
257
|
+
|
|
258
|
+
@doc("Human-readable message")
|
|
259
|
+
message?: string;
|
|
260
|
+
|
|
261
|
+
@doc("Event-specific data")
|
|
262
|
+
@encodedName("application/json", "details_json")
|
|
263
|
+
detailsJson?: string;
|
|
264
|
+
|
|
265
|
+
@doc("Event timestamp")
|
|
266
|
+
timestamp: utcDateTime;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// =============================================================================
|
|
270
|
+
// Schema Promotion
|
|
271
|
+
// =============================================================================
|
|
272
|
+
|
|
273
|
+
@doc("Attribute-to-column promotion from profiles")
|
|
274
|
+
@extension("x-csharp-type", "SchemaPromotionEntity")
|
|
275
|
+
model SchemaPromotionEntity {
|
|
276
|
+
@doc("Promotion ID")
|
|
277
|
+
@key
|
|
278
|
+
id: string;
|
|
279
|
+
|
|
280
|
+
@doc("Source profile")
|
|
281
|
+
@encodedName("application/json", "profile_id")
|
|
282
|
+
profileId: string;
|
|
283
|
+
|
|
284
|
+
@doc("JSON path in attributes_json")
|
|
285
|
+
@encodedName("application/json", "source_attribute")
|
|
286
|
+
sourceAttribute: string;
|
|
287
|
+
|
|
288
|
+
@doc("Promoted column name")
|
|
289
|
+
@encodedName("application/json", "target_column")
|
|
290
|
+
targetColumn: string;
|
|
291
|
+
|
|
292
|
+
@doc("Storage type for the promoted field")
|
|
293
|
+
@encodedName("application/json", "target_type")
|
|
294
|
+
targetType: string;
|
|
295
|
+
|
|
296
|
+
@doc("Target table (spans, logs, etc.)")
|
|
297
|
+
@encodedName("application/json", "target_table")
|
|
298
|
+
targetTable: string;
|
|
299
|
+
|
|
300
|
+
@doc("Index type (btree, hash, or null)")
|
|
301
|
+
@encodedName("application/json", "index_type")
|
|
302
|
+
indexType?: string;
|
|
303
|
+
|
|
304
|
+
@doc("Promotion status")
|
|
305
|
+
status: PromotionStatus;
|
|
306
|
+
|
|
307
|
+
@doc("Application timestamp")
|
|
308
|
+
@encodedName("application/json", "applied_at")
|
|
309
|
+
appliedAt?: utcDateTime;
|
|
310
|
+
|
|
311
|
+
@doc("Creation timestamp")
|
|
312
|
+
@encodedName("application/json", "created_at")
|
|
313
|
+
createdAt: utcDateTime;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
@doc("Schema promotion status")
|
|
317
|
+
enum PromotionStatus {
|
|
318
|
+
@doc("Pending application")
|
|
319
|
+
pending: "pending",
|
|
320
|
+
|
|
321
|
+
@doc("Successfully applied")
|
|
322
|
+
applied: "applied",
|
|
323
|
+
|
|
324
|
+
@doc("Rolled back")
|
|
325
|
+
rolledBack: "rolled_back",
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// =============================================================================
|
|
329
|
+
// Schema Change Job
|
|
330
|
+
// =============================================================================
|
|
331
|
+
|
|
332
|
+
@doc("Schema adaptation DDL job")
|
|
333
|
+
@extension("x-csharp-type", "SchemaChangeJobEntity")
|
|
334
|
+
model SchemaChangeJobEntity {
|
|
335
|
+
@doc("Job ID")
|
|
336
|
+
@key
|
|
337
|
+
id: string;
|
|
338
|
+
|
|
339
|
+
@doc("Link to promotion if applicable")
|
|
340
|
+
@encodedName("application/json", "promotion_id")
|
|
341
|
+
promotionId?: string;
|
|
342
|
+
|
|
343
|
+
@doc("Change type")
|
|
344
|
+
@encodedName("application/json", "change_type")
|
|
345
|
+
changeType: SchemaChangeType;
|
|
346
|
+
|
|
347
|
+
@doc("Target table")
|
|
348
|
+
@encodedName("application/json", "target_table")
|
|
349
|
+
targetTable: string;
|
|
350
|
+
|
|
351
|
+
@doc("DDL statement to execute")
|
|
352
|
+
@encodedName("application/json", "ddl_statement")
|
|
353
|
+
ddlStatement: string;
|
|
354
|
+
|
|
355
|
+
@doc("Rollback DDL")
|
|
356
|
+
@encodedName("application/json", "rollback_ddl")
|
|
357
|
+
rollbackDdl?: string;
|
|
358
|
+
|
|
359
|
+
@doc("Job status")
|
|
360
|
+
status: JobStatus;
|
|
361
|
+
|
|
362
|
+
@doc("Error message if failed")
|
|
363
|
+
@encodedName("application/json", "error_message")
|
|
364
|
+
errorMessage?: string;
|
|
365
|
+
|
|
366
|
+
@doc("Queue timestamp")
|
|
367
|
+
@encodedName("application/json", "queued_at")
|
|
368
|
+
queuedAt: utcDateTime;
|
|
369
|
+
|
|
370
|
+
@doc("Start timestamp")
|
|
371
|
+
@encodedName("application/json", "started_at")
|
|
372
|
+
startedAt?: utcDateTime;
|
|
373
|
+
|
|
374
|
+
@doc("Completion timestamp")
|
|
375
|
+
@encodedName("application/json", "completed_at")
|
|
376
|
+
completedAt?: utcDateTime;
|
|
377
|
+
|
|
378
|
+
@doc("Duration in milliseconds")
|
|
379
|
+
@encodedName("application/json", "duration_ms")
|
|
380
|
+
durationMs?: int32;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@doc("Schema change types")
|
|
384
|
+
enum SchemaChangeType {
|
|
385
|
+
@doc("Add a column")
|
|
386
|
+
addColumn: "add_column",
|
|
387
|
+
|
|
388
|
+
@doc("Drop a column")
|
|
389
|
+
dropColumn: "drop_column",
|
|
390
|
+
|
|
391
|
+
@doc("Add an index")
|
|
392
|
+
addIndex: "add_index",
|
|
393
|
+
|
|
394
|
+
@doc("Drop an index")
|
|
395
|
+
dropIndex: "drop_index",
|
|
396
|
+
|
|
397
|
+
@doc("Alter column type")
|
|
398
|
+
alterType: "alter_type",
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// =============================================================================
|
|
402
|
+
// Schema Change Event
|
|
403
|
+
// =============================================================================
|
|
404
|
+
|
|
405
|
+
@doc("DDL execution audit event")
|
|
406
|
+
@extension("x-csharp-type", "SchemaChangeEventEntity")
|
|
407
|
+
model SchemaChangeEventEntity {
|
|
408
|
+
@doc("Event ID")
|
|
409
|
+
@key
|
|
410
|
+
id: string;
|
|
411
|
+
|
|
412
|
+
@doc("Parent job")
|
|
413
|
+
@encodedName("application/json", "job_id")
|
|
414
|
+
jobId: string;
|
|
415
|
+
|
|
416
|
+
@doc("Event type")
|
|
417
|
+
@encodedName("application/json", "event_type")
|
|
418
|
+
eventType: string;
|
|
419
|
+
|
|
420
|
+
@doc("Human-readable message")
|
|
421
|
+
message?: string;
|
|
422
|
+
|
|
423
|
+
@doc("Event-specific data")
|
|
424
|
+
@encodedName("application/json", "details_json")
|
|
425
|
+
detailsJson?: string;
|
|
426
|
+
|
|
427
|
+
@doc("Rows affected by DDL")
|
|
428
|
+
@encodedName("application/json", "rows_affected")
|
|
429
|
+
rowsAffected?: int64;
|
|
430
|
+
|
|
431
|
+
@doc("Event timestamp")
|
|
432
|
+
timestamp: utcDateTime;
|
|
433
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// ANcpLua v2.0 - Telemetry Control Graph v1
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// The declared shape of qyl's telemetry: which service emits which signals
|
|
5
|
+
// with which attributes, and where they are exported. The graph is the single
|
|
6
|
+
// source the conformance verifier (qyl/internal/qyl.conformance) diffs reality
|
|
7
|
+
// against: the graph declares, the collector must conform. Exporter
|
|
8
|
+
// configuration is GENERATED from this graph only after the verifier reports
|
|
9
|
+
// conformance; it is never hand-authored.
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
import "@typespec/openapi";
|
|
13
|
+
import "@typespec/json-schema";
|
|
14
|
+
import "../common/types.tsp";
|
|
15
|
+
import "./configurator.tsp";
|
|
16
|
+
|
|
17
|
+
using TypeSpec.OpenAPI;
|
|
18
|
+
using TypeSpec.JsonSchema;
|
|
19
|
+
using Qyl.Api.Contracts.Common;
|
|
20
|
+
using Qyl.Api.Contracts.Domains.Configurator;
|
|
21
|
+
|
|
22
|
+
@jsonSchema
|
|
23
|
+
namespace Qyl.Api.Contracts.Domains.ControlGraph;
|
|
24
|
+
|
|
25
|
+
@doc("Telemetry signal kind a service can declare")
|
|
26
|
+
enum TelemetrySignalKind {
|
|
27
|
+
@doc("Trace span")
|
|
28
|
+
span: "span",
|
|
29
|
+
|
|
30
|
+
@doc("Metric instrument")
|
|
31
|
+
metric: "metric",
|
|
32
|
+
|
|
33
|
+
@doc("Log record")
|
|
34
|
+
log: "log",
|
|
35
|
+
|
|
36
|
+
@doc("Continuous profile")
|
|
37
|
+
profile: "profile",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@doc("Requirement level of a declared attribute (mirrors semconv requirement levels)")
|
|
41
|
+
enum AttributeRequirement {
|
|
42
|
+
@doc("Must be present on every emission; absence is a conformance error")
|
|
43
|
+
required: "required",
|
|
44
|
+
|
|
45
|
+
@doc("Should be present; absence is a conformance warning")
|
|
46
|
+
recommended: "recommended",
|
|
47
|
+
|
|
48
|
+
@doc("May be present; never a finding")
|
|
49
|
+
optIn: "opt_in",
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@doc("A single attribute a service declares on a signal. Keys are verbatim semconv keys (otel-keys.gen) or qyl-registry keys ('qyl.'/'ancplua.' prefix) — enforced by otelconventions-lint.")
|
|
53
|
+
model DeclaredAttribute {
|
|
54
|
+
@doc("Attribute key (dot-separated namespace, e.g. 'http.request.method' or 'qyl.session.id')")
|
|
55
|
+
@minLength(1)
|
|
56
|
+
key: string;
|
|
57
|
+
|
|
58
|
+
@doc("Requirement level")
|
|
59
|
+
requirement: AttributeRequirement = AttributeRequirement.recommended;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@doc("A signal a service declares it emits")
|
|
63
|
+
model DeclaredSignal {
|
|
64
|
+
@doc("Signal kind")
|
|
65
|
+
kind: TelemetrySignalKind;
|
|
66
|
+
|
|
67
|
+
@doc("Signal name (span name pattern, metric instrument name, or log event name)")
|
|
68
|
+
@minLength(1)
|
|
69
|
+
name: string;
|
|
70
|
+
|
|
71
|
+
@doc("Attributes declared on this signal")
|
|
72
|
+
attributes: DeclaredAttribute[] = #[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@doc("Wire protocol of an export edge")
|
|
76
|
+
enum ExportProtocol {
|
|
77
|
+
@doc("OTLP over gRPC")
|
|
78
|
+
otlpGrpc: "otlp_grpc",
|
|
79
|
+
|
|
80
|
+
@doc("OTLP over HTTP/protobuf")
|
|
81
|
+
otlpHttp: "otlp_http",
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@doc("An edge from a service to an export target. Carries the ENV VAR NAME holding the endpoint, never the endpoint value — the graph is a contract, not a config store.")
|
|
85
|
+
model ExportEdge {
|
|
86
|
+
@doc("Stable exporter identifier, unique per service (e.g. 'collector-primary')")
|
|
87
|
+
@minLength(1)
|
|
88
|
+
@encodedName("application/json", "exporter_id")
|
|
89
|
+
exporterId: string;
|
|
90
|
+
|
|
91
|
+
@doc("Wire protocol")
|
|
92
|
+
protocol: ExportProtocol;
|
|
93
|
+
|
|
94
|
+
@doc("Environment variable that resolves the endpoint at runtime (e.g. 'OTEL_EXPORTER_OTLP_ENDPOINT')")
|
|
95
|
+
@minLength(1)
|
|
96
|
+
@encodedName("application/json", "endpoint_env_var")
|
|
97
|
+
endpointEnvVar: string;
|
|
98
|
+
|
|
99
|
+
@doc("Signal kinds routed over this edge")
|
|
100
|
+
@minItems(1)
|
|
101
|
+
signals: TelemetrySignalKind[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@doc("Typed projection of the generation profile key — stays in sync with the entity via TypeSpec 1.13 constraint-based member resolution instead of duplicating the key type.")
|
|
105
|
+
internal model GraphProfileBinding<P extends GenerationProfileEntity> {
|
|
106
|
+
@doc("Generation profile this service's instrumentation is generated from")
|
|
107
|
+
@encodedName("application/json", "profile_id")
|
|
108
|
+
profileId: P.id;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@doc("A service node: what one service declares it emits and where it exports")
|
|
112
|
+
model ServiceNode {
|
|
113
|
+
@doc("Logical service name — must equal the value of the OTel resource attribute 'service.name' the service emits")
|
|
114
|
+
@minLength(1)
|
|
115
|
+
@encodedName("application/json", "service_name")
|
|
116
|
+
serviceName: string;
|
|
117
|
+
|
|
118
|
+
...GraphProfileBinding<GenerationProfileEntity>;
|
|
119
|
+
|
|
120
|
+
@doc("Signals this service declares")
|
|
121
|
+
declares: DeclaredSignal[];
|
|
122
|
+
|
|
123
|
+
@doc("Export edges for this service")
|
|
124
|
+
exports: ExportEdge[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@doc("Telemetry Control Graph: the declared telemetry surface of a qyl deployment. Instances are emitted as YAML (review) and JSON (verifier input) by @qyl/telemetry-control-graph.")
|
|
128
|
+
model TelemetryControlGraph {
|
|
129
|
+
@doc("Graph schema version")
|
|
130
|
+
@encodedName("application/json", "schema_version")
|
|
131
|
+
schemaVersion: "1";
|
|
132
|
+
|
|
133
|
+
@doc("Service nodes")
|
|
134
|
+
services: ServiceNode[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@doc("Kind of a conformance finding produced by the runtime verifier")
|
|
138
|
+
enum ConformanceFindingKind {
|
|
139
|
+
@doc("Telemetry observed that no service node declares")
|
|
140
|
+
undeclaredEmitted: "undeclared_emitted",
|
|
141
|
+
|
|
142
|
+
@doc("Declared signal never observed in the verification window")
|
|
143
|
+
declaredMissing: "declared_missing",
|
|
144
|
+
|
|
145
|
+
@doc("Observed attributes drift from the declaration (missing required key, unknown key)")
|
|
146
|
+
attributeDrift: "attribute_drift",
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@doc("Severity of a conformance finding")
|
|
150
|
+
enum ConformanceSeverity {
|
|
151
|
+
@doc("Violates the graph; blocks exporter-config generation")
|
|
152
|
+
error: "error",
|
|
153
|
+
|
|
154
|
+
@doc("Drift worth reviewing; does not block")
|
|
155
|
+
warning: "warning",
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@doc("A single declared-vs-observed difference")
|
|
159
|
+
model ConformanceFinding {
|
|
160
|
+
@doc("Finding kind")
|
|
161
|
+
kind: ConformanceFindingKind;
|
|
162
|
+
|
|
163
|
+
@doc("Severity")
|
|
164
|
+
severity: ConformanceSeverity;
|
|
165
|
+
|
|
166
|
+
@doc("Service the finding concerns")
|
|
167
|
+
@encodedName("application/json", "service_name")
|
|
168
|
+
serviceName: string;
|
|
169
|
+
|
|
170
|
+
@doc("Signal kind, when the finding is signal-scoped")
|
|
171
|
+
@encodedName("application/json", "signal_kind")
|
|
172
|
+
signalKind?: TelemetrySignalKind;
|
|
173
|
+
|
|
174
|
+
@doc("Signal name, when the finding is signal-scoped")
|
|
175
|
+
@encodedName("application/json", "signal_name")
|
|
176
|
+
signalName?: string;
|
|
177
|
+
|
|
178
|
+
@doc("Attribute key, when the finding is attribute-scoped")
|
|
179
|
+
@encodedName("application/json", "attribute_key")
|
|
180
|
+
attributeKey?: string;
|
|
181
|
+
|
|
182
|
+
@doc("Human-readable detail")
|
|
183
|
+
detail: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@doc("Result of one verifier run: the graph diffed against observed telemetry. 'conformant' (no error findings) is the gate for exporter-config generation.")
|
|
187
|
+
model ConformanceReport {
|
|
188
|
+
@doc("schema_version of the verified graph")
|
|
189
|
+
@encodedName("application/json", "graph_schema_version")
|
|
190
|
+
graphSchemaVersion: string;
|
|
191
|
+
|
|
192
|
+
@doc("All findings (empty means fully conformant)")
|
|
193
|
+
findings: ConformanceFinding[];
|
|
194
|
+
|
|
195
|
+
@doc("True when no error-severity findings exist")
|
|
196
|
+
conformant: boolean;
|
|
197
|
+
}
|