From 76464b7da338e8a45e1a0b9bd22a051f18c1364d Mon Sep 17 00:00:00 2001 From: Maksym Ochenashko Date: Thu, 19 Dec 2024 09:51:26 +0200 Subject: [PATCH] semconv: regenerate models --- .../otel4s/metrics/SemanticMetrics.scala.j2 | 25 +- project/SemanticConventionsGenerator.scala | 2 +- .../AwsExperimentalAttributes.scala | 6 +- .../CicdExperimentalAttributes.scala | 8 +- .../CloudExperimentalAttributes.scala | 2 +- .../CloudfoundryExperimentalAttributes.scala | 2 +- .../attributes/DbExperimentalAttributes.scala | 103 ++- .../DeploymentExperimentalAttributes.scala | 2 +- .../ErrorExperimentalAttributes.scala | 2 +- .../FaasExperimentalAttributes.scala | 6 +- .../FeatureFlagExperimentalAttributes.scala | 81 +- .../GenAiExperimentalAttributes.scala | 32 +- .../K8sExperimentalAttributes.scala | 7 +- .../NetworkExperimentalAttributes.scala | 11 +- .../ProcessExperimentalAttributes.scala | 15 + .../ServiceExperimentalAttributes.scala | 2 +- .../TestExperimentalAttributes.scala | 4 +- .../UrlExperimentalAttributes.scala | 34 +- .../UserAgentExperimentalAttributes.scala | 25 + .../VcsExperimentalAttributes.scala | 201 ++++- .../ContainerExperimentalMetrics.scala | 81 +- .../metrics/DbExperimentalMetrics.scala | 727 ++++++++++++++++-- .../metrics/DnsExperimentalMetrics.scala | 4 +- .../metrics/FaasExperimentalMetrics.scala | 36 +- .../metrics/GenAiExperimentalMetrics.scala | 62 +- .../metrics/HttpExperimentalMetrics.scala | 125 ++- .../metrics/HwExperimentalMetrics.scala | 42 +- .../metrics/JvmExperimentalMetrics.scala | 22 +- .../metrics/K8sExperimentalMetrics.scala | 373 ++++++++- .../MessagingExperimentalMetrics.scala | 154 ++-- .../metrics/NodejsExperimentalMetrics.scala | 20 +- .../metrics/ProcessExperimentalMetrics.scala | 49 +- .../metrics/RpcExperimentalMetrics.scala | 20 +- .../metrics/SystemExperimentalMetrics.scala | 316 +++++--- .../metrics/V8jsExperimentalMetrics.scala | 20 +- .../typelevel/otel4s/semconv/Stability.scala | 4 +- .../otel4s/semconv/metrics/HttpMetrics.scala | 8 +- .../typelevel/otel4s/semconv/SchemaUrls.scala | 3 +- .../semconv/attributes/ErrorAttributes.scala | 2 +- .../attributes/NetworkAttributes.scala | 6 +- .../semconv/attributes/UrlAttributes.scala | 34 +- 41 files changed, 2135 insertions(+), 543 deletions(-) diff --git a/buildscripts/semantic-convention/templates/registry/otel4s/metrics/SemanticMetrics.scala.j2 b/buildscripts/semantic-convention/templates/registry/otel4s/metrics/SemanticMetrics.scala.j2 index e3e05ed2e..e8b24f6cd 100644 --- a/buildscripts/semantic-convention/templates/registry/otel4s/metrics/SemanticMetrics.scala.j2 +++ b/buildscripts/semantic-convention/templates/registry/otel4s/metrics/SemanticMetrics.scala.j2 @@ -57,7 +57,8 @@ {%- endmacro -%} {%- macro stability(type) -%} -{%- if type == "experimental" -%} Stability.experimental +{%- if type == "development" -%} Stability.development +{%- elif not type -%} Stability.development {%- elif type == "stable" -%} Stability.stable {%- else -%} _unknown_stability_type_{{ type }} {%- endif -%} @@ -68,7 +69,11 @@ {%- elif type == "double" -%} {{ input }} {%- elif type == "boolean" -%} {{ input }} {%- elif type == "string" -%} "{{ input }}" -{%- else -%} _unknown type_{{ input }} +{%- elif type == "int[]" -%} Seq({{ input | join(', ') }}) +{%- elif type == "double[]" -%} Seq({{ input | join(', ') }}) +{%- elif type == "boolean[]" -%} Seq({{ input | join(', ') }}) +{%- elif type == "string[]" -%} Seq({{ input | map('tojson') | join(', ') }}) +{%- else -%} _unknown type_{{ type }}_{{ input }} {%- endif -%} {% endmacro %} @@ -132,7 +137,7 @@ import org.typelevel.otel4s.metrics._ {%- if required_imports.stable == true %} import org.typelevel.otel4s.semconv.attributes._ {%- endif %} -{%- if required_imports.experimental == true %} +{%- if required_imports.experimental == true and params.experimental == true %} import org.typelevel.otel4s.semconv.experimental.attributes._ {%- endif %} @@ -161,16 +166,20 @@ object {{ object_name }} { @deprecated("Use stable `{{ stableRef(metric) }}` instead.", "") {%- endif %} object {{ objectName(metric) }} extends MetricSpec { - + {%- if params.experimental == true -%} + {%- set metric_attributes = metric.attributes %} + {% else %} + {%- set metric_attributes = metric.attributes | selectattr("stability", "equalto", "stable") | list %} + {% endif %} val name: String = "{{ metric.metric_name }}" val description: String = "{{ metric.brief }}" val unit: String = "{{ metric.unit }}" val stability: Stability = {{ stability(metric.stability) }} - val attributeSpecs: List[AttributeSpec[_]] = {% if metric.attributes | length > 0 %}AttributeSpecs.specs{% else %}Nil{% endif %} + val attributeSpecs: List[AttributeSpec[_]] = {% if metric_attributes | length > 0 %}AttributeSpecs.specs{% else %}Nil{% endif %} - {% if metric.attributes | length > 0 %} + {% if metric_attributes | length > 0 %} object AttributeSpecs { - {% for attribute in metric.attributes | sort(attribute='name') %} + {% for attribute in metric_attributes | sort(attribute='name') %} {{ [attribute.brief, concat_if("\n\n@note\n\n", attribute.note)] | comment(indent=6) | replace('$', "$$")}} {%- if attribute is deprecated %} @deprecated("{{ attribute.deprecated }}", "") @@ -186,7 +195,7 @@ object {{ object_name }} { ) {% endfor %} val specs: List[AttributeSpec[_]] = - List({%- for attribute in metric.attributes | sort(attribute='name') %} + List({%- for attribute in metric_attributes | sort(attribute='name') %} {{ attribute.name | camel_case }},{% endfor %} ) } diff --git a/project/SemanticConventionsGenerator.scala b/project/SemanticConventionsGenerator.scala index 5c01a6b8d..0aabfa894 100644 --- a/project/SemanticConventionsGenerator.scala +++ b/project/SemanticConventionsGenerator.scala @@ -3,7 +3,7 @@ import scala.sys.process._ object SemanticConventionsGenerator { - private val generatorVersion = "v0.9.1" + private val generatorVersion = "v0.12.0" // generates semantic conventions by using `otel/weaver` in docker def generate(version: String, rootDir: File): Unit = { diff --git a/semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/AwsExperimentalAttributes.scala b/semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/AwsExperimentalAttributes.scala index 868ecb010..fafb8c3d2 100644 --- a/semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/AwsExperimentalAttributes.scala +++ b/semconv/experimental/src/main/scala/org/typelevel/otel4s/semconv/experimental/attributes/AwsExperimentalAttributes.scala @@ -235,7 +235,7 @@ object AwsExperimentalAttributes { * @note *

The `copy_source` attribute applies to S3 copy operations and corresponds to the `--copy-source` parameter * of the copy-object operation - * within the S3 API. This applies in particular to the following operations: