-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathIncubatingSemanticMetrics.java.j2
More file actions
52 lines (49 loc) · 3.03 KB
/
Copy pathIncubatingSemanticMetrics.java.j2
File metadata and controls
52 lines (49 loc) · 3.03 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
{%- set my_class_name = ctx.root_namespace | pascal_case ~ "IncubatingMetrics" -%}
{%- set stable_class_name = ctx.root_namespace | pascal_case ~ "Metrics" -%}
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.semconv.incubating;
// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/incubating_java/IncubatingSemanticMetrics.java.j2
@SuppressWarnings("unused")
public final class {{ my_class_name }} {
{%- for metric in ctx.metrics -%}
{%- if metric is experimental -%}
{%- if metric is deprecated -%}
{%- if metric.deprecated.note == "Uncategorized." -%}
{%- set deprecated_javadoc = "@deprecated" -%}
{%- else -%}
{%- set deprecated_javadoc = "@deprecated " ~ metric.deprecated.note -%}
{%- endif -%}
{%- else -%}
{%- set deprecated_javadoc = "" -%}
{%- endif -%}
{{ ["Name of the {@code " ~ metric.metric_name ~ "} metric.", deprecated_javadoc] | comment }}
{%- if metric is deprecated -%}
@Deprecated
{% endif %}
public static final String {{ metric.metric_name | replace(".", "_") | screaming_snake_case }}_NAME = "{{ metric.metric_name }}";
{{ ["Unit of the {@code " ~ metric.metric_name ~ "} metric.", deprecated_javadoc] | comment }}
{%- if metric is deprecated -%}
@Deprecated
{% endif %}
public static final String {{ metric.metric_name | replace(".", "_") | screaming_snake_case }}_UNIT = "{{ metric.unit }}";
{{ ["Description of the {@code " ~ metric.metric_name ~ "} metric.", deprecated_javadoc] | comment }}
{%- if metric is deprecated -%}
@Deprecated
{% endif %}
public static final String {{ metric.metric_name | replace(".", "_") | screaming_snake_case }}_DESCRIPTION = "{{ metric.brief | replace('\n', ' ') | replace('"', '\\"') }}";
{%- elif metric is stable -%}
{%- set field_prefix = metric.metric_name | replace(".", "_") | screaming_snake_case -%}
{%- set stable_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "#" -%}
{{ ["Name of the {@code " ~ metric.metric_name ~ "} metric.", "@deprecated deprecated in favor of stable {@link " ~ stable_link ~ field_prefix ~ "_NAME} constant."] | comment }}
@Deprecated public static final String {{ field_prefix }}_NAME = "{{ metric.metric_name }}";
{{ ["Unit of the {@code " ~ metric.metric_name ~ "} metric.", "@deprecated deprecated in favor of stable {@link " ~ stable_link ~ field_prefix ~ "_UNIT} constant."] | comment }}
@Deprecated public static final String {{ field_prefix }}_UNIT = "{{ metric.unit }}";
{{ ["Description of the {@code " ~ metric.metric_name ~ "} metric.", "@deprecated deprecated in favor of stable {@link " ~ stable_link ~ field_prefix ~ "_DESCRIPTION} constant."] | comment }}
@Deprecated public static final String {{ field_prefix }}_DESCRIPTION = "{{ metric.brief | replace('\n', ' ') | replace('"', '\\"') }}";
{%- endif %}
{%- endfor %}
private {{ my_class_name }}() {}
}