Skip to content
Merged
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
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ val snapshot = true
// end

// The release version of https://github.com/open-telemetry/semantic-conventions used to generate classes
var semanticConventionsVersion = "1.32.0"
var semanticConventionsVersion = "1.34.0"
Comment thread
jack-berg marked this conversation as resolved.
val schemaUrlVersions = listOf(
semanticConventionsVersion,
"1.33.0",
"1.32.0",
"1.31.0",
"1.30.0",
"1.29.0",
Expand Down Expand Up @@ -110,7 +112,7 @@ fun generateTask(taskName: String, incubating: Boolean) {
"--mount", "type=bind,source=${modelPath},target=/home/weaver/source,readonly",
"--mount", "type=bind,source=$projectDir/buildscripts/templates,target=/home/weaver/templates,readonly",
"--mount", "type=bind,source=$projectDir/$outputDir,target=/home/weaver/target",
"otel/weaver:v0.15.0",
"otel/weaver:v0.15.1",
"registry", "generate",
"--registry=/home/weaver/source",
"--templates=/home/weaver/templates",
Expand Down
4 changes: 3 additions & 1 deletion buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ tasks {
breakIterator(true)

addBooleanOption("html5", true)
addBooleanOption("Xdoclint:all,-missing", true)
// TODO (trask) remove "-html" after next semconv release
// (see https://github.com/open-telemetry/semantic-conventions/pull/2304)
addBooleanOption("Xdoclint:all,-missing,-html", true)
// non-standard option to fail on warnings, see https://bugs.openjdk.java.net/browse/JDK-8200363
addStringOption("Xwerror", "-quiet")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class {{ my_class_name }} {
{% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) %}{% if attribute is experimental %}
{% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) | rejectattr("type", "eq", "any") %}{% if attribute is experimental %}
{%- if attribute is deprecated %}{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%}
{%- else -%}{%- set deprecated_javadoc = "" -%}
{%- endif -%}
Expand All @@ -49,8 +49,19 @@ public final class {{ my_class_name }} {
{% endif %}
{% endfor %}
// Enum definitions
{% for attribute in ctx.attributes | select("enum") | rejectattr("name", "in", ctx.excluded_attributes) %}
{%- if attribute is stable -%}
{% for attribute in ctx.attributes | select("enum") | rejectattr("name", "in", ctx.excluded_attributes) %}
{% set enum_deprecated_in_favor_of_stable = namespace(value=false) %}
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.

What does the namespace function do?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it creates something like an object with a nested attribute value, which can then be updated inside of an inner block

think of this code like AtomicBoolean being passed into methods (in this case into a nested if) so you can update the value in the method and then get updated value after the method call

{% if attribute is stable %}
{%- set enum_deprecated_in_favor_of_stable.value = true -%}
{%- endif -%}
{%- for member in attribute.type.members %}
{% if member is experimental %}
{% if not member is deprecated %}
{%- set enum_deprecated_in_favor_of_stable.value = false -%}
{%- endif -%}
{%- endif -%}
{%- endfor %}
{%- if enum_deprecated_in_favor_of_stable.value -%}
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.

Can you summarize what this change is doing?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

when writing incubating model, deprecate the enum class if the attribute has been stabilized and it has no values which are still experimental (other than those which may be deprecated explicitly)

(this is to deal with the db system name mixed status where only some values are stabilized

{%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values" -%}
/**
* Values for {@link #{{ attribute.name | screaming_snake_case }}}.
Expand All @@ -62,11 +73,16 @@ public final class {{ my_class_name }} {
{%- else -%}
/** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
{%- endif -%}
{% if attribute is stable or attribute is deprecated %}@Deprecated{% endif %}
{% if enum_deprecated_in_favor_of_stable.value or attribute is deprecated %}@Deprecated{% endif %}
public static final class {{ attribute.name | pascal_case }}IncubatingValues {
{%- for member in attribute.type.members %}
{{ [member.brief or (member.id ~ '.')] | comment(indent=4) }}
public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
{% if member is experimental or enum_deprecated_in_favor_of_stable.value %}{{ [member.brief or (member.id ~ '.')] | comment(indent=4) }}
{% if member is deprecated %}@Deprecated{% endif %} public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
{% elif member is stable %}
{%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values#" ~ (member.id | screaming_snake_case) -%}
{{ [member.brief or (member.id ~ '.'), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} value."] | comment(indent=4) }}
@Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
{%- endif -%}
{%- endfor %}
private {{ attribute.name | pascal_case }}IncubatingValues() {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,14 @@ public final class AndroidIncubatingAttributes {
public static final AttributeKey<String> ANDROID_OS_API_LEVEL = stringKey("android.os.api_level");

/**
* Deprecated. Use {@code android.app.state} instead.
* Deprecated. Use {@code android.app.state} body field instead.
*
* <p>Notes:
*
* <p>The Android lifecycle states are defined in <a
* href="https://developer.android.com/guide/components/activities/activity-lifecycle#lc">Activity
* lifecycle callbacks</a>, and from which the {@code OS identifiers} are derived.
*
* @deprecated Renamed to {@code android.app.state}
* @deprecated Use {@code android.app.state} body field instead.
*/
@Deprecated public static final AttributeKey<String> ANDROID_STATE = stringKey("android.state");

// Enum definitions

/** Values for {@link #ANDROID_APP_STATE}. */
public static final class AndroidAppStateIncubatingValues {
/**
Expand All @@ -71,7 +66,7 @@ private AndroidAppStateIncubatingValues() {}
/**
* Values for {@link #ANDROID_STATE}
*
* @deprecated Renamed to {@code android.app.state}
* @deprecated Use {@code android.app.state} body field instead.
*/
@Deprecated
public static final class AndroidStateIncubatingValues {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.semconv.incubating;

import static io.opentelemetry.api.common.AttributeKey.longKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;

import io.opentelemetry.api.common.AttributeKey;
Expand Down Expand Up @@ -48,6 +49,33 @@ public final class AppIncubatingAttributes {
*/
public static final AttributeKey<String> APP_INSTALLATION_ID = stringKey("app.installation.id");

/** The x (horizontal) coordinate of a screen coordinate, in screen pixels. */
public static final AttributeKey<Long> APP_SCREEN_COORDINATE_X =
longKey("app.screen.coordinate.x");

/** The y (vertical) component of a screen coordinate, in screen pixels. */
public static final AttributeKey<Long> APP_SCREEN_COORDINATE_Y =
longKey("app.screen.coordinate.y");

/**
* An identifier that uniquely differentiates this widget from other widgets in the same
* application.
*
* <p>Notes:
*
* <p>A widget is an application component, typically an on-screen visual GUI element.
*/
public static final AttributeKey<String> APP_WIDGET_ID = stringKey("app.widget.id");

/**
* The name of an application widget.
*
* <p>Notes:
*
* <p>A widget is an application component, typically an on-screen visual GUI element.
*/
public static final AttributeKey<String> APP_WIDGET_NAME = stringKey("app.widget.name");

// Enum definitions

private AppIncubatingAttributes() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@
// buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class AwsIncubatingAttributes {
/**
* The unique identifier of the AWS Bedrock Guardrail. A <a
* href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html">guardrail</a> helps
* safeguard and prevent unwanted behavior from model responses or user messages.
*/
public static final AttributeKey<String> AWS_BEDROCK_GUARDRAIL_ID =
stringKey("aws.bedrock.guardrail.id");

/**
* The unique identifier of the AWS Bedrock Knowledge base. A <a
* href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html">knowledge
* base</a> is a bank of information that can be queried by models to generate more relevant
* responses and augment prompts.
*/
public static final AttributeKey<String> AWS_BEDROCK_KNOWLEDGE_BASE_ID =
stringKey("aws.bedrock.knowledge_base.id");

/** The JSON-serialized value of each item in the {@code AttributeDefinitions} request field. */
public static final AttributeKey<List<String>> AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS =
stringArrayKey("aws.dynamodb.attribute_definitions");
Expand Down Expand Up @@ -155,6 +172,16 @@ public final class AwsIncubatingAttributes {
public static final AttributeKey<String> AWS_EXTENDED_REQUEST_ID =
stringKey("aws.extended_request_id");

/**
* The name of the AWS Kinesis <a
* href="https://docs.aws.amazon.com/streams/latest/dev/introduction.html">stream</a> the request
* refers to. Corresponds to the {@code --stream-name} parameter of the Kinesis <a
* href="https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html">describe-stream</a>
* operation.
*/
public static final AttributeKey<String> AWS_KINESIS_STREAM_NAME =
stringKey("aws.kinesis.stream_name");

/**
* The full invoked ARN as provided on the {@code Context} passed to the function ({@code
* Lambda-Runtime-Invoked-Function-Arn} header on the {@code /runtime/invocation/next}
Expand All @@ -167,6 +194,18 @@ public final class AwsIncubatingAttributes {
public static final AttributeKey<String> AWS_LAMBDA_INVOKED_ARN =
stringKey("aws.lambda.invoked_arn");

/**
* The UUID of the <a
* href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html">AWS
* Lambda EvenSource Mapping</a>. An event source is mapped to a lambda function. It's contents
* are read by Lambda and used to trigger a function. This isn't available in the lambda execution
* context or the lambda runtime environtment. This is going to be populated by the AWS SDK for
* each language when that UUID is present. Some of these operations are
* Create/Delete/Get/List/Update EventSourceMapping.
*/
public static final AttributeKey<String> AWS_LAMBDA_RESOURCE_MAPPING_ID =
stringKey("aws.lambda.resource_mapping.id");

/**
* The Amazon Resource Name(s) (ARN) of the AWS log group(s).
*
Expand Down Expand Up @@ -341,7 +380,33 @@ public final class AwsIncubatingAttributes {
*/
public static final AttributeKey<String> AWS_S3_UPLOAD_ID = stringKey("aws.s3.upload_id");

/** The ARN of the Secret stored in the Secrets Mangger */
public static final AttributeKey<String> AWS_SECRETSMANAGER_SECRET_ARN =
stringKey("aws.secretsmanager.secret.arn");

/**
* The ARN of the AWS SNS Topic. An Amazon SNS <a
* href="https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html">topic</a> is a logical
* access point that acts as a communication channel.
*/
public static final AttributeKey<String> AWS_SNS_TOPIC_ARN = stringKey("aws.sns.topic.arn");

/**
* The URL of the AWS SQS Queue. It's a unique identifier for a queue in Amazon Simple Queue
* Service (SQS) and is used to access the queue and perform actions on it.
*/
public static final AttributeKey<String> AWS_SQS_QUEUE_URL = stringKey("aws.sqs.queue.url");

/** The ARN of the AWS Step Functions Activity. */
public static final AttributeKey<String> AWS_STEP_FUNCTIONS_ACTIVITY_ARN =
stringKey("aws.step_functions.activity.arn");

/** The ARN of the AWS Step Functions State Machine. */
public static final AttributeKey<String> AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN =
stringKey("aws.step_functions.state_machine.arn");

// Enum definitions

/** Values for {@link #AWS_ECS_LAUNCHTYPE}. */
public static final class AwsEcsLaunchtypeIncubatingValues {
/** ec2. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class AzureIncubatingAttributes {
longKey("azure.cosmosdb.response.sub_status_code");

// Enum definitions

/** Values for {@link #AZURE_COSMOSDB_CONNECTION_MODE}. */
public static final class AzureCosmosdbConnectionModeIncubatingValues {
/** Gateway (HTTP) connection. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public final class CassandraIncubatingAttributes {
longKey("cassandra.speculative_execution.count");

// Enum definitions

/** Values for {@link #CASSANDRA_CONSISTENCY_LEVEL}. */
public static final class CassandraConsistencyLevelIncubatingValues {
/** all. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class CicdIncubatingAttributes {
/** The kind of action a pipeline run is performing. */
public static final AttributeKey<String> CICD_PIPELINE_ACTION_NAME =
stringKey("cicd.pipeline.action.name");

/** The human readable name of the pipeline within a CI/CD system. */
public static final AttributeKey<String> CICD_PIPELINE_NAME = stringKey("cicd.pipeline.name");

Expand Down Expand Up @@ -45,6 +49,10 @@ public final class CicdIncubatingAttributes {
public static final AttributeKey<String> CICD_PIPELINE_TASK_RUN_ID =
stringKey("cicd.pipeline.task.run.id");

/** The result of a task run. */
public static final AttributeKey<String> CICD_PIPELINE_TASK_RUN_RESULT =
stringKey("cicd.pipeline.task.run.result");

/**
* The <a href="https://wikipedia.org/wiki/URL">URL</a> of the pipeline task run, providing the
* complete address in order to locate and identify the pipeline task run.
Expand All @@ -60,10 +68,37 @@ public final class CicdIncubatingAttributes {
public static final AttributeKey<String> CICD_SYSTEM_COMPONENT =
stringKey("cicd.system.component");

/** The unique identifier of a worker within a CICD system. */
public static final AttributeKey<String> CICD_WORKER_ID = stringKey("cicd.worker.id");

/** The name of a worker within a CICD system. */
public static final AttributeKey<String> CICD_WORKER_NAME = stringKey("cicd.worker.name");

/** The state of a CICD worker / agent. */
public static final AttributeKey<String> CICD_WORKER_STATE = stringKey("cicd.worker.state");

/**
* The <a href="https://wikipedia.org/wiki/URL">URL</a> of the worker, providing the complete
* address in order to locate and identify the worker.
*/
public static final AttributeKey<String> CICD_WORKER_URL_FULL = stringKey("cicd.worker.url.full");

// Enum definitions

/** Values for {@link #CICD_PIPELINE_ACTION_NAME}. */
public static final class CicdPipelineActionNameIncubatingValues {
/** The pipeline run is executing a build. */
public static final String BUILD = "BUILD";

/** The pipeline run is executing. */
public static final String RUN = "RUN";

/** The pipeline run is executing a sync. */
public static final String SYNC = "SYNC";

private CicdPipelineActionNameIncubatingValues() {}
}

/** Values for {@link #CICD_PIPELINE_RESULT}. */
public static final class CicdPipelineResultIncubatingValues {
/** The pipeline run finished successfully. */
Expand Down Expand Up @@ -114,6 +149,34 @@ public static final class CicdPipelineRunStateIncubatingValues {
private CicdPipelineRunStateIncubatingValues() {}
}

/** Values for {@link #CICD_PIPELINE_TASK_RUN_RESULT}. */
public static final class CicdPipelineTaskRunResultIncubatingValues {
/** The task run finished successfully. */
public static final String SUCCESS = "success";

/**
* The task run did not finish successfully, eg. due to a compile error or a failing test. Such
* failures are usually detected by non-zero exit codes of the tools executed in the task run.
*/
public static final String FAILURE = "failure";

/**
* The task run failed due to an error in the CICD system, eg. due to the worker being killed.
*/
public static final String ERROR = "error";

/** A timeout caused the task run to be interrupted. */
public static final String TIMEOUT = "timeout";

/** The task run was cancelled, eg. by a user manually cancelling the task run. */
public static final String CANCELLATION = "cancellation";

/** The task run was skipped, eg. due to a precondition not being met. */
public static final String SKIP = "skip";

private CicdPipelineTaskRunResultIncubatingValues() {}
}

/** Values for {@link #CICD_PIPELINE_TASK_TYPE}. */
public static final class CicdPipelineTaskTypeIncubatingValues {
/** build */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public final class CloudIncubatingAttributes {
public static final AttributeKey<String> CLOUD_PROVIDER = stringKey("cloud.provider");

/**
* The geographical region the resource is running.
* The geographical region within a cloud provider. When associated with a resource, this
* attribute specifies the region where the resource operates. When calling services or APIs
* deployed on a cloud, this attribute identifies the region where the called destination is
* deployed.
*
* <p>Notes:
*
Expand Down Expand Up @@ -89,6 +92,7 @@ public final class CloudIncubatingAttributes {
public static final AttributeKey<String> CLOUD_RESOURCE_ID = stringKey("cloud.resource_id");

// Enum definitions

/** Values for {@link #CLOUD_PLATFORM}. */
public static final class CloudPlatformIncubatingValues {
/** Alibaba Cloud Elastic Compute Service */
Expand Down
Loading
Loading