From 14261ddd0b14fecb94e9fca3e0690008b83de836 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Mon, 6 May 2024 18:36:26 -0700 Subject: [PATCH] Remove constraints (#310) --- semantic-conventions/README.md | 13 +- semantic-conventions/semconv.schema.json | 46 ------ .../semconv/model/constraints.py | 96 ------------ .../semconv/model/semantic_convention.py | 91 +---------- .../semconv/templating/markdown/__init__.py | 55 +------ .../tests/data/markdown/deprecated/http.yaml | 12 -- .../src/tests/data/markdown/empty/http.yaml | 12 -- .../tests/data/markdown/empty_table/faas.yaml | 2 - .../tests/data/markdown/empty_table/http.yaml | 12 -- .../src/tests/data/markdown/event/event.yaml | 4 - .../src/tests/data/markdown/event/expected.md | 9 +- .../markdown/extend_constraint/database.yaml | 4 - .../markdown/extend_constraint/expected.md | 9 +- .../tests/data/markdown/include/expected.md | 15 +- .../src/tests/data/markdown/include/faas.yaml | 3 +- .../src/tests/data/markdown/include/http.yaml | 12 -- .../data/markdown/missing_end_tag/http.yaml | 13 +- .../tests/data/markdown/multiple/http.yaml | 12 -- .../data/markdown/parameter_empty/faas.yaml | 2 - .../data/markdown/parameter_empty/http.yaml | 12 -- .../data/markdown/parameter_full/expected.md | 24 --- .../data/markdown/parameter_full/faas.yaml | 2 - .../data/markdown/parameter_full/http.yaml | 12 -- .../parameter_remove_constraint/database.yaml | 5 - .../data/markdown/parameter_tag/database.yaml | 5 - .../data/markdown/parameter_tag/expected.md | 9 +- .../parameter_tag_empty/database.yaml | 4 - .../markdown/parameter_tag_empty/expected.md | 5 - .../data/markdown/parameter_wrong/faas.yaml | 2 - .../data/markdown/parameter_wrong/http.yaml | 12 -- .../parameter_wrong_duplicate/faas.yaml | 2 - .../parameter_wrong_duplicate/http.yaml | 12 -- .../markdown/parameter_wrong_syntax/faas.yaml | 8 +- .../markdown/parameter_wrong_syntax/http.yaml | 12 -- .../src/tests/data/markdown/ref/expected.md | 5 - .../src/tests/data/markdown/ref/http.yaml | 12 -- .../src/tests/data/markdown/ref/rpc.yaml | 4 - .../data/markdown/sampling_relevant/http.yaml | 4 +- .../src/tests/data/markdown/single/http.yaml | 12 -- .../data/markdown/wrong_semconv_id/http.yaml | 12 -- .../src/tests/data/yaml/database.yaml | 4 - .../tests/data/yaml/errors/invalid_type.yaml | 4 - .../data/yaml/errors/multi_value_cnstr.yaml | 4 - .../data/yaml/errors/resource_spankind.yaml | 4 - .../data/yaml/errors/validate_anyof.yaml | 17 -- .../tests/data/yaml/errors/wrong_cnstr.yaml | 11 -- .../src/tests/data/yaml/event.yaml | 4 - .../src/tests/data/yaml/faas.yaml | 2 - .../src/tests/data/yaml/http.yaml | 12 -- .../tests/data/yaml/imported-inherited.yaml | 9 -- .../src/tests/data/yaml/rpc.yaml | 4 - .../tests/semconv/model/test_correct_parse.py | 146 +----------------- .../semconv/model/test_error_detection.py | 32 ---- .../tests/semconv/templating/test_markdown.py | 9 -- semantic-conventions/syntax.md | 28 +--- 55 files changed, 39 insertions(+), 848 deletions(-) delete mode 100644 semantic-conventions/src/opentelemetry/semconv/model/constraints.py delete mode 100644 semantic-conventions/src/tests/data/yaml/errors/validate_anyof.yaml delete mode 100644 semantic-conventions/src/tests/data/yaml/errors/wrong_cnstr.yaml diff --git a/semantic-conventions/README.md b/semantic-conventions/README.md index 81f91a23..c9599a69 100644 --- a/semantic-conventions/README.md +++ b/semantic-conventions/README.md @@ -63,9 +63,8 @@ for which we want to generate the table. After `{semantic_convention_id}`, optional parameters enclosed in parentheses can be added to customize the output: - `tag={tag}`: prints only the attributes that have `{tag}` as a tag; -- `full`: prints attributes and constraints inherited from the parent semantic conventions or from included ones; +- `full`: prints attributes inherited from the parent semantic conventions or from included ones; - `ref`: prints attributes that are referenced from another semantic convention; -- `remove_constraint`: does not print additional constraints of the semantic convention. By default markdown tables are rendered with stability badges (like ![Stable](https://img.shields.io/badge/-stable-lightgreen) or ![Experimental](https://img.shields.io/badge/-experimental-blue)) which can be disabled with `--md-disable-stable-badge`, `--md-disable-experimental-badge`, `--md-disable-deprecated-badge`. When badges are disabled, the stability column contains plain text representation of stability or deprecation status. @@ -74,18 +73,18 @@ When badges are disabled, the stability column contains plain text representatio These examples assume that a semantic convention with the id `http.server` extends another semantic convention with the id `http`. -`` will print only the attributes and constraints of the `http.server` semantic +`` will print only the attributes of the `http.server` semantic convention. -`` will print the attributes and constraints of the `http` semantic -convention and also the attributes and constraints of the `http.server` semantic convention. +`` will print the attributes of the `http` semantic +convention and also the attributes of the `http.server` semantic convention. `` is equivalent to ``. -`` will print the constraints and attributes of the `http.server` semantic +`` will print the attributes of the `http.server` semantic convention that have the tag `network`. -`` will print the constraints and attributes of both `http` and `http.server` +`` will print the attributes of both `http` and `http.server` semantic conventions that have the tag `network`. `` will print a table describing a single metric diff --git a/semantic-conventions/semconv.schema.json b/semantic-conventions/semconv.schema.json index ea5ade2e..a22365c8 100644 --- a/semantic-conventions/semconv.schema.json +++ b/semantic-conventions/semconv.schema.json @@ -82,52 +82,6 @@ }, "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." - } - } - } - ] - } - }, "display_name": { "type": "string", "description": "the display name / title of the attribute group." diff --git a/semantic-conventions/src/opentelemetry/semconv/model/constraints.py b/semantic-conventions/src/opentelemetry/semconv/model/constraints.py deleted file mode 100644 index a483928d..00000000 --- a/semantic-conventions/src/opentelemetry/semconv/model/constraints.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from dataclasses import dataclass, replace -from typing import Tuple - -from ruamel.yaml.comments import CommentedSeq - -from opentelemetry.semconv.model.semantic_attribute import SemanticAttribute -from opentelemetry.semconv.model.utils import validate_values - - -# We cannot frozen due to later evaluation of the attributes -@dataclass -class AnyOf: - """Defines a constraint where at least one of the list of attributes must be set. - The implementation of this class is evaluated in two times. At parsing time, the choice_list_ids field is - populated. After all yaml files are parsed, the choice_list_attributes field is populated with the object - representation of the attribute ids of choice_list_ids. - - Attributes: - choice_list_ids Contains the lists of attributes ids that must be set. - inherited True if it is inherited by another semantic convention, i.e. by include or extends. - choice_list_attributes Contains the list of attributes objects. This list contains the same lists of - attributes of choice_list_ids but instead of the ids, it contains the respective - objects representations. - _yaml_src_position Contains the position in the YAML file of the AnyOf attribute - """ - - choice_list_ids: Tuple[Tuple[str, ...], ...] - inherited: bool = False - choice_list_attributes: Tuple[Tuple[SemanticAttribute, ...], ...] = () - _yaml_src_position: int = 0 - - def __eq__(self, other): - if not isinstance(other, AnyOf): - return False - return self.choice_list_ids == other.choice_list_ids - - def __hash__(self): - return hash(self.choice_list_ids) - - def add_attributes(self, attr: Tuple[SemanticAttribute]): - self.choice_list_attributes += (attr,) - - def inherit_anyof(self): - return replace(self, inherited=True) - - -@dataclass(frozen=True) -class Include: - semconv_id: str - - -def parse_constraints(yaml_constraints, validation_ctx): - """This method parses the yaml representation for semantic convention attributes - creating a list of Constraint objects. - """ - constraints = () - allowed_keys = ("include", "any_of") - for constraint in yaml_constraints: - validate_values(constraint, allowed_keys, validation_ctx) - if len(constraint.keys()) > 1: - position = constraint.lc.data[list(constraint)[1]] - msg = ( - "Invalid entry in constraint array - multiple top-level keys in entry." - ) - validation_ctx.raise_or_warn(position, msg, None) - if "include" in constraint: - constraints += (Include(constraint.get("include")),) - elif "any_of" in constraint: - choice_sets = () - for constraint_list in constraint.get("any_of"): - inner_id_list = () - if isinstance(constraint_list, CommentedSeq): - inner_id_list = tuple( - attr_constraint for attr_constraint in constraint_list - ) - else: - inner_id_list += (constraint_list,) - choice_sets += (inner_id_list,) - any_of = AnyOf(choice_sets) - any_of._yaml_src_position = constraint.get("any_of").lc.data - constraints += (any_of,) - return constraints diff --git a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py index 97a4778b..360a9bb1 100644 --- a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py +++ b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py @@ -20,7 +20,6 @@ from ruamel.yaml import YAML -from opentelemetry.semconv.model.constraints import AnyOf, Include, parse_constraints from opentelemetry.semconv.model.exceptions import ValidationError from opentelemetry.semconv.model.semantic_attribute import ( AttributeType, @@ -109,7 +108,6 @@ class BaseSemanticConvention(ValidatableYamlNode): "stability", "extends", "attributes", - "constraints", "deprecated", "display_name", ) @@ -163,9 +161,6 @@ def __init__(self, group, validation_ctx): ) self.extends = group.get("extends", "").strip() self.events = group.get("events", ()) - self.constraints = parse_constraints( - group.get("constraints", ()), validation_ctx - ) self.attrs_by_name = SemanticAttribute.parse( self.prefix, group.get("attributes"), validation_ctx ) @@ -179,15 +174,6 @@ def contains_attribute(self, attr: "SemanticAttribute"): return True return False - def has_attribute_constraint(self, attr): - return any( - attribute.equivalent_to(attr) - for constraint in self.constraints - if isinstance(constraint, AnyOf) - for attr_list in constraint.choice_list_attributes - for attribute in attr_list - ) - def validate_values(self): super().validate_values() if self.prefix: @@ -347,17 +333,13 @@ def finish(self): if index > 0: self.debug = False for semconv in self.models.values(): - # Ref first, extends and includes after! fixpoint_ref = self.resolve_ref(semconv) - fixpoint_inc = self.resolve_include(semconv) - fixpoint = fixpoint and fixpoint_ref and fixpoint_inc + fixpoint = fixpoint and fixpoint_ref index += 1 self.debug = tmp_debug # After we resolve any local dependency, we can resolve parent/child relationship self._populate_extends() # From string containing attribute ids to SemanticAttribute objects - self._populate_anyof_attributes() - # From strings containing Semantic Conventions for Events ids to SemanticConvention objects self._populate_events() def _populate_extends(self): @@ -397,15 +379,9 @@ def _populate_extends_single(self, semconv, unprocessed): parent_extended = self.models.get(extended.extends) self._populate_extends_single(parent_extended, unprocessed) - # inherit prefix and constraints + # inherit prefix if not semconv.prefix: semconv.prefix = extended.prefix - # Constraints - for constraint in extended.constraints: - if constraint not in semconv.constraints and isinstance( - constraint, AnyOf - ): - semconv.constraints += (constraint.inherit_anyof(),) # Attributes parent_attributes = {} for ext_attr in extended.attributes_and_templates: @@ -417,27 +393,6 @@ def _populate_extends_single(self, semconv, unprocessed): # delete from remaining semantic conventions to process del unprocessed[semconv.semconv_id] - def _populate_anyof_attributes(self): - any_of: AnyOf - for semconv in self.models.values(): - for any_of in semconv.constraints: - if not isinstance(any_of, AnyOf): - continue - for index, attr_ids in enumerate(any_of.choice_list_ids): - constraint_attrs = [] - for attr_id in attr_ids: - ref_attr = self._lookup_attribute(attr_id) - if ref_attr is None: - self.validation_ctx.raise_or_warn( - any_of._yaml_src_position[index], - f"Any_of attribute '{attr_id}' of semantic " - "convention {semconv.semconv_id} does not exist!", - attr_id, - ) - constraint_attrs.append(ref_attr) - if constraint_attrs: - any_of.add_attributes(constraint_attrs) - def _populate_events(self): for semconv in self.models.values(): events: typing.List[EventSemanticConvention] = [] @@ -505,48 +460,6 @@ def _merge_attribute(self, child, parent): child.attr_id = parent.attr_id return child - def resolve_include(self, semconv): - fixpoint_inc = True - for constraint in semconv.constraints: - if isinstance(constraint, Include): - include_semconv = self.models.get(constraint.semconv_id) - # include required attributes and constraints - if include_semconv is None: - self.validation_ctx.raise_or_warn( - semconv._position, - f"Semantic Convention {semconv.semconv_id} includes " - "{constraint.semconv_id} but the latter cannot be found!", - semconv.semconv_id, - ) - # We resolve the parent/child relationship of the included semantic convention, if any - self._populate_extends_single( - include_semconv, {include_semconv.semconv_id: include_semconv} - ) - attr: SemanticAttribute - for attr in include_semconv.attributes_and_templates: - if semconv.contains_attribute(attr): - if self.debug: - print( - f"[Includes] {semconv.semconv_id} already contains attribute {attr}" - ) - continue - # There are changes - fixpoint_inc = False - semconv.attrs_by_name[attr.fqn] = attr.import_attribute() - for inc_constraint in include_semconv.constraints: - if ( - isinstance(inc_constraint, Include) - or inc_constraint in semconv.constraints - ): - # We do not include "include" constraint or the constraint was already imported - continue - # We know the type of the constraint - inc_constraint: AnyOf - # There are changes - fixpoint_inc = False - semconv.constraints += (inc_constraint.inherit_anyof(),) - return fixpoint_inc - def _lookup_attribute(self, attr_id: str) -> Union[SemanticAttribute, None]: return next( ( diff --git a/semantic-conventions/src/opentelemetry/semconv/templating/markdown/__init__.py b/semantic-conventions/src/opentelemetry/semconv/templating/markdown/__init__.py index 68eef450..7534d527 100644 --- a/semantic-conventions/src/opentelemetry/semconv/templating/markdown/__init__.py +++ b/semantic-conventions/src/opentelemetry/semconv/templating/markdown/__init__.py @@ -20,7 +20,6 @@ import typing from pathlib import PurePath -from opentelemetry.semconv.model.constraints import AnyOf, Include from opentelemetry.semconv.model.semantic_attribute import ( AttributeType, EnumAttributeType, @@ -79,7 +78,6 @@ class MarkdownRenderer: valid_parameters = [ "tag", "full", - "remove_constraints", "metric_table", "omit_requirement_level", ] @@ -178,20 +176,14 @@ def derive_requirement_level(self, attribute: SemanticAttribute): required = "`Opt-In`" else: # attribute.requirement_level == Required.RECOMMENDED or None # check if there are any notes - if ( - not self.render_ctx.is_remove_constraint - and self.render_ctx.current_semconv.has_attribute_constraint(attribute) - ): - required = "See below" + if not attribute.requirement_level_msg: + required = "`Recommended`" + elif len(attribute.requirement_level_msg) < self.options.break_count: + required = "`Recommended` " + attribute.requirement_level_msg else: - if not attribute.requirement_level_msg: - required = "`Recommended`" - elif len(attribute.requirement_level_msg) < self.options.break_count: - required = "`Recommended` " + attribute.requirement_level_msg - else: - # We put the condition in the notes after the table - self.render_ctx.add_note(attribute.requirement_level_msg) - required = f"`Recommended` [{len(self.render_ctx.notes)}]" + # We put the condition in the notes after the table + self.render_ctx.add_note(attribute.requirement_level_msg) + required = f"`Recommended` [{len(self.render_ctx.notes)}]" return required def write_table_header(self, output: io.StringIO): @@ -257,22 +249,6 @@ def to_markdown_metric_table( ) self.to_markdown_notes(output) - def to_markdown_anyof(self, anyof: AnyOf, output: io.StringIO): - """ - This method renders anyof constraints into markdown lists - """ - if anyof.inherited and not self.render_ctx.is_full: - return - output.write( - "\n**Additional attribute requirements:** At least one of the following sets of attributes is " - "required:\n\n" - ) - for choice in anyof.choice_list_ids: - output.write("* ") - list_of_choice = ", ".join(self.render_attribute_id(c) for c in choice) - output.write(list_of_choice) - output.write("\n") - def to_markdown_notes(self, output: io.StringIO): """Renders notes after a Semantic Convention Table :return: @@ -369,19 +345,6 @@ def get_attr_reference_relative_path(self, attribute_id): return rel_path return None - def to_markdown_constraint( - self, - obj: typing.Union[AnyOf, Include], - output: io.StringIO, - ): - """ - Entry method to translate attributes and constraints of a semantic convention into Markdown - """ - if isinstance(obj, AnyOf): - self.to_markdown_anyof(obj, output) - elif not isinstance(obj, Include): - raise TypeError(f"Trying to generate Markdown for a wrong type {type(obj)}") - def render_md(self): for md_filename in self.file_names: with open(md_filename, encoding="utf-8") as md_file: @@ -498,7 +461,6 @@ def _render_group(self, semconv, parameters, output): output.write(MarkdownRenderer.prelude.format(header)) self.render_ctx.clear_table_generation() self.render_ctx.current_semconv = semconv - self.render_ctx.is_remove_constraint = "remove_constraints" in parameters self.render_ctx.group_key = parameters.get("tag") self.render_ctx.is_full = "full" in parameters self.render_ctx.is_metric_table = "metric_table" in parameters @@ -513,9 +475,6 @@ def _render_group(self, semconv, parameters, output): output.write(f"The event name MUST be `{semconv.name}`.\n\n") self.to_markdown_attribute_table(semconv, output) - if not self.render_ctx.is_remove_constraint: - for cnst in semconv.constraints: - self.to_markdown_constraint(cnst, output) self.to_markdown_enum(output) output.write("") diff --git a/semantic-conventions/src/tests/data/markdown/deprecated/http.yaml b/semantic-conventions/src/tests/data/markdown/deprecated/http.yaml index 22cce227..a36252b3 100644 --- a/semantic-conventions/src/tests/data/markdown/deprecated/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/deprecated/http.yaml @@ -95,12 +95,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -123,9 +117,3 @@ groups: sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/empty/http.yaml b/semantic-conventions/src/tests/data/markdown/empty/http.yaml index 96300950..9421f60b 100644 --- a/semantic-conventions/src/tests/data/markdown/empty/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/empty/http.yaml @@ -60,12 +60,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -88,9 +82,3 @@ groups: sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/empty_table/faas.yaml b/semantic-conventions/src/tests/data/markdown/empty_table/faas.yaml index 6e3ad387..e047c798 100644 --- a/semantic-conventions/src/tests/data/markdown/empty_table/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/empty_table/faas.yaml @@ -44,5 +44,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server diff --git a/semantic-conventions/src/tests/data/markdown/empty_table/http.yaml b/semantic-conventions/src/tests/data/markdown/empty_table/http.yaml index c754967f..5b4a8436 100644 --- a/semantic-conventions/src/tests/data/markdown/empty_table/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/empty_table/http.yaml @@ -61,12 +61,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -105,9 +99,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/event/event.yaml b/semantic-conventions/src/tests/data/markdown/event/event.yaml index ba74c1ae..65dd6d2b 100644 --- a/semantic-conventions/src/tests/data/markdown/event/event.yaml +++ b/semantic-conventions/src/tests/data/markdown/event/event.yaml @@ -34,7 +34,3 @@ groups: it is known that the exception is escaping the scope of the span. note: |- An exception is considered to have escaped. - constraints: - - any_of: - - "exception.type" - - "exception.message" \ No newline at end of file diff --git a/semantic-conventions/src/tests/data/markdown/event/expected.md b/semantic-conventions/src/tests/data/markdown/event/expected.md index a4606a7d..bb7daeb1 100644 --- a/semantic-conventions/src/tests/data/markdown/event/expected.md +++ b/semantic-conventions/src/tests/data/markdown/event/expected.md @@ -6,14 +6,9 @@ The event name MUST be `exception`. | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| | `exception.escaped` | boolean | SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. [1] | | `Recommended` | Experimental | -| `exception.message` | string | The exception message. | `Division by zero`; `Can't convert 'int' object to str implicitly` | See below | Experimental | +| `exception.message` | string | The exception message. | `Division by zero`; `Can't convert 'int' object to str implicitly` | `Recommended` | Experimental | | `exception.stacktrace` | string | A stacktrace. | `Exception in thread "main" java.lang.RuntimeException: Test exception\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n at com.example.GenerateTrace.main(GenerateTrace.java:5)` | `Recommended` | Experimental | -| `exception.type` | string | The type of the exception. | `java.net.ConnectException`; `OSError` | See below | Experimental | +| `exception.type` | string | The type of the exception. | `java.net.ConnectException`; `OSError` | `Recommended` | Experimental | **[1]:** An exception is considered to have escaped. - -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `exception.type` -* `exception.message` diff --git a/semantic-conventions/src/tests/data/markdown/extend_constraint/database.yaml b/semantic-conventions/src/tests/data/markdown/extend_constraint/database.yaml index ebfd1b70..7e325a5d 100644 --- a/semantic-conventions/src/tests/data/markdown/extend_constraint/database.yaml +++ b/semantic-conventions/src/tests/data/markdown/extend_constraint/database.yaml @@ -269,10 +269,6 @@ groups: tag: connection-level requirement_level: conditionally_required: Recommended in general, required for in-process databases (`"inproc"`). - constraints: - - any_of: - - 'net.peer.name' - - 'net.peer.ip' - id: db.cassandra type: span diff --git a/semantic-conventions/src/tests/data/markdown/extend_constraint/expected.md b/semantic-conventions/src/tests/data/markdown/extend_constraint/expected.md index d80bddae..0aa74747 100644 --- a/semantic-conventions/src/tests/data/markdown/extend_constraint/expected.md +++ b/semantic-conventions/src/tests/data/markdown/extend_constraint/expected.md @@ -41,8 +41,8 @@ Some database systems may allow a connection to switch to a different `db.user`, | `net.transport` | string | Transport protocol used. See note below. | `IP.TCP` | `Conditionally Required` [2] | Experimental | | `db.connection_string` | string | The connection string used to connect to the database. [3] | `Server=(localdb)\v11.0;Integrated Security=true;` | `Recommended` | Experimental | | `db.user` | string | Username for accessing the database. | `readonly_user`; `reporting_user` | `Recommended` | Experimental | -| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | See below | Experimental | -| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | See below | Experimental | +| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | `Recommended` | Experimental | +| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | `Recommended` | Experimental | **[1]:** if using a port other than the default port for this DBMS. @@ -50,11 +50,6 @@ Some database systems may allow a connection to switch to a different `db.user`, **[3]:** It is recommended to remove embedded credentials. -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `net.peer.name` -* `net.peer.ip` - `db.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | Value | Description | Stability | diff --git a/semantic-conventions/src/tests/data/markdown/include/expected.md b/semantic-conventions/src/tests/data/markdown/include/expected.md index b0462419..157651db 100644 --- a/semantic-conventions/src/tests/data/markdown/include/expected.md +++ b/semantic-conventions/src/tests/data/markdown/include/expected.md @@ -8,13 +8,13 @@ | [`http.server_name`](input_http.md) | string | The primary server name of the matched virtual host. [1] | `example.com` | `Conditionally Required` [2] | Experimental | | `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | `Conditionally Required` if and only if one was received/sent | Experimental | | `faas.execution` | string | The execution id of the current function execution. | `af9d5aa4-a685-4c5f-a22b-444f80b3cc28` | `Recommended` | Experimental | -| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | See below | Experimental | +| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | `Recommended` | Experimental | | `http.recommended_attribute` | string | brief | `foo` | `Recommended` short note | Experimental | | `http.recommended_attribute_long_note` | string | brief | `bar` | `Recommended` [3] | Experimental | -| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | See below | Experimental | +| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | `Recommended` | Experimental | | `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | `Recommended` | Experimental | -| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | See below | Experimental | -| `http.url` | string | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. | `https://www.foo.bar/search?q=OpenTelemetry#SemConv` | See below | Experimental | +| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | `Recommended` | Experimental | +| `http.url` | string | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. | `https://www.foo.bar/search?q=OpenTelemetry#SemConv` | `Recommended` | Experimental | | `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | `Recommended` | Experimental | **[1]:** This is an example @@ -26,13 +26,6 @@ **[3]:** some very long note that should be written under the semconv table -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `http.url` -* `http.scheme`, `http.host`, `http.target` -* `http.scheme`, [`http.server_name`](input_http.md), `net.host.port`, `http.target` -* `http.scheme`, `net.host.name`, `net.host.port`, `http.target` - `faas.trigger` MUST be one of the following: | Value | Description | Stability | diff --git a/semantic-conventions/src/tests/data/markdown/include/faas.yaml b/semantic-conventions/src/tests/data/markdown/include/faas.yaml index 84607bbe..41fa4182 100644 --- a/semantic-conventions/src/tests/data/markdown/include/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/include/faas.yaml @@ -44,5 +44,4 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server + diff --git a/semantic-conventions/src/tests/data/markdown/include/http.yaml b/semantic-conventions/src/tests/data/markdown/include/http.yaml index 2bd266f2..1bc2ffb3 100644 --- a/semantic-conventions/src/tests/data/markdown/include/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/include/http.yaml @@ -77,12 +77,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -106,9 +100,3 @@ groups: - of note - with list examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/missing_end_tag/http.yaml b/semantic-conventions/src/tests/data/markdown/missing_end_tag/http.yaml index de43aad4..47f27bc5 100644 --- a/semantic-conventions/src/tests/data/markdown/missing_end_tag/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/missing_end_tag/http.yaml @@ -61,12 +61,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -89,9 +83,4 @@ groups: sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] + diff --git a/semantic-conventions/src/tests/data/markdown/multiple/http.yaml b/semantic-conventions/src/tests/data/markdown/multiple/http.yaml index de43aad4..62cdc923 100644 --- a/semantic-conventions/src/tests/data/markdown/multiple/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/multiple/http.yaml @@ -61,12 +61,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -89,9 +83,3 @@ groups: sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/parameter_empty/faas.yaml b/semantic-conventions/src/tests/data/markdown/parameter_empty/faas.yaml index 6e3ad387..e047c798 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_empty/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_empty/faas.yaml @@ -44,5 +44,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server diff --git a/semantic-conventions/src/tests/data/markdown/parameter_empty/http.yaml b/semantic-conventions/src/tests/data/markdown/parameter_empty/http.yaml index c7281bd6..6f5e891d 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_empty/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_empty/http.yaml @@ -61,12 +61,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -105,9 +99,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/parameter_full/expected.md b/semantic-conventions/src/tests/data/markdown/parameter_full/expected.md index 079264a5..1f488c14 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_full/expected.md +++ b/semantic-conventions/src/tests/data/markdown/parameter_full/expected.md @@ -4,31 +4,7 @@ | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| | `faas.trigger` | string | Type of the trigger on which the function is executed. | `datasource` | `Required` | Experimental | -| `http.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | `Required` | Experimental | -| `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | `Conditionally Required` | Experimental | -| [`http.server_name`](http.md) | string | The primary server name of the matched virtual host. [1] | `example.com` | `Conditionally Required` [2] | Experimental | -| `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | `Conditionally Required` if and only if one was received/sent. | Experimental | | `faas.execution` | string | The execution id of the current function execution. | `af9d5aa4-a685-4c5f-a22b-444f80b3cc28` | `Recommended` | Experimental | -| [`http.client_ip`](http.md) | string | The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). [3] | `83.164.160.102` | `Recommended` | Experimental | -| [`http.route`](http.md) | string | The matched route (path template). | `/users/:userID?` | `Recommended` | Experimental | -| `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | See below | Experimental | -| `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | `Recommended` | Experimental | -| `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | See below | Experimental | -| `http.url` | string | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. | `https://www.foo.bar/search?q=OpenTelemetry#SemConv` | See below | Experimental | -| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | `Recommended` | Experimental | - -**[1]:** http.url is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. - -**[2]:** This should be obtained via configuration. If this attribute can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). - -**[3]:** This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. - -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `http.url` -* `http.scheme`, `http.host`, `http.target` -* `http.scheme`, [`http.server_name`](http.md), `net.host.port`, `http.target` -* `http.scheme`, `net.host.name`, `net.host.port`, `http.target` `faas.trigger` MUST be one of the following: diff --git a/semantic-conventions/src/tests/data/markdown/parameter_full/faas.yaml b/semantic-conventions/src/tests/data/markdown/parameter_full/faas.yaml index 4064b531..e10fb373 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_full/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_full/faas.yaml @@ -44,5 +44,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server diff --git a/semantic-conventions/src/tests/data/markdown/parameter_full/http.yaml b/semantic-conventions/src/tests/data/markdown/parameter_full/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_full/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_full/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/parameter_remove_constraint/database.yaml b/semantic-conventions/src/tests/data/markdown/parameter_remove_constraint/database.yaml index 8972e112..c493c26c 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_remove_constraint/database.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_remove_constraint/database.yaml @@ -258,11 +258,6 @@ groups: tag: connection-level - ref: net.peer.port tag: connection-level - - constraints: - - any_of: - - 'net.peer.name' - - 'net.peer.ip' - id: db.cassandra type: span prefix: db.cassandra diff --git a/semantic-conventions/src/tests/data/markdown/parameter_tag/database.yaml b/semantic-conventions/src/tests/data/markdown/parameter_tag/database.yaml index 2ff73e47..5fc16f22 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_tag/database.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_tag/database.yaml @@ -258,11 +258,6 @@ groups: tag: connection-level - ref: net.peer.port tag: connection-level - - constraints: - - any_of: - - 'net.peer.name' - - 'net.peer.ip' - id: db.cassandra type: span prefix: db.cassandra diff --git a/semantic-conventions/src/tests/data/markdown/parameter_tag/expected.md b/semantic-conventions/src/tests/data/markdown/parameter_tag/expected.md index f79bb0e4..88841428 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_tag/expected.md +++ b/semantic-conventions/src/tests/data/markdown/parameter_tag/expected.md @@ -6,17 +6,12 @@ | `db.type` | string | Database type. For any SQL database, "sql". For others, the lower-case database category. | `sql` | `Required` | Experimental | | `db.connection_string` | string | The connection string used to connect to the database. [1] | `Server=(localdb)\v11.0;Integrated Security=true;` | `Recommended` | Experimental | | `db.user` | string | Username for accessing the database. | `readonly_user`; `reporting_user` | `Recommended` | Experimental | -| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | See below | Experimental | -| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | See below | Experimental | +| `net.peer.ip` | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | `Recommended` | Experimental | +| `net.peer.name` | string | Remote hostname or similar, see note below. | `example.com` | `Recommended` | Experimental | | `net.peer.port` | int | Remote port number. | `80`; `8080`; `443` | `Recommended` | Experimental | **[1]:** It is recommended to remove embedded credentials. -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `net.peer.name` -* `net.peer.ip` - `db.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | Value | Description | Stability | diff --git a/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/database.yaml b/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/database.yaml index 356b7a74..19156a56 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/database.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/database.yaml @@ -258,10 +258,6 @@ groups: tag: connection-level - ref: net.peer.port tag: connection-level - constraints: - - any_of: - - 'net.peer.name' - - 'net.peer.ip' - id: db.cassandra type: span prefix: db.cassandra diff --git a/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/expected.md b/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/expected.md index 05445f02..a64cebac 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/expected.md +++ b/semantic-conventions/src/tests/data/markdown/parameter_tag_empty/expected.md @@ -18,11 +18,6 @@ **[4]:** If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* `net.peer.name` -* `net.peer.ip` - `db.dbms` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | Value | Description | Stability | diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong/faas.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong/faas.yaml index 648eb26e..38c3599f 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong/faas.yaml @@ -39,5 +39,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong/http.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/faas.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/faas.yaml index 0fb1cad4..5eb70538 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/faas.yaml @@ -39,5 +39,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/http.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong_duplicate/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/faas.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/faas.yaml index 0fb1cad4..b289c907 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/faas.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/faas.yaml @@ -17,17 +17,22 @@ groups: - id: datasource value: 'datasource' brief: 'A response to some data source operation such as a database or filesystem read/write.' + stability: experimental - id: http value: 'http' brief: 'To provide an answer to an inbound HTTP request' + stability: experimental - id: pubsub value: 'pubsub' brief: 'A function is set to be executed when messages are sent to a messaging system.' + stability: experimental - id: timer value: 'timer' brief: 'A function is scheduled to be executed regularly.' + stability: experimental - id: other value: 'other' + stability: experimental - id: execution stability: experimental type: string @@ -39,5 +44,4 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server + diff --git a/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/http.yaml b/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/parameter_wrong_syntax/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/ref/expected.md b/semantic-conventions/src/tests/data/markdown/ref/expected.md index 145d9267..86045406 100644 --- a/semantic-conventions/src/tests/data/markdown/ref/expected.md +++ b/semantic-conventions/src/tests/data/markdown/ref/expected.md @@ -10,9 +10,4 @@ | [`net.peer.name`](input_general.md) | string | override brief. [1] | `example.com` | `Opt-In` | Experimental | **[1]:** override note. - -**Additional attribute requirements:** At least one of the following sets of attributes is required: - -* [`net.peer.ip`](input_general.md) -* [`net.peer.name`](input_general.md), [`net.peer.ip`](input_general.md) diff --git a/semantic-conventions/src/tests/data/markdown/ref/http.yaml b/semantic-conventions/src/tests/data/markdown/ref/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/ref/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/ref/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/ref/rpc.yaml b/semantic-conventions/src/tests/data/markdown/ref/rpc.yaml index a41dc390..ed399396 100644 --- a/semantic-conventions/src/tests/data/markdown/ref/rpc.yaml +++ b/semantic-conventions/src/tests/data/markdown/ref/rpc.yaml @@ -10,10 +10,6 @@ groups: requirement_level: required brief: 'The service name, must be equal to the $service part in the span name.' examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - [net.peer.name, net.peer.ip] - id: grpc.client type: span extends: rpc diff --git a/semantic-conventions/src/tests/data/markdown/sampling_relevant/http.yaml b/semantic-conventions/src/tests/data/markdown/sampling_relevant/http.yaml index 808799dd..2e606921 100644 --- a/semantic-conventions/src/tests/data/markdown/sampling_relevant/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/sampling_relevant/http.yaml @@ -54,6 +54,4 @@ groups: - ref: net.peer.ip sampling_relevant: true - ref: net.peer.port - sampling_relevant: true - constraints: - - include: network \ No newline at end of file + sampling_relevant: true \ No newline at end of file diff --git a/semantic-conventions/src/tests/data/markdown/single/http.yaml b/semantic-conventions/src/tests/data/markdown/single/http.yaml index f3fbdb4b..d0c22a6b 100644 --- a/semantic-conventions/src/tests/data/markdown/single/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/single/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/markdown/wrong_semconv_id/http.yaml b/semantic-conventions/src/tests/data/markdown/wrong_semconv_id/http.yaml index 11802496..3e874665 100644 --- a/semantic-conventions/src/tests/data/markdown/wrong_semconv_id/http.yaml +++ b/semantic-conventions/src/tests/data/markdown/wrong_semconv_id/http.yaml @@ -63,12 +63,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server prefix: http type: span @@ -107,9 +101,3 @@ groups: note: > This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. examples: '83.164.160.102' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/yaml/database.yaml b/semantic-conventions/src/tests/data/yaml/database.yaml index 31e7119f..8ff92251 100644 --- a/semantic-conventions/src/tests/data/yaml/database.yaml +++ b/semantic-conventions/src/tests/data/yaml/database.yaml @@ -43,7 +43,3 @@ groups: type: string brief: 'Username for accessing database.' examples: ['readonly_user','reporting_user'] - constraints: - - any_of: - - 'net.peer.name' - - 'net.peer.ip' \ No newline at end of file diff --git a/semantic-conventions/src/tests/data/yaml/errors/invalid_type.yaml b/semantic-conventions/src/tests/data/yaml/errors/invalid_type.yaml index 1e7a8f94..36a5a66b 100644 --- a/semantic-conventions/src/tests/data/yaml/errors/invalid_type.yaml +++ b/semantic-conventions/src/tests/data/yaml/errors/invalid_type.yaml @@ -10,10 +10,6 @@ groups: requirement_level: required brief: 'The service name, must be equal to the $service part in the span name.' examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - net.peer.name - id: grpc.client type: span extends: rpc diff --git a/semantic-conventions/src/tests/data/yaml/errors/multi_value_cnstr.yaml b/semantic-conventions/src/tests/data/yaml/errors/multi_value_cnstr.yaml index 099d408f..2fbbcace 100644 --- a/semantic-conventions/src/tests/data/yaml/errors/multi_value_cnstr.yaml +++ b/semantic-conventions/src/tests/data/yaml/errors/multi_value_cnstr.yaml @@ -5,7 +5,3 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server - any_of: ['asd'] - - any_of: ['asd','asd'] diff --git a/semantic-conventions/src/tests/data/yaml/errors/resource_spankind.yaml b/semantic-conventions/src/tests/data/yaml/errors/resource_spankind.yaml index dd46b48a..0dab3c6e 100644 --- a/semantic-conventions/src/tests/data/yaml/errors/resource_spankind.yaml +++ b/semantic-conventions/src/tests/data/yaml/errors/resource_spankind.yaml @@ -11,10 +11,6 @@ groups: requirement_level: required brief: 'The service name, must be equal to the $service part in the span name.' examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - net.peer.name - id: grpc.client type: span extends: rpc diff --git a/semantic-conventions/src/tests/data/yaml/errors/validate_anyof.yaml b/semantic-conventions/src/tests/data/yaml/errors/validate_anyof.yaml deleted file mode 100644 index 0ba2fb52..00000000 --- a/semantic-conventions/src/tests/data/yaml/errors/validate_anyof.yaml +++ /dev/null @@ -1,17 +0,0 @@ -groups: - - id: messaging - brief: error - prefix: messaging - attributes: - - id: node_version - requirement_level: - conditionally_required: See below. - type: string - brief: The version of the Node.js runtime. - examples: [ '10.19.0' ] - stability: experimental - constraints: - - any_of: - - 'messaging.node_version' - - 'foo' - - 'bar' diff --git a/semantic-conventions/src/tests/data/yaml/errors/wrong_cnstr.yaml b/semantic-conventions/src/tests/data/yaml/errors/wrong_cnstr.yaml deleted file mode 100644 index 7f3d39db..00000000 --- a/semantic-conventions/src/tests/data/yaml/errors/wrong_cnstr.yaml +++ /dev/null @@ -1,11 +0,0 @@ -groups: - - id: faas.http - type: span - extends: faas - brief: > - Semantic Convention for FaaS triggered as a response to some data - source operation such as a database or filesystem read/write. - constraints: - - include: http.server - - myNewCnst: ['asd'] - - any_of: ['asd','asd'] diff --git a/semantic-conventions/src/tests/data/yaml/event.yaml b/semantic-conventions/src/tests/data/yaml/event.yaml index 38be388f..3ef4710c 100644 --- a/semantic-conventions/src/tests/data/yaml/event.yaml +++ b/semantic-conventions/src/tests/data/yaml/event.yaml @@ -34,10 +34,6 @@ groups: it is known that the exception is escaping the scope of the span. note: |- An exception is considered to have escaped. - constraints: - - any_of: - - "exception.type" - - "exception.message" - id: experimental_event type: event prefix: experimental_event diff --git a/semantic-conventions/src/tests/data/yaml/faas.yaml b/semantic-conventions/src/tests/data/yaml/faas.yaml index 9dbe4721..190fe31a 100644 --- a/semantic-conventions/src/tests/data/yaml/faas.yaml +++ b/semantic-conventions/src/tests/data/yaml/faas.yaml @@ -94,8 +94,6 @@ groups: brief: > Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. - constraints: - - include: http.server - id: faas.pubsub type: span extends: faas diff --git a/semantic-conventions/src/tests/data/yaml/http.yaml b/semantic-conventions/src/tests/data/yaml/http.yaml index b1c9703f..f3ea896e 100644 --- a/semantic-conventions/src/tests/data/yaml/http.yaml +++ b/semantic-conventions/src/tests/data/yaml/http.yaml @@ -93,12 +93,6 @@ groups: extends: http span_kind: client brief: 'Semantic Convention for HTTP Client' - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, net.peer.name, net.peer.port, http.target] - - [http.scheme, net.peer.ip, net.peer.port, http.target] - id: http.server type: span prefix: http @@ -121,9 +115,3 @@ groups: sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. examples: ['example.com'] - constraints: - - any_of: - - [http.url] - - [http.scheme, http.host, http.target] - - [http.scheme, http.server_name, net.host.port, http.target] - - [http.scheme, net.host.name, net.host.port, http.target] diff --git a/semantic-conventions/src/tests/data/yaml/imported-inherited.yaml b/semantic-conventions/src/tests/data/yaml/imported-inherited.yaml index 92e4cc09..1c702a69 100644 --- a/semantic-conventions/src/tests/data/yaml/imported-inherited.yaml +++ b/semantic-conventions/src/tests/data/yaml/imported-inherited.yaml @@ -11,11 +11,6 @@ groups: requirement_level: required brief: 'The service name, must be equal to the $service part in the span name.' examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - net.peer.name - - include: network - id: network type: span @@ -56,8 +51,6 @@ groups: requirement_level: required brief: 'Name' examples: 'name' - constraints: - - include: http - id: http type: span @@ -96,5 +89,3 @@ groups: requirement_level: required brief: 'zz attr' examples: 'name' - constraints: - - include: zother \ No newline at end of file diff --git a/semantic-conventions/src/tests/data/yaml/rpc.yaml b/semantic-conventions/src/tests/data/yaml/rpc.yaml index cc457595..e0abe9c5 100644 --- a/semantic-conventions/src/tests/data/yaml/rpc.yaml +++ b/semantic-conventions/src/tests/data/yaml/rpc.yaml @@ -10,10 +10,6 @@ groups: requirement_level: required brief: 'The service name, must be equal to the $service part in the span name.' examples: "EchoService" - constraints: - - any_of: - - net.peer.ip - - net.peer.name - id: grpc.client type: span extends: rpc diff --git a/semantic-conventions/src/tests/semconv/model/test_correct_parse.py b/semantic-conventions/src/tests/semconv/model/test_correct_parse.py index 3cc6d473..1c4a4931 100644 --- a/semantic-conventions/src/tests/semconv/model/test_correct_parse.py +++ b/semantic-conventions/src/tests/semconv/model/test_correct_parse.py @@ -16,7 +16,6 @@ import unittest from typing import List, cast -from opentelemetry.semconv.model.constraints import AnyOf, Include from opentelemetry.semconv.model.semantic_attribute import StabilityLevel from opentelemetry.semconv.model.semantic_convention import ( EventSemanticConvention, @@ -37,7 +36,6 @@ def test_numeric_attributes(self): "id": "test", "prefix": "test", "extends": "", - "n_constraints": 0, "attributes": ["test.one", "test.two"], } self.semantic_convention_check(list(semconv.models.values())[0], expected) @@ -63,7 +61,6 @@ def test_database(self): "id": "database", "prefix": "db", "extends": "", - "n_constraints": 1, "attributes": [ "db.instance", "db.statement", @@ -83,7 +80,6 @@ def test_faas(self): "id": "faas", "prefix": "faas", "extends": "", - "n_constraints": 0, "attributes": ["faas.trigger", "faas.execution"], } self.semantic_convention_check(list(semconv.models.values())[0], expected) @@ -91,7 +87,6 @@ def test_faas(self): "id": "faas.datasource", "prefix": "faas.document", "extends": "faas", - "n_constraints": 0, "attributes": [ "faas.document.collection", "faas.document.operation", @@ -104,7 +99,6 @@ def test_faas(self): "id": "faas.http", "prefix": "", "extends": "faas", - "n_constraints": 1, "attributes": [], } self.semantic_convention_check(list(semconv.models.values())[2], expected) @@ -112,7 +106,6 @@ def test_faas(self): "id": "faas.pubsub", "prefix": "", "extends": "faas", - "n_constraints": 0, "attributes": [], } self.semantic_convention_check(list(semconv.models.values())[3], expected) @@ -120,7 +113,6 @@ def test_faas(self): "id": "faas.timer", "prefix": "faas", "extends": "faas", - "n_constraints": 0, "attributes": ["faas.time", "faas.cron"], } self.semantic_convention_check(list(semconv.models.values())[4], expected) @@ -134,7 +126,6 @@ def test_general(self): "id": "network", "prefix": "net", "extends": "", - "n_constraints": 0, "attributes": [ "net.host.ip", "net.host.name", @@ -150,7 +141,6 @@ def test_general(self): "id": "identity", "prefix": "enduser", "extends": "", - "n_constraints": 0, "attributes": ["enduser.id", "enduser.role", "enduser.scope"], } self.semantic_convention_check(list(semconv.models.values())[1], expected) @@ -164,7 +154,6 @@ def test_http(self): "id": "http", "prefix": "http", "extends": "", - "n_constraints": 0, "attributes": [ "http.method", "http.status_code", @@ -182,7 +171,6 @@ def test_http(self): "id": "http.client", "prefix": "http", "extends": "http", - "n_constraints": 1, "attributes": [], } self.semantic_convention_check(list(semconv.models.values())[1], expected) @@ -190,7 +178,6 @@ def test_http(self): "id": "http.server", "prefix": "http", "extends": "http", - "n_constraints": 1, "attributes": ["http.server_name"], } self.semantic_convention_check(list(semconv.models.values())[2], expected) @@ -210,7 +197,6 @@ def test_metrics(self): "id": "metric.foo", "prefix": "bar", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.EXPERIMENTAL, "attributes": ["bar.egg.type"], } @@ -220,7 +206,6 @@ def test_metrics(self): "id": "metric.foo.size", "prefix": "foo", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.STABLE, "metric_name": "foo.size", "unit": "{bars}", @@ -239,7 +224,6 @@ def test_metrics(self): "id": "metric.foo.active_eggs", "prefix": "foo", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.EXPERIMENTAL, "metric_name": "foo.active_eggs", "unit": "{cartons}", @@ -264,7 +248,6 @@ def test_resource(self): "id": "cloud", "prefix": "cloud", "extends": "", - "n_constraints": 0, "attributes": [ "cloud.account.id", "cloud.provider", @@ -284,7 +267,6 @@ def test_event(self): "id": "exception", "prefix": "exception", "extends": "", - "n_constraints": 1, "attributes": [ "exception.escaped", "exception.message", @@ -293,22 +275,12 @@ def test_event(self): ], } self.semantic_convention_check(event, expected) - constraint = event.constraints[0] - self.assertIsInstance(constraint, AnyOf) - constraint: AnyOf - for choice_index, attr_list in enumerate(constraint.choice_list_ids): - for attr_index, attr in enumerate(attr_list): - self.assertEqual( - event.attrs_by_name.get(attr), - constraint.choice_list_attributes[choice_index][attr_index], - ) experimental_event = list(semconv.models.values())[1] expected = { "id": "experimental_event", "prefix": "experimental_event", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.EXPERIMENTAL, "attributes": [ "experimental_event.foo", @@ -321,7 +293,6 @@ def test_event(self): "id": "stable_event", "prefix": "stable_event", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.STABLE, "attributes": [], } @@ -332,7 +303,6 @@ def test_event(self): "id": "deprecated_event", "prefix": "deprecated_event", "extends": "", - "n_constraints": 0, "stability": StabilityLevel.STABLE, "deprecated": "Removed.", "attributes": [], @@ -368,7 +338,6 @@ def test_rpc(self): "id": "rpc", "prefix": "rpc", "extends": "", - "n_constraints": 1, "attributes": ["rpc.service"], } self.semantic_convention_check(list(semconv.models.values())[0], expected) @@ -376,7 +345,6 @@ def test_rpc(self): "id": "grpc.client", "prefix": "", "extends": "rpc", - "n_constraints": 0, "attributes": ["net.peer.port"], } self.semantic_convention_check(list(semconv.models.values())[1], expected) @@ -384,7 +352,6 @@ def test_rpc(self): "id": "grpc.server", "prefix": "", "extends": "rpc", - "n_constraints": 0, "attributes": ["net.peer.port"], } self.semantic_convention_check(list(semconv.models.values())[2], expected) @@ -427,7 +394,6 @@ def test_extends(self): "id": "http", "prefix": "http", "extends": "", - "n_constraints": 0, "attributes": [ "http.method", "http.status_code", @@ -445,7 +411,6 @@ def test_extends(self): "id": "http.client", "prefix": "http", "extends": "http", - "n_constraints": 1, "attributes": [ "http.method", "http.status_code", @@ -463,7 +428,6 @@ def test_extends(self): "id": "http.server", "prefix": "http", "extends": "http", - "n_constraints": 1, "attributes": [ "http.method", "http.server_name", @@ -479,39 +443,6 @@ def test_extends(self): } self.semantic_convention_check(list(semconv.models.values())[2], expected) - def test_include(self): - semconv = SemanticConventionSet(debug=False) - semconv.parse(self.load_file("yaml/http.yaml")) - semconv.parse(self.load_file("yaml/faas.yaml")) - semconv.parse(self.load_file("yaml/general.yaml")) - semconv.finish() - self.assertEqual(len(semconv.models), 10) - - faas_http = [s for s in semconv.models.values() if s.semconv_id == "faas.http"][ - 0 - ] - expected = { - "id": "faas.http", - "prefix": "faas", - "extends": "faas", - "n_constraints": 2, - "attributes": [ - "faas.trigger", # Parent - "http.method", - "http.server_name", - "http.status_code", - "faas.execution", # Parent - "http.flavor", - "http.host", - "http.scheme", - "http.status_text", - "http.target", - "http.url", - "http.user_agent", - ], - } - self.semantic_convention_check(faas_http, expected) - def test_deprecation(self): semconv = SemanticConventionSet(debug=False) semconv.parse(self.load_file("yaml/deprecated/http.yaml")) @@ -598,25 +529,6 @@ def test_populate_other_attributes(self): semconv.finish() models = sorted(semconv.models.values(), key=lambda m: m.semconv_id) self.assertEqual(len(models), 10) - self.assertEqual(len(models[0].constraints), 0) - self.assertEqual(len(models[1].constraints), 0) - - self.assertEqual(len(models[2].constraints), 2) - self.assertTrue(isinstance(models[2].constraints[0], Include)) - self.assertEqual(len(models[2].constraints[1].choice_list_attributes), 4) - - self.assertEqual(len(models[3].constraints), 0) - self.assertEqual(len(models[4].constraints), 0) - self.assertEqual(len(models[5].constraints), 0) - - self.assertEqual(len(models[6].constraints), 1) - self.assertEqual(len(models[6].constraints[0].choice_list_attributes), 4) - - self.assertEqual(len(models[7].constraints), 1) - self.assertEqual(len(models[6].constraints[0].choice_list_attributes), 4) - - self.assertEqual(len(models[8].constraints), 0) - self.assertEqual(len(models[9].constraints), 0) def test_inherited_imported(self): semconv = SemanticConventionSet(debug=False) @@ -663,33 +575,17 @@ def test_inherited_imported(self): # Base - rpc attrs = models[2].attributes_and_templates self.assertEqual(models[2].semconv_id, "rpc") - self.assertEqual(len(attrs), 4) + self.assertEqual(len(attrs), 1) self.assertEqual(attrs[0].fqn, "rpc.service") self.assertEqual(attrs[0].imported, False) self.assertEqual(attrs[0].inherited, False) self.assertEqual(attrs[0].ref, None) - self.assertEqual(attrs[1].fqn, "net.peer.ip") - self.assertEqual(attrs[1].imported, True) - self.assertEqual(attrs[1].inherited, False) - self.assertEqual(attrs[1].ref, None) - - self.assertEqual(attrs[2].fqn, "net.peer.name") - self.assertEqual(attrs[2].imported, True) - self.assertEqual(attrs[2].inherited, False) - self.assertEqual(attrs[2].ref, None) - - self.assertEqual(attrs[3].fqn, "net.peer.port") - self.assertEqual(attrs[3].imported, True) - self.assertEqual(attrs[3].inherited, False) - self.assertEqual(attrs[3].ref, None) - self.assertEqual(attrs[3].note, "not override") - # Extended - rpc.client attrs = models[3].attributes_and_templates self.assertEqual(models[3].semconv_id, "rpc.client") - self.assertEqual(len(attrs), 6) + self.assertEqual(len(attrs), 3) self.assertEqual(attrs[0].fqn, "net.peer.port") self.assertEqual(attrs[0].imported, False) @@ -708,21 +604,6 @@ def test_inherited_imported(self): self.assertEqual(attrs[2].inherited, True) self.assertEqual(attrs[2].ref, None) - self.assertEqual(attrs[3].fqn, "http.method") - self.assertEqual(attrs[3].imported, True) - self.assertEqual(attrs[3].inherited, False) - self.assertEqual(attrs[3].ref, None) - - self.assertEqual(attrs[4].fqn, "net.peer.ip") - self.assertEqual(attrs[4].imported, True) - self.assertEqual(attrs[4].inherited, True) - self.assertEqual(attrs[4].ref, None) - - self.assertEqual(attrs[5].fqn, "net.peer.name") - self.assertEqual(attrs[5].imported, True) - self.assertEqual(attrs[5].inherited, True) - self.assertEqual(attrs[5].ref, None) - # Include on Extended - zother attrs = models[4].attributes_and_templates self.assertEqual(models[4].semconv_id, "zother") @@ -736,7 +617,7 @@ def test_inherited_imported(self): # Include on Extended - zz.rpc.client attrs = models[5].attributes_and_templates self.assertEqual(models[5].semconv_id, "zz.rpc.client") - self.assertEqual(len(attrs), 8) + self.assertEqual(len(attrs), 4) self.assertEqual(attrs[0].fqn, "net.peer.port") self.assertEqual(attrs[0].imported, False) @@ -760,26 +641,6 @@ def test_inherited_imported(self): self.assertEqual(attrs[3].inherited, True) self.assertEqual(attrs[3].ref, None) - self.assertEqual(attrs[4].fqn, "http.method") - self.assertEqual(attrs[4].imported, True) - self.assertEqual(attrs[4].inherited, True) - self.assertEqual(attrs[4].ref, None) - - self.assertEqual(attrs[5].fqn, "net.peer.ip") - self.assertEqual(attrs[5].imported, True) - self.assertEqual(attrs[5].inherited, True) - self.assertEqual(attrs[5].ref, None) - - self.assertEqual(attrs[6].fqn, "net.peer.name") - self.assertEqual(attrs[6].imported, True) - self.assertEqual(attrs[6].inherited, True) - self.assertEqual(attrs[6].ref, None) - - self.assertEqual(attrs[7].fqn, "zother.hostname") - self.assertEqual(attrs[7].imported, True) - self.assertEqual(attrs[7].inherited, False) - self.assertEqual(attrs[7].ref, None) - def semantic_convention_check(self, s, expected): self.assertEqual(expected["prefix"], s.prefix) self.assertEqual(expected.get("stability"), s.stability) @@ -787,7 +648,6 @@ def semantic_convention_check(self, s, expected): self.assertEqual(expected["extends"], s.extends) self.assertEqual(expected["id"], s.semconv_id) self.assertEqual(len(expected["attributes"]), len(s.attributes)) - self.assertEqual(expected["n_constraints"], len(s.constraints)) self.assertEqual(expected["attributes"], [a.fqn for a in s.attributes]) _TEST_DIR = os.path.dirname(__file__) diff --git a/semantic-conventions/src/tests/semconv/model/test_error_detection.py b/semantic-conventions/src/tests/semconv/model/test_error_detection.py index a6225b73..e2835054 100644 --- a/semantic-conventions/src/tests/semconv/model/test_error_detection.py +++ b/semantic-conventions/src/tests/semconv/model/test_error_detection.py @@ -93,17 +93,6 @@ def test_missing_semconv_id(self): self.assertIn("id", msg) self.assertEqual(e.line, 2) - def test_top_level_keys_constraint(self): - with self.assertRaises(ValidationError) as ex: - self.open_yaml("yaml/errors/multi_value_cnstr.yaml") - self.fail() - e = ex.exception - msg = e.message.lower() - self.assertIn( - "invalid entry in constraint array - multiple top-level keys", msg - ) - self.assertEqual(e.line, 10) - def test_no_id_ref(self): with self.assertRaises(ValidationError) as ex: self.open_yaml("yaml/errors/no_attr_id_ref.yaml") @@ -124,16 +113,6 @@ def test_no_override_type(self): self.assertIn("'test'", str(e)) self.assertEqual(e.line, 8) - def test_invalid_key_in_constraint(self): - with self.assertRaises(ValidationError) as ex: - self.open_yaml("yaml/errors/wrong_cnstr.yaml") - self.fail() - e = ex.exception - msg = e.message - self.assertIn("Invalid key", msg) - self.assertIn("myNewCnst", msg) - self.assertEqual(e.line, 10) - def test_invalid_stability(self): with self.assertRaises(ValidationError) as ex: self.open_yaml("yaml/errors/stability/wrong_stability_value.yaml") @@ -502,17 +481,6 @@ def test_fqn_clash(self): semconv.finish() self.assertTrue(semconv.errors) - def test_validate_anyof_attributes(self): - with self.assertRaises(ValidationError) as ex: - semconv = SemanticConventionSet(debug=False) - semconv.parse(self.load_file("yaml/errors/validate_anyof.yaml")) - semconv.finish() - e = ex.exception - msg = e.message.lower() - self.assertIn("any_of attribute", msg) - self.assertIn("does not exist", msg) - self.assertEqual(e.line, 16) - def test_missing_event(self): with self.assertRaises(ValidationError) as ex: semconv = SemanticConventionSet(debug=False) diff --git a/semantic-conventions/src/tests/semconv/templating/test_markdown.py b/semantic-conventions/src/tests/semconv/templating/test_markdown.py index 895d6c0a..5d006535 100644 --- a/semantic-conventions/src/tests/semconv/templating/test_markdown.py +++ b/semantic-conventions/src/tests/semconv/templating/test_markdown.py @@ -31,9 +31,6 @@ def testRef(self): def testRefExtends(self): self.check("markdown/ref_extends/") - def testInclude(self): - self.check("markdown/include/") - def testDeprecated(self): self.check("markdown/deprecated/") @@ -71,9 +68,6 @@ def testMultipleEnum(self): def testEnumInt(self): self.check("markdown/enum_int/") - def testExtendConstraint(self): - self.check("markdown/extend_constraint/") - def test_extend_grandparent(self): self.check("markdown/extend_grandparent/") @@ -103,9 +97,6 @@ def test_parameter_tag_no_attr(self): "No attributes retained for 'db' filtering by 'wrong'", ex.args[0] ) - def test_parameter_remove_constraint(self): - self.check("markdown/parameter_remove_constraint/") - def test_parameter_empty(self): self.check("markdown/parameter_empty/") diff --git a/semantic-conventions/syntax.md b/semantic-conventions/syntax.md index 86c05a82..15cdeb9b 100644 --- a/semantic-conventions/syntax.md +++ b/semantic-conventions/syntax.md @@ -22,9 +22,6 @@ Then, the semantic of each field is described. - [Examples (for examples)](#examples-for-examples) - [Ref](#ref) - [Type](#type) - - [Constraints](#constraints) - - [Any Of](#any-of) - - [Include](#include) @@ -43,7 +40,7 @@ All attributes are lower case. groups ::= semconv | semconv groups -semconv ::= id [convtype] brief [note] [prefix] [extends] [stability] [deprecated] attributes [constraints] [specificfields] +semconv ::= id [convtype] brief [note] [prefix] [extends] [stability] [deprecated] attributes [specificfields] id ::= string @@ -102,11 +99,6 @@ sampling_relevant ::= boolean examples ::= {} -constraints ::= constraint {constraint} - -constraint ::= any_of - | include - any_of ::= id {id} include ::= id @@ -156,11 +148,10 @@ The field `semconv` represents a semantic convention and it is made by: - `prefix`, optional string, prefix for the attributes for this semantic convention. It defaults to an empty string. - `extends`, optional string, reference another semantic convention `id`. - It inherits the prefix, constraints, and all attributes defined in the specified semantic convention. + It inherits the prefix, and all attributes defined in the specified semantic convention. - `deprecated`, optional, when present marks the semantic convention as deprecated. The string provided as `` MUST specify why it's deprecated and/or what to use instead. - `attributes`, list of attributes that belong to the semantic convention. -- `constraints`, optional list, additional constraints (See later). It defaults to an empty list. #### Span semantic convention @@ -376,18 +367,3 @@ An enum entry has the following fields: - `note`, optional string, longer description. It defaults to an empty string. - `stability`, required stability level. Attributes marked as experimental cannot have stable members. - `deprecated`, optional string, similarly to semantic convention and attribute deprecation, marks specific member as deprecated. - -### Constraints - -Allow to define additional requirements on the semantic convention. -Currently, it supports `any_of` and `include`. - -#### Any Of - -`any_of` 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. - -#### Include - -`include` 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.