diff --git a/schemas/semconv-syntax.md b/schemas/semconv-syntax.md index 878dc813..47bda22d 100644 --- a/schemas/semconv-syntax.md +++ b/schemas/semconv-syntax.md @@ -42,7 +42,7 @@ All attributes are lower case. groups ::= semconv | semconv groups -semconv ::= id [convtype] brief [note] [extends] stability [deprecated] [display_name] attributes [specificfields] +semconv ::= id [convtype] brief [note] [extends] [stability] [deprecated] [display_name] attributes [specificfields] id ::= string @@ -103,9 +103,9 @@ specificfields ::= spanfields | eventfields | metricfields -spanfields ::= [events] [span_kind] +spanfields ::= [events] [span_kind] stability -eventfields ::= name [body] +eventfields ::= name [body] stability body ::= any_value @@ -136,7 +136,7 @@ events ::= id {id} # MUST point to an existing event group name ::= string -metricfields ::= metric_name instrument unit +metricfields ::= metric_name instrument unit stability metric_name ::= string instrument ::= "counter" @@ -268,7 +268,7 @@ The following is only valid if `type` is `metric`: Attribute group (`attribute_group` type) defines a set of attributes that can be declared once and referenced by semantic conventions for different signals, for example spans and logs. -Attribute groups don't have any specific fields and follow the general `semconv` semantics. +Attribute groups don't have any specific fields and follow the general `semconv` semantics. `stability` is not required for attribute groups. #### Any Value semantic convention diff --git a/schemas/semconv.schema.json b/schemas/semconv.schema.json index 89cf989e..a27e0347 100644 --- a/schemas/semconv.schema.json +++ b/schemas/semconv.schema.json @@ -45,8 +45,7 @@ "type": "object", "required": [ "id", - "brief", - "stability" + "brief" ], "anyOf": [ { @@ -60,6 +59,20 @@ ] } ], + "if": { + "properties": { + "type": { + "not": { + "const": "attribute_group" + } + } + } + }, + "then": { + "required": [ + "stability" + ] + }, "properties": { "id": { "type": "string", @@ -444,6 +457,13 @@ }, "type": { "$ref": "#/$defs/AttributeType" + }, + "stability": { + "allOf": [ + { + "$ref": "#/$defs/StabilityLevel" + } + ] } } }, @@ -634,4 +654,4 @@ ] } } -} +} \ No newline at end of file