Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schema and syntax #344

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions semantic-conventions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Please update the changelog as part of any significant pull request.

## Unreleased

- Update json-schema version, remove properties that are not used anymore.
([#344](https://github.com/open-telemetry/build-tools/pull/344))

## 0.25.0

- Added display_name as an allowed property on semconv attribute groups
Expand Down
136 changes: 94 additions & 42 deletions semantic-conventions/semconv.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"description": "YAML schema for semantic convention generator, use for example with VS Code.",
"additionalProperties": false,
Expand All @@ -9,27 +9,44 @@
"items": {
"anyOf": [
{
"allOf": [{"$ref": "#/definitions/SemanticConvention"}]
"allOf": [
{
"$ref": "#/$defs/SemanticConvention"
}
]
},
{
"allOf": [{"$ref": "#/definitions/SpanSemanticConvention"}]
"allOf": [
{
"$ref": "#/$defs/SpanSemanticConvention"
}
]
},
{
"allOf": [{"$ref": "#/definitions/EventSemanticConvention"}]
"allOf": [
{
"$ref": "#/$defs/EventSemanticConvention"
}
]
},
{
"allOf": [{"$ref": "#/definitions/MetricSemanticConvention"}]
"allOf": [
{
"$ref": "#/$defs/MetricSemanticConvention"
}
]
}
]
}
}
},
"definitions": {
"$defs": {
"SemanticConventionBase": {
"type": "object",
"required": [
"id",
"brief"
"brief",
"stability"
],
"anyOf": [
{
Expand Down Expand Up @@ -67,29 +84,40 @@
"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."
"description": "reference another semantic convention ID. It inherits all attributes from the specified semantic convention."
},
"attributes": {
"type": "array",
"items": {
"$ref": "#/definitions/Attribute"
"$ref": "#/$defs/Attribute"
},
"description": "list of attributes that belong to the semconv"
"description": "list of attributes that belong to the semantic convention"
},
"display_name": {
"type": "string",
"description": "the display name / title of the attribute group."
},
"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."
},
"stability": {
"allOf": [
{
"$ref": "#/$defs/StabilityLevel"
}
]
}
}
},
"SpanSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"allOf": [
{
"$ref": "#/$defs/SemanticConventionBase"
}
],
"properties": {
"type": {
"type": "string",
Expand All @@ -104,29 +132,40 @@
"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."
"description": "specifies the kind of the span. Leaf semantic convention nodes (in the hierarchy tree) that do not have this field set will generate a warning."
}
}
},
"EventSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"allOf": [
{
"$ref": "#/$defs/SemanticConventionBase"
}
],
"properties": {
"type": {
"type": "string",
"const": "event"
},
"name": {
"type": "string",
"description": "The name of the event. Required if no prefix is given."
"description": "The name of the event."
}
},
"anyOf": [
{"required": ["prefix"]},
{"required": ["name"]}
{
"required": [
"name"
]
}
]
},
"MetricSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"allOf": [
{
"$ref": "#/$defs/SemanticConventionBase"
}
],
"required": [
"type",
"metric_name",
Expand Down Expand Up @@ -159,13 +198,22 @@
}
},
"SemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": ["type"],
"allOf": [
{
"$ref": "#/$defs/SemanticConventionBase"
}
],
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"not": {
"enum": ["span", "event"]
"enum": [
"span",
"event"
]
}
}
}
Expand All @@ -174,17 +222,15 @@
"type": "object",
"additionalProperties": false,
"properties": {
"allow_custom_values": {
"type": "boolean"
},
"members": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"value"
"value",
"stability"
],
"properties": {
"id": {
Expand All @@ -206,8 +252,16 @@
"type": "string",
"description": "longer description. It defaults to an empty string."
},
"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."
},
"stability": {
"allOf": [{ "$ref": "#/definitions/StabilityLevel" }]
"allOf": [
{
"$ref": "#/$defs/StabilityLevel"
}
]
}
}
}
Expand All @@ -217,7 +271,8 @@
"AttributeFullSpec": {
"required": [
"id",
"type"
"type",
"stability"
],
"properties": {
"id": {
Expand Down Expand Up @@ -249,7 +304,7 @@
"description": "literal denoting the type"
},
{
"$ref": "#/definitions/AttributeEnumType"
"$ref": "#/$defs/AttributeEnumType"
}
]
}
Expand Down Expand Up @@ -362,30 +417,27 @@
},
"examples": {
"anyOf": [
{ "$ref": "#/definitions/ValueType" },
{
"$ref": "#/$defs/ValueType"
},
{
"type": "array",
"items": { "$ref": "#/definitions/ValueType" }
"items": {
"$ref": "#/$defs/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."
},
"stability": {
"allOf": [{ "$ref": "#/definitions/StabilityLevel" }]
}
}
},
{
"oneOf": [
{
"$ref": "#/definitions/AttributeFullSpec"
"$ref": "#/$defs/AttributeFullSpec"
},
{
"$ref": "#/definitions/AttributeReference"
"$ref": "#/$defs/AttributeReference"
}
]
}
Expand Down
Loading
Loading