Skip to content

Commit

Permalink
Merge branch 'main' into remove-constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova authored May 5, 2024
2 parents 075074e + 63502e6 commit d84afb9
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 319 deletions.
5 changes: 4 additions & 1 deletion semantic-conventions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Please update the changelog as part of any significant pull request.

## Unreleased

## 0.24.0
- BREAKING: Remove unused semantic convention types: `UnitSemanticConvention`, `MetricGroupSemanticConvention` and `ScopeSemanticConvention`
([#309](https://github.com/open-telemetry/build-tools/pull/309))

## v0.24.0

- BREAKING: Add `stability` (required) and `deprecated` (optional) properties to `EnumMember`
([#267](https://github.com/open-telemetry/build-tools/pull/267))
Expand Down
12 changes: 0 additions & 12 deletions semantic-conventions/semconv.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
"span",
"resource",
"metric",
"metric_group",
"event",
"scope",
"attribute_group"
],
"description": "The (signal) type of the semantic convention"
Expand Down Expand Up @@ -127,16 +125,6 @@
{"required": ["name"]}
]
},
"MetricGroupSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": ["type"],
"properties": {
"type": {
"type": "string",
"const": "metric_group"
}
}
},
"MetricSemanticConvention": {
"allOf": [{ "$ref": "#/definitions/SemanticConventionBase" }],
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
RequirementLevel,
SemanticAttribute,
)
from opentelemetry.semconv.model.unit_member import UnitMember
from opentelemetry.semconv.model.utils import (
ValidatableYamlNode,
ValidationContext,
Expand Down Expand Up @@ -185,10 +184,6 @@ class ResourceSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "resource"


class ScopeSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "scope"


class AttributeGroupConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "attribute_group"

Expand Down Expand Up @@ -226,26 +221,7 @@ def __init__(self, group, validation_ctx):
)


class UnitSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "units"

allowed_keys = ( # We completely override base semantic keys here.
"id",
"type",
"brief",
"members",
)

def __init__(self, group, validation_ctx):
super().__init__(group, validation_ctx)
self.members = UnitMember.parse(group.get("members"), validation_ctx)


class MetricGroupSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "metric_group"


class MetricSemanticConvention(MetricGroupSemanticConvention):
class MetricSemanticConvention(BaseSemanticConvention):
GROUP_TYPE_NAME = "metric"

allowed_keys: Tuple[str, ...] = BaseSemanticConvention.allowed_keys + (
Expand Down Expand Up @@ -514,10 +490,7 @@ def attribute_templates(self):
SpanSemanticConvention,
ResourceSemanticConvention,
EventSemanticConvention,
MetricGroupSemanticConvention,
MetricSemanticConvention,
UnitSemanticConvention,
ScopeSemanticConvention,
AttributeGroupConvention,
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
EventSemanticConvention,
MetricSemanticConvention,
SemanticConventionSet,
UnitSemanticConvention,
)
from opentelemetry.semconv.model.utils import ID_RE
from opentelemetry.semconv.templating.markdown.options import MarkdownOptions
Expand All @@ -55,7 +54,6 @@ def __init__(self):
self.group_key = ""
self.enums = []
self.notes = []
self.units = []
self.current_md = ""
self.current_semconv = None

Expand Down Expand Up @@ -277,17 +275,6 @@ def to_creation_time_attributes(
for attr in sampling_relevant_attrs:
output.write("* " + self.render_fqn_for_attribute(attr) + "\n")

@staticmethod
def to_markdown_unit_table(members, output: io.StringIO):
output.write("\n")
output.write(
"| Name | Kind of Quantity | Unit String |\n"
"| ------------| ---------------- | ----------- |"
)
for member in members.values():
output.write(f"\n| {member.id} | {member.brief} | `{member.value}` |")
output.write("\n")

def to_markdown_enum(self, output: io.StringIO):
"""Renders enum types after a Semantic Convention Table
:return:
Expand Down Expand Up @@ -490,9 +477,6 @@ def _render_group(self, semconv, parameters, output):

self.to_markdown_enum(output)

if isinstance(semconv, UnitSemanticConvention):
self.to_markdown_unit_table(semconv.members, output)

output.write("<!-- endsemconv -->")

def _render_stability(
Expand Down
23 changes: 0 additions & 23 deletions semantic-conventions/src/tests/data/jinja/metrics/expected.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package io.opentelemetry.instrumentation.api.metric;

class Units {

/**
* Use this unit for Metric Instruments recording values
* representing fraction of a total.
**/
public static final String PERCENT = "%";

class AllMetrics {
/**
* Use this unit for Metric Instruments recording values
* representing time.
**/
public static final String NANOSECOND = "NS";
* first metric description
* Unit: {one}
* Instrument: counter
* Experimental: False
*/
public static final String FIRST_METRIC = "first.metric";

/**
* Use this unit for Metric Instruments recording values
* representing connections.
**/
public static final String CONNECTIONS = "{connections}";
}
* second metric description
* Unit: s
* Instrument: histogram
* Experimental: True
*/
public static final String SECOND_GROUP_METRIC = "second_group.metric";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.opentelemetry.instrumentation.api.metric;

class AllMetrics {
{%- for metric in metrics %}

/**
* {{metric.brief | to_doc_brief}}
* Unit: {{ metric.unit }}
* Instrument: {{ metric.instrument }}
* Experimental: {{ metric | is_experimental }}
*/
public static final String {{ metric.metric_name | to_const_name }} = "{{metric.metric_name}}";
{% endfor %}
}
11 changes: 0 additions & 11 deletions semantic-conventions/src/tests/data/jinja/metrics/units_template

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions semantic-conventions/src/tests/data/markdown/scope/input.md

This file was deleted.

14 changes: 0 additions & 14 deletions semantic-conventions/src/tests/data/markdown/scope/scope.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion semantic-conventions/src/tests/data/yaml/metrics.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
groups:
- id: metric.foo
prefix: bar
type: metric_group
type: attribute_group
stability: experimental
brief: "This document defines foo."
note: >
Expand Down
14 changes: 0 additions & 14 deletions semantic-conventions/src/tests/data/yaml/metrics/units.yaml

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions semantic-conventions/src/tests/data/yaml/scope.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions semantic-conventions/src/tests/semconv/model/test_correct_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,23 +650,6 @@ def semantic_convention_check(self, s, expected):
self.assertEqual(len(expected["attributes"]), len(s.attributes))
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-id",
"prefix": "",
"type": "scope",
"extends": "",
"brief": "Instrumentation Scope attributes",
"attributes": [
"short_name",
],
}
self.semantic_convention_check(list(semconv.models.values())[0], expected)

_TEST_DIR = os.path.dirname(__file__)

def load_file(self, filename):
Expand Down
Loading

0 comments on commit d84afb9

Please sign in to comment.