Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{%- set my_class_name = ctx.root_namespace | pascal_case ~ "IncubatingMetrics" -%}

/*
* 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 }} {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask's code in from #317 has additional logic to add deprecated javadoc tags which link to the stable class if available. This will be necessary once we enable enable generation of stable classes.

I pushed a commit which ports those changes to this branch: jack-berg@0ef14f8

Should probably just leave the code, but comment out the bit that makes the linking work with a TODO reminder to enable when generation of stable classes is enabled.

Speaking of which, given our experience with generating attribute constants, I'm much less worried about us getting the generation pattern wrong in some key way we'll regret. @trask / @laurit WDYT about just enabling generation of stable metrics out of the gate?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jack-berg — this is very helpful.
I can bring over the deprecated-javadoc logic from #317 as you suggested.
On the broader question of enabling stable metrics in this PR as well, I’m happy to follow whichever direction you all prefer. The stable path is already scaffolded, so I can either keep this incubating-only for now or fold stable generation into this PR if that seems like the better direction.


{% for metric in ctx.metrics %}
/** Name of the {@code {{ metric.metric_name }}} metric. */
{%- 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. */
{%- 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. */
{%- if metric is deprecated %}
@Deprecated
{%- endif %}
public static final String {{ metric.metric_name | replace(".", "_") | screaming_snake_case }}_DESCRIPTION = "{{ metric.brief | replace('\n', ' ') | replace('"', '\\"') }}";

{% endfor %}
private {{ my_class_name }}() {}
}
12 changes: 11 additions & 1 deletion buildscripts/templates/registry/incubating_java/weaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ templates:
})
application_mode: each
file_name: "{{ctx.root_namespace | pascal_case}}IncubatingAttributes.java"
- pattern: IncubatingSemanticMetrics.java.j2
filter: >
semconv_grouped_metrics({
"exclude_root_namespace": $excluded_namespaces,
"exclude_stability": []
}) | map({
root_namespace: .root_namespace,
metrics: .metrics
})
application_mode: each
file_name: "{{ctx.root_namespace | pascal_case}}IncubatingMetrics.java"
text_maps:
java_enum_type:
int: long
Expand Down Expand Up @@ -73,4 +84,3 @@ text_maps:
int[]: longArrayKeyTemplate
double[]: doubleArrayKeyTemplate
boolean[]: booleanArrayKeyTemplate

36 changes: 36 additions & 0 deletions buildscripts/templates/registry/java/SemanticMetrics.java.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{%- set my_class_name = ctx.root_namespace | pascal_case ~ "Metrics" -%}

/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.semconv;

// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/java/SemanticMetrics.java.j2
@SuppressWarnings("unused")
public final class {{ my_class_name }} {

{% for metric in ctx.metrics %}
{% if metric is stable %}
/** Name of the {@code {{ metric.metric_name }}} metric. */
{%- 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. */
{%- 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. */
{%- if metric is deprecated %}
@Deprecated
{%- endif %}
public static final String {{ metric.metric_name | replace(".", "_") | screaming_snake_case }}_DESCRIPTION = "{{ metric.brief | replace('\n', ' ') | replace('"', '\\"') }}";

{% endif %}
{% endfor %}
private {{ my_class_name }}() {}
}
11 changes: 11 additions & 0 deletions buildscripts/templates/registry/java/weaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ templates:
})
application_mode: each
file_name: "{{ctx.root_namespace | pascal_case}}Attributes.java"
# - pattern: SemanticMetrics.java.j2
# filter: >
# semconv_grouped_metrics({
# "exclude_root_namespace": $excluded_namespaces,
# "exclude_stability": ["experimental", "deprecated"]
# }) | map({
# root_namespace: .root_namespace,
# metrics: .metrics
# })
# application_mode: each
# file_name: "{{ctx.root_namespace | pascal_case}}Metrics.java"
text_maps:
java_enum_type:
int: long
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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 AzureIncubatingMetrics {

/** Name of the {@code azure.cosmosdb.client.active_instance.count} metric. */
public static final String AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT_NAME =
"azure.cosmosdb.client.active_instance.count";

/** Unit of the {@code azure.cosmosdb.client.active_instance.count} metric. */
public static final String AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT_UNIT = "{instance}";

/** Description of the {@code azure.cosmosdb.client.active_instance.count} metric. */
public static final String AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT_DESCRIPTION =
"Number of active client instances.";

/** Name of the {@code azure.cosmosdb.client.operation.request_charge} metric. */
public static final String AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE_NAME =
"azure.cosmosdb.client.operation.request_charge";

/** Unit of the {@code azure.cosmosdb.client.operation.request_charge} metric. */
public static final String AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE_UNIT = "{request_unit}";

/** Description of the {@code azure.cosmosdb.client.operation.request_charge} metric. */
public static final String AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE_DESCRIPTION =
"[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation.";

private AzureIncubatingMetrics() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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 CicdIncubatingMetrics {

/** Name of the {@code cicd.pipeline.run.active} metric. */
public static final String CICD_PIPELINE_RUN_ACTIVE_NAME = "cicd.pipeline.run.active";

/** Unit of the {@code cicd.pipeline.run.active} metric. */
public static final String CICD_PIPELINE_RUN_ACTIVE_UNIT = "{run}";

/** Description of the {@code cicd.pipeline.run.active} metric. */
public static final String CICD_PIPELINE_RUN_ACTIVE_DESCRIPTION =
"The number of pipeline runs currently active in the system by state.";

/** Name of the {@code cicd.pipeline.run.duration} metric. */
public static final String CICD_PIPELINE_RUN_DURATION_NAME = "cicd.pipeline.run.duration";

/** Unit of the {@code cicd.pipeline.run.duration} metric. */
public static final String CICD_PIPELINE_RUN_DURATION_UNIT = "s";

/** Description of the {@code cicd.pipeline.run.duration} metric. */
public static final String CICD_PIPELINE_RUN_DURATION_DESCRIPTION =
"Duration of a pipeline run grouped by pipeline, state and result.";

/** Name of the {@code cicd.pipeline.run.errors} metric. */
public static final String CICD_PIPELINE_RUN_ERRORS_NAME = "cicd.pipeline.run.errors";

/** Unit of the {@code cicd.pipeline.run.errors} metric. */
public static final String CICD_PIPELINE_RUN_ERRORS_UNIT = "{error}";

/** Description of the {@code cicd.pipeline.run.errors} metric. */
public static final String CICD_PIPELINE_RUN_ERRORS_DESCRIPTION =
"The number of errors encountered in pipeline runs (eg. compile, test failures).";

/** Name of the {@code cicd.system.errors} metric. */
public static final String CICD_SYSTEM_ERRORS_NAME = "cicd.system.errors";

/** Unit of the {@code cicd.system.errors} metric. */
public static final String CICD_SYSTEM_ERRORS_UNIT = "{error}";

/** Description of the {@code cicd.system.errors} metric. */
public static final String CICD_SYSTEM_ERRORS_DESCRIPTION =
"The number of errors in a component of the CICD system (eg. controller, scheduler, agent).";

/** Name of the {@code cicd.worker.count} metric. */
public static final String CICD_WORKER_COUNT_NAME = "cicd.worker.count";

/** Unit of the {@code cicd.worker.count} metric. */
public static final String CICD_WORKER_COUNT_UNIT = "{count}";

/** Description of the {@code cicd.worker.count} metric. */
public static final String CICD_WORKER_COUNT_DESCRIPTION =
"The number of workers on the CICD system by state.";

private CicdIncubatingMetrics() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* 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 ContainerIncubatingMetrics {

/** Name of the {@code container.cpu.time} metric. */
public static final String CONTAINER_CPU_TIME_NAME = "container.cpu.time";

/** Unit of the {@code container.cpu.time} metric. */
public static final String CONTAINER_CPU_TIME_UNIT = "s";

/** Description of the {@code container.cpu.time} metric. */
public static final String CONTAINER_CPU_TIME_DESCRIPTION = "Total CPU time consumed.";

/** Name of the {@code container.cpu.usage} metric. */
public static final String CONTAINER_CPU_USAGE_NAME = "container.cpu.usage";

/** Unit of the {@code container.cpu.usage} metric. */
public static final String CONTAINER_CPU_USAGE_UNIT = "{cpu}";

/** Description of the {@code container.cpu.usage} metric. */
public static final String CONTAINER_CPU_USAGE_DESCRIPTION =
"Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs.";

/** Name of the {@code container.disk.io} metric. */
public static final String CONTAINER_DISK_IO_NAME = "container.disk.io";

/** Unit of the {@code container.disk.io} metric. */
public static final String CONTAINER_DISK_IO_UNIT = "By";

/** Description of the {@code container.disk.io} metric. */
public static final String CONTAINER_DISK_IO_DESCRIPTION = "Disk bytes for the container.";

/** Name of the {@code container.filesystem.available} metric. */
public static final String CONTAINER_FILESYSTEM_AVAILABLE_NAME = "container.filesystem.available";

/** Unit of the {@code container.filesystem.available} metric. */
public static final String CONTAINER_FILESYSTEM_AVAILABLE_UNIT = "By";

/** Description of the {@code container.filesystem.available} metric. */
public static final String CONTAINER_FILESYSTEM_AVAILABLE_DESCRIPTION =
"Container filesystem available bytes.";

/** Name of the {@code container.filesystem.capacity} metric. */
public static final String CONTAINER_FILESYSTEM_CAPACITY_NAME = "container.filesystem.capacity";

/** Unit of the {@code container.filesystem.capacity} metric. */
public static final String CONTAINER_FILESYSTEM_CAPACITY_UNIT = "By";

/** Description of the {@code container.filesystem.capacity} metric. */
public static final String CONTAINER_FILESYSTEM_CAPACITY_DESCRIPTION =
"Container filesystem capacity.";

/** Name of the {@code container.filesystem.usage} metric. */
public static final String CONTAINER_FILESYSTEM_USAGE_NAME = "container.filesystem.usage";

/** Unit of the {@code container.filesystem.usage} metric. */
public static final String CONTAINER_FILESYSTEM_USAGE_UNIT = "By";

/** Description of the {@code container.filesystem.usage} metric. */
public static final String CONTAINER_FILESYSTEM_USAGE_DESCRIPTION = "Container filesystem usage.";

/** Name of the {@code container.memory.available} metric. */
public static final String CONTAINER_MEMORY_AVAILABLE_NAME = "container.memory.available";

/** Unit of the {@code container.memory.available} metric. */
public static final String CONTAINER_MEMORY_AVAILABLE_UNIT = "By";

/** Description of the {@code container.memory.available} metric. */
public static final String CONTAINER_MEMORY_AVAILABLE_DESCRIPTION = "Container memory available.";

/** Name of the {@code container.memory.paging.faults} metric. */
public static final String CONTAINER_MEMORY_PAGING_FAULTS_NAME = "container.memory.paging.faults";

/** Unit of the {@code container.memory.paging.faults} metric. */
public static final String CONTAINER_MEMORY_PAGING_FAULTS_UNIT = "{fault}";

/** Description of the {@code container.memory.paging.faults} metric. */
public static final String CONTAINER_MEMORY_PAGING_FAULTS_DESCRIPTION =
"Container memory paging faults.";

/** Name of the {@code container.memory.rss} metric. */
public static final String CONTAINER_MEMORY_RSS_NAME = "container.memory.rss";

/** Unit of the {@code container.memory.rss} metric. */
public static final String CONTAINER_MEMORY_RSS_UNIT = "By";

/** Description of the {@code container.memory.rss} metric. */
public static final String CONTAINER_MEMORY_RSS_DESCRIPTION = "Container memory RSS.";

/** Name of the {@code container.memory.usage} metric. */
public static final String CONTAINER_MEMORY_USAGE_NAME = "container.memory.usage";

/** Unit of the {@code container.memory.usage} metric. */
public static final String CONTAINER_MEMORY_USAGE_UNIT = "By";

/** Description of the {@code container.memory.usage} metric. */
public static final String CONTAINER_MEMORY_USAGE_DESCRIPTION = "Memory usage of the container.";

/** Name of the {@code container.memory.working_set} metric. */
public static final String CONTAINER_MEMORY_WORKING_SET_NAME = "container.memory.working_set";

/** Unit of the {@code container.memory.working_set} metric. */
public static final String CONTAINER_MEMORY_WORKING_SET_UNIT = "By";

/** Description of the {@code container.memory.working_set} metric. */
public static final String CONTAINER_MEMORY_WORKING_SET_DESCRIPTION =
"Container memory working set.";

/** Name of the {@code container.network.io} metric. */
public static final String CONTAINER_NETWORK_IO_NAME = "container.network.io";

/** Unit of the {@code container.network.io} metric. */
public static final String CONTAINER_NETWORK_IO_UNIT = "By";

/** Description of the {@code container.network.io} metric. */
public static final String CONTAINER_NETWORK_IO_DESCRIPTION = "Network bytes for the container.";

/** Name of the {@code container.uptime} metric. */
public static final String CONTAINER_UPTIME_NAME = "container.uptime";

/** Unit of the {@code container.uptime} metric. */
public static final String CONTAINER_UPTIME_UNIT = "s";

/** Description of the {@code container.uptime} metric. */
public static final String CONTAINER_UPTIME_DESCRIPTION =
"The time the container has been running.";

private ContainerIncubatingMetrics() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 CpuIncubatingMetrics {

/** Name of the {@code cpu.frequency} metric. */
@Deprecated public static final String CPU_FREQUENCY_NAME = "cpu.frequency";

/** Unit of the {@code cpu.frequency} metric. */
@Deprecated public static final String CPU_FREQUENCY_UNIT = "{Hz}";

/** Description of the {@code cpu.frequency} metric. */
@Deprecated
public static final String CPU_FREQUENCY_DESCRIPTION =
"Deprecated. Use `system.cpu.frequency` instead.";

/** Name of the {@code cpu.time} metric. */
@Deprecated public static final String CPU_TIME_NAME = "cpu.time";

/** Unit of the {@code cpu.time} metric. */
@Deprecated public static final String CPU_TIME_UNIT = "s";

/** Description of the {@code cpu.time} metric. */
@Deprecated
public static final String CPU_TIME_DESCRIPTION = "Deprecated. Use `system.cpu.time` instead.";

/** Name of the {@code cpu.utilization} metric. */
@Deprecated public static final String CPU_UTILIZATION_NAME = "cpu.utilization";

/** Unit of the {@code cpu.utilization} metric. */
@Deprecated public static final String CPU_UTILIZATION_UNIT = "1";

/** Description of the {@code cpu.utilization} metric. */
@Deprecated
public static final String CPU_UTILIZATION_DESCRIPTION =
"Deprecated. Use `system.cpu.utilization` instead.";

private CpuIncubatingMetrics() {}
}
Loading
Loading