forked from open-telemetry/build-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
semconv.schema.json
435 lines (435 loc) · 9.88 KB
/
semconv.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"description": "YAML schema for semantic convention generator, use for example with VS Code.",
"additionalProperties": false,
"properties": {
"groups": {
"type": "array",
"items": {
"anyOf": [
{
"allOf": [{"$ref": "#/definitions/SemanticConvention"}]
},
{
"allOf": [{"$ref": "#/definitions/SpanSemanticConvention"}]
},
{
"allOf": [{"$ref": "#/definitions/EventSemanticConvention"}]
},
{
"allOf": [{"$ref": "#/definitions/MetricSemanticConvention"}]
}
]
}
}
},
"definitions": {
"SemanticConventionBase": {
"type": "object",
"required": [
"id",
"brief"
],
"anyOf": [
{
"required": [
"attributes"
]
},
{
"required": [
"extends"
]
}
],
"properties": {
"id": {
"type": "string",
"description": "unique string"
},
"type": {
"type": "string",
"enum": [
"span",
"resource",
"metric",
"metric_group",
"event",
"scope",
"attribute_group"
],
"description": "The (signal) type of the semantic convention"
},
"brief": {
"type": "string",
"description": "a brief description of the semantic convention"
},
"note": {
"type": "string",
"description": "a more elaborate description of the semantic convention. It defaults to an empty string"
},
"prefix": {
"type": "string",
"description": "prefix of the attribute for this semconv. It defaults to an empty string."
},
"extends": {
"type": "string",
"description": "reference another semantic convention ID. It inherits all attributes from the specified semconv."
},
"attributes": {
"type": "array",
"items": {
"$ref": "#/definitions/Attribute"
},
"description": "list of attributes that belong to the semconv"
},
"constraints": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"required": [
"any_of"
],
"properties": {
"any_of": {
"type": "array",
"description": " accepts a list of sequences. Each sequence contains a list of attribute ids that are required. any_of enforces that all attributes of at least one of the sequences are set.",
"items": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
}
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"include"
],
"properties": {
"include": {
"type": "string",
"description": "accepts a semantic conventions id. It includes as part of this semantic convention all constraints and required attributes that are not already defined in the current semantic convention."
}
}
}
]
}
}
}
},
"SpanSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"properties": {
"type": {
"type": "string",
"const": "span"
},
"span_kind": {
"type": "string",
"enum": [
"client",
"server",
"producer",
"consumer",
"internal"
],
"description": "specifies the kind of the span. Leaf semconv nodes (in the hierarchy tree) that do not have this field set will generate a warning."
}
}
},
"EventSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"properties": {
"type": {
"type": "string",
"const": "event"
},
"name": {
"type": "string",
"description": "The name of the event. Required if no prefix is given."
}
},
"anyOf": [
{"required": ["prefix"]},
{"required": ["name"]}
]
},
"MetricGroupSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": ["type"],
"properties": {
"type": {
"type": "string",
"const": "metric_group"
}
}
},
"MetricSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": [
"type",
"metric_name",
"instrument",
"unit"
],
"properties": {
"instrument": {
"type": "string",
"description": "The instrument used to record the metric.",
"enum": [
"counter",
"gauge",
"histogram",
"updowncounter"
]
},
"metric_name": {
"type": "string",
"description": "The name of the metric."
},
"type": {
"type": "string",
"const": "metric"
},
"unit": {
"type": "string",
"description": "The unit in which the metric is measured in."
}
}
},
"SemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": ["type"],
"properties": {
"type": {
"type": "string",
"not": {
"enum": ["span", "event"]
}
}
}
},
"AttributeEnumType": {
"type": "object",
"additionalProperties": false,
"properties": {
"allow_custom_values": {
"type": "boolean"
},
"members": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"value"
],
"properties": {
"id": {
"type": "string",
"description": "string unique"
},
"value": {
"type": [
"string",
"number"
],
"description": "string or number, value of the enum entry."
},
"brief": {
"type": "string",
"description": "brief description of the enum entry value. It defaults to the value of ID."
},
"note": {
"type": "string",
"description": "longer description. It defaults to an empty string."
}
}
}
}
}
},
"AttributeFullSpec": {
"required": [
"id",
"type"
],
"properties": {
"id": {
"type": "string",
"description": "unique string"
},
"type": {
"oneOf": [
{
"type": "string",
"enum": [
"string",
"int",
"double",
"boolean",
"string[]",
"int[]",
"double[]",
"boolean[]",
"template[string]",
"template[int]",
"template[double]",
"template[boolean]",
"template[string[]]",
"template[int[]]",
"template[double[]]",
"template[boolean[]]"
],
"description": "literal denoting the type"
},
{
"$ref": "#/definitions/AttributeEnumType"
}
]
}
}
},
"AttributeReference": {
"type": "object",
"required": [
"ref"
],
"properties": {
"ref": {
"type": "string",
"description": "reference an existing attribute"
},
"tag": {
"type": "string",
"description": "associates a tag to the attribute"
}
}
},
"ValueType": {
"oneOf": [
{
"type": [
"string",
"boolean",
"number"
]
},
{
"type": "array",
"items": {
"type": [
"boolean",
"number",
"string"
]
}
}
]
},
"Attribute": {
"type": "object",
"allOf": [
{
"properties": {
"requirement_level": {
"description": "specifies the attribute requirement level. Can be 'required', 'conditionally_required', 'recommended', or 'opt_in'. When omitted, the attribute is 'recommended'. When set to 'conditionally_required', the string provided MUST specify the conditions under which the attribute is required.",
"oneOf": [
{
"const": "required"
},
{
"type": "object",
"additionalProperties": false,
"required": [
"conditionally_required"
],
"properties": {
"conditionally_required": {
"type": "string"
}
}
},
{
"oneOf": [
{
"const": "recommended"
},
{
"type": "object",
"additionalProperties": false,
"required": [
"recommended"
],
"properties": {
"recommended": {
"type": "string"
}
}
}
]
},
{
"const": "opt_in"
}
]
},
"sampling_relevant": {
"type": "boolean",
"description": "specifies if it is relevant for sampling. It defaults to false.",
"default": false
},
"brief": {
"type": "string",
"description": "brief description of the attribute."
},
"note": {
"type": "string",
"description": "additional notes to the attribute. It defaults to an empty string."
},
"examples": {
"anyOf": [
{ "$ref": "#/definitions/ValueType" },
{
"type": "array",
"items": { "$ref": "#/definitions/ValueType" }
}
],
"description": "sequence/dictionary of example values for the attribute. They are optional for boolean, int, double, and enum attributes. Example values must be of the same type of the attribute. If only a single example is provided, it can directly be reported without encapsulating it into a sequence/dictionary."
},
"deprecated": {
"type": "string",
"description": "specifies if the attribute is deprecated. The string provided as <description> MUST specify why it's deprecated and/or what to use instead."
}
}
},
{
"oneOf": [
{
"$ref": "#/definitions/AttributeFullSpec"
},
{
"$ref": "#/definitions/AttributeReference"
}
]
}
]
}
}
}