diff --git a/semantic-conventions/src/tests/data/markdown/scope/expected.md b/semantic-conventions/src/tests/data/markdown/scope/expected.md new file mode 100644 index 00000000..f817c568 --- /dev/null +++ b/semantic-conventions/src/tests/data/markdown/scope/expected.md @@ -0,0 +1,7 @@ +# Instrumentation Scope Semantic Conventions + + +| Attribute | Type | Description | Examples | Requirement Level | +|---|---|---|---|---| +| `scope.short_name` | string | The single-word name for the instrumentation scope. | `mylibrary` | Recommended | + diff --git a/semantic-conventions/src/tests/data/markdown/scope/input.md b/semantic-conventions/src/tests/data/markdown/scope/input.md new file mode 100644 index 00000000..94120116 --- /dev/null +++ b/semantic-conventions/src/tests/data/markdown/scope/input.md @@ -0,0 +1,4 @@ +# Instrumentation Scope Semantic Conventions + + + diff --git a/semantic-conventions/src/tests/data/markdown/scope/scope.yaml b/semantic-conventions/src/tests/data/markdown/scope/scope.yaml new file mode 100644 index 00000000..85605e27 --- /dev/null +++ b/semantic-conventions/src/tests/data/markdown/scope/scope.yaml @@ -0,0 +1,12 @@ +groups: + - id: scope + prefix: scope + brief: > + Instrumentation Scope attributes + attributes: + - id: short_name + type: string + requirement_level: recommended + brief: > + The single-word name for the instrumentation scope. + examples: ['mylibrary'] \ No newline at end of file diff --git a/semantic-conventions/src/tests/data/yaml/scope.yaml b/semantic-conventions/src/tests/data/yaml/scope.yaml new file mode 100644 index 00000000..85605e27 --- /dev/null +++ b/semantic-conventions/src/tests/data/yaml/scope.yaml @@ -0,0 +1,12 @@ +groups: + - id: scope + prefix: scope + brief: > + Instrumentation Scope attributes + attributes: + - id: short_name + type: string + requirement_level: recommended + brief: > + The single-word name for the instrumentation scope. + examples: ['mylibrary'] \ No newline at end of file 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 bad3ed68..94ef0dd9 100644 --- a/semantic-conventions/src/tests/semconv/model/test_correct_parse.py +++ b/semantic-conventions/src/tests/semconv/model/test_correct_parse.py @@ -669,6 +669,23 @@ def semantic_convention_check(self, s, expected): self.assertEqual(expected["n_constraints"], len(s.constraints)) self.assertEqual(expected["attributes"], [a.fqn for a in s.attributes]) + def test_scope_attribute(self): + semconv = SemanticConventionSet(debug=False) + semconv.parse(self.load_file("yaml/scope.yaml")) + self.assertEqual(len(semconv.models), 1) + + expected = { + "id": "scope", + "prefix": "scope", + "extends": "", + "brief": "Instrumentation Scope attributes", + "n_constraints": 0, + "attributes": [ + "scope.short_name", + ], + } + self.semantic_convention_check(list(semconv.models.values())[0], expected) + _TEST_DIR = os.path.dirname(__file__) def load_file(self, filename): diff --git a/semantic-conventions/src/tests/semconv/templating/test_markdown.py b/semantic-conventions/src/tests/semconv/templating/test_markdown.py index 996fd043..e2d5cfe8 100644 --- a/semantic-conventions/src/tests/semconv/templating/test_markdown.py +++ b/semantic-conventions/src/tests/semconv/templating/test_markdown.py @@ -126,6 +126,9 @@ def test_event_renamed(self): def testSamplingRelevant(self): self.check("markdown/sampling_relevant/") + def testScope(self): + self.check("markdown/scope/") + def check( self, input_dir: str,