Skip to content

Commit 915725a

Browse files
Copilottrask
andcommitted
Exclude 'Uncategorized.' from deprecation messages in generated code
Co-authored-by: trask <218610+trask@users.noreply.github.com>
1 parent c1d4727 commit 915725a

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ public final class {{ my_class_name }} {
4343
{%- for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) | rejectattr("type", "eq", "any") -%}
4444
{%- if attribute is experimental -%}
4545
{%- if attribute is deprecated -%}
46-
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
46+
{%- if attribute.deprecated.note == "Uncategorized." -%}
47+
{%- set deprecated_javadoc = "@deprecated" -%}
48+
{%- else -%}
49+
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
50+
{%- endif -%}
4751
{%- else -%}
4852
{%- set deprecated_javadoc = "" -%}
4953
{%- endif -%}
@@ -80,7 +84,11 @@ public final class {{ my_class_name }} {
8084
* @deprecated deprecated in favor of stable {@link {{stable_class_link}}}.
8185
*/
8286
{%- elif attribute is deprecated -%}
83-
{{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }}
87+
{%- if attribute.deprecated.note == "Uncategorized." -%}
88+
{{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated"] | comment }}
89+
{%- else -%}
90+
{{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }}
91+
{%- endif -%}
8492
{%- else -%}
8593
/** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
8694
{%- endif -%}
@@ -90,7 +98,11 @@ public final class {{ my_class_name }} {
9098
public static final class {{ attribute.name | pascal_case }}IncubatingValues {
9199
{%- for member in attribute.type.members %}
92100
{%- if member is experimental and member is deprecated -%}
93-
{{ [member.brief or (member.id ~ '.'), "@deprecated " ~ member.deprecated.note] | comment }}
101+
{%- if member.deprecated.note == "Uncategorized." -%}
102+
{{ [member.brief or (member.id ~ '.'), "@deprecated"] | comment }}
103+
{%- else -%}
104+
{{ [member.brief or (member.id ~ '.'), "@deprecated " ~ member.deprecated.note] | comment }}
105+
{%- endif -%}
94106
@Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
95107
{% elif member is experimental or enum_deprecated_in_favor_of_stable.value %}
96108
{{ [member.brief or (member.id ~ '.')] | comment }}

buildscripts/templates/registry/java/SemanticAttributes.java.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public final class {{ my_class_name }} {
4141
{%- for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) -%}
4242
{%- if attribute is stable -%}
4343
{%- if attribute is deprecated -%}
44-
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
44+
{%- if attribute.deprecated.note == "Uncategorized." -%}
45+
{%- set deprecated_javadoc = "@deprecated" -%}
46+
{%- else -%}
47+
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
48+
{%- endif -%}
4549
{%- endif -%}
4650
{{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment }}
4751
{%- if attribute is deprecated -%}

semconv-incubating/src/main/java/io/opentelemetry/semconv/incubating/DbIncubatingAttributes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public final class DbIncubatingAttributes {
455455
/**
456456
* Deprecated, use {@code db.namespace} instead.
457457
*
458-
* @deprecated Uncategorized.
458+
* @deprecated
459459
*/
460460
@Deprecated
461461
public static final AttributeKey<Long> DB_REDIS_DATABASE_INDEX =

0 commit comments

Comments
 (0)