Skip to content

Commit

Permalink
Update semconv schema and syntax doc to correctly define stability
Browse files Browse the repository at this point in the history
…as optional for attribute groups.
  • Loading branch information
jerbly committed Nov 19, 2024
1 parent 380d443 commit 9a2674b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
10 changes: 5 additions & 5 deletions schemas/semconv-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
26 changes: 23 additions & 3 deletions schemas/semconv.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"type": "object",
"required": [
"id",
"brief",
"stability"
"brief"
],
"anyOf": [
{
Expand All @@ -60,6 +59,20 @@
]
}
],
"if": {
"properties": {
"type": {
"not": {
"const": "attribute_group"
}
}
}
},
"then": {
"required": [
"stability"
]
},
"properties": {
"id": {
"type": "string",
Expand Down Expand Up @@ -444,6 +457,13 @@
},
"type": {
"$ref": "#/$defs/AttributeType"
},
"stability": {
"allOf": [
{
"$ref": "#/$defs/StabilityLevel"
}
]
}
}
},
Expand Down Expand Up @@ -634,4 +654,4 @@
]
}
}
}
}

0 comments on commit 9a2674b

Please sign in to comment.