-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathSemanticAttributes.java.j2
More file actions
72 lines (63 loc) · 3.09 KB
/
SemanticAttributes.java.j2
File metadata and controls
72 lines (63 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{%- macro to_java_key_type(attribute) -%}
{%- if attribute.type is template_type -%}
{{ attribute.type | instantiated_type | map_text("java_template_key_type") }}
{%- else -%}
{{ attribute.type | instantiated_type | map_text("java_key_type") }}
{%- endif %}
{%- endmacro %}
{%- macro to_java_key_factory(attribute) -%}
{%- if attribute.type is template_type -%}
{{ attribute.type | instantiated_type | map_text("java_template_key_factory") }}
{%- else -%}
{{ attribute.type | instantiated_type | map_text("java_key_factory") }}
{%- endif %}
{%- endmacro %}
{%- set my_class_name = ctx.root_namespace | pascal_case ~ "Attributes" -%}
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.semconv;
import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.api.common.AttributeKey.doubleKey;
import static io.opentelemetry.api.common.AttributeKey.longKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.api.common.AttributeKey.stringArrayKey;
import static io.opentelemetry.semconv.AttributeKeyTemplate.stringArrayKeyTemplate;
import static io.opentelemetry.semconv.AttributeKeyTemplate.stringKeyTemplate;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.semconv.AttributeKeyTemplate;
import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/java/SemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class {{ my_class_name }} {
{%- for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) -%}
{%- if attribute is stable -%}
{%- if attribute is deprecated -%}
{%- if attribute.deprecated.note == "Uncategorized." -%}
{%- set deprecated_javadoc = "@deprecated" -%}
{%- else -%}
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
{%- endif -%}
{%- endif -%}
{{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment }}
{%- if attribute is deprecated -%}
@Deprecated
{%- endif %} public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}");
{%- endif -%}
{%- endfor %}
{%- for attribute in ctx.attributes -%}
{%- if attribute is enum and attribute is stable %}
// Enum definition
/** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
public static final class {{ attribute.name | pascal_case }}Values {
{%- for member in attribute.type.members %}
{{ [member.brief or (member.id ~ '.')] | comment }}
public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
{%- endfor %}
private {{ attribute.name | pascal_case }}Values() {}
}
{%- endif -%}
{%- endfor %}
private {{ my_class_name }}() {}
}