From 46283affca4b582f0e6a126c331afdc7dc945e25 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 29 Mar 2024 20:42:40 -0700 Subject: [PATCH] lint --- .../semconv/model/semantic_convention.py | 1 - .../semconv/model/unit_member.py | 22 ------------------- .../metrics_template_trim_whitespace_enabled | 14 ++++++++++++ 3 files changed, 14 insertions(+), 23 deletions(-) delete mode 100644 semantic-conventions/src/opentelemetry/semconv/model/unit_member.py create mode 100644 semantic-conventions/src/tests/data/jinja/metrics/metrics_template_trim_whitespace_enabled diff --git a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py index 3a317be7..5df90ca5 100644 --- a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py +++ b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py @@ -27,7 +27,6 @@ RequirementLevel, SemanticAttribute, ) -from opentelemetry.semconv.model.unit_member import UnitMember from opentelemetry.semconv.model.utils import ( ValidatableYamlNode, ValidationContext, diff --git a/semantic-conventions/src/opentelemetry/semconv/model/unit_member.py b/semantic-conventions/src/opentelemetry/semconv/model/unit_member.py deleted file mode 100644 index 3068449b..00000000 --- a/semantic-conventions/src/opentelemetry/semconv/model/unit_member.py +++ /dev/null @@ -1,22 +0,0 @@ -from opentelemetry.semconv.model.utils import ValidatableYamlNode - - -class UnitMember(ValidatableYamlNode): - - allowed_keys = ("id", "brief", "value") - mandatory_keys = allowed_keys - - def __init__(self, node, validation_ctx): - super().__init__(node, validation_ctx) - self.value = node.get("value") - - @staticmethod - def parse(members, validation_ctx): - parsed_members = {} - for member in members: - UnitMember.validate_keys(member, validation_ctx) - unit_member = UnitMember(member, validation_ctx) - unit_member.validate_values() - parsed_members[unit_member.id] = unit_member - - return parsed_members diff --git a/semantic-conventions/src/tests/data/jinja/metrics/metrics_template_trim_whitespace_enabled b/semantic-conventions/src/tests/data/jinja/metrics/metrics_template_trim_whitespace_enabled new file mode 100644 index 00000000..7b751690 --- /dev/null +++ b/semantic-conventions/src/tests/data/jinja/metrics/metrics_template_trim_whitespace_enabled @@ -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 %} +}