diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py index 36ea37acb4..3a6fadc7a4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py @@ -15,12 +15,17 @@ from enum import Enum +from deprecated import deprecated + ERROR_TYPE = "error.type" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ERROR_TYPE`. """ +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ErrorTypeValues`." +) class ErrorTypeValues(Enum): OTHER = "_OTHER" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ErrorTypeValues.OTHER`.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py index ca0c45792f..fdcb380e91 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py @@ -177,6 +177,9 @@ class HttpFlavorValues(Enum): """QUIC protocol.""" +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues`." +) class HttpRequestMethodValues(Enum): CONNECT = "CONNECT" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.CONNECT`.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py index 715e9b7892..aa12debcff 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py @@ -261,6 +261,9 @@ class NetworkIoDirectionValues(Enum): """receive.""" +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues`." +) class NetworkTransportValues(Enum): TCP = "tcp" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.TCP`.""" @@ -272,6 +275,9 @@ class NetworkTransportValues(Enum): """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.UNIX`.""" +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues`." +) class NetworkTypeValues(Enum): IPV4 = "ipv4" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues.IPV4`.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py index a7ed8ded27..e468ced532 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py @@ -15,6 +15,8 @@ from enum import Enum +from deprecated import deprecated + OTEL_LIBRARY_NAME = "otel.library.name" """ Deprecated: use the `otel.scope.name` attribute. @@ -46,6 +48,9 @@ """ +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues`." +) class OtelStatusCodeValues(Enum): OK = "OK" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues.OK`.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py index 013b2c8be0..80a07b5edd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py @@ -15,6 +15,8 @@ from enum import Enum +from deprecated import deprecated + TELEMETRY_DISTRO_NAME = "telemetry.distro.name" """ The name of the auto instrumentation agent or distribution, if used. @@ -43,6 +45,9 @@ """ +@deprecated( + reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues`." +) class TelemetrySdkLanguageValues(Enum): CPP = "cpp" """Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.CPP`.""" diff --git a/scripts/semconv/templates/registry/common.j2 b/scripts/semconv/templates/registry/common.j2 index e20aa7963b..4fb167db7e 100644 --- a/scripts/semconv/templates/registry/common.j2 +++ b/scripts/semconv/templates/registry/common.j2 @@ -32,7 +32,7 @@ {%- endmacro %} {%- macro import_deprecated(semconv) -%} - {%- if (semconv | rejectattr("deprecated", "none") | list | count > 0) or (filter == "any" and semconv | selectattr("stability", "equalto", "stable") | list | count > 0) %} + {%- if (semconv | rejectattr("deprecated", "none") | list | count > 0) or (ctx.filter == "any" and semconv | selectattr("stability", "equalto", "stable") | list | count > 0) %} from deprecated import deprecated {%- endif %} {%- endmacro-%} \ No newline at end of file diff --git a/scripts/semconv/templates/registry/semantic_attributes.j2 b/scripts/semconv/templates/registry/semantic_attributes.j2 index 7bf5c0f02a..3773e6b0f7 100644 --- a/scripts/semconv/templates/registry/semantic_attributes.j2 +++ b/scripts/semconv/templates/registry/semantic_attributes.j2 @@ -58,7 +58,7 @@ {% for attribute in enum_attributes %}{%- set class_name = c.to_class_name(attribute.name) ~ "Values" -%} {%- if c.str_or_empty(attribute.deprecated) | length %} @deprecated(reason="The attribute {{attribute.name}} is deprecated - {{ c.to_docstring(attribute.deprecated, "") }}") - {%- elif attribute.stability == "stable" and filter == "any" %} + {%- elif attribute.stability == "stable" and ctx.filter == "any" %} @deprecated(reason="Deprecated in favor of stable :py:const:`{{stable_class_ref(class_name, '.')}}`.") {%- endif %} class {{class_name}}(Enum):