diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index ad92de2752..c6a1934154 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -20,7 +20,7 @@ git reset --hard FETCH_HEAD cd ${SCRIPT_DIR} docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions:/source \ + -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/:/output \ otel/semconvgen \ @@ -30,5 +30,16 @@ docker run --rm \ -Dclass=SemanticAttributes \ -Dpkg=io.opentelemetry.semconv.trace.attributes +docker run --rm \ + -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \ + -v ${SCRIPT_DIR}/templates:/templates \ + -v ${ROOT_DIR}/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/:/output \ + otel/semconvgen \ + -f /source code \ + --template /templates/SemanticAttributes.java.j2 \ + --output /output/ResourceAttributes.java \ + -Dclass=ResourceAttributes \ + -Dpkg=io.opentelemetry.semconv.resource.attributes + cd "$ROOT_DIR" ./gradlew spotlessApply diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 index b4a9cde87e..806b2ab41f 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 @@ -50,7 +50,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringArrayKey; import io.opentelemetry.api.common.AttributeKey; import java.util.List; -// DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention/{{template}} +// DO NOT EDIT, this is an Auto-generated file from buildscripts/semantic-convention{{template}} public final class {{class}} { {%- for attribute in attributes | unique(attribute="fqn") %} @@ -105,6 +105,7 @@ public final class {{class}} { {% endif %} {%- endfor %} + {%- if class == "SemanticAttributes" %} // Manually defined and not YET in the YAML /** * The name of an event describing an exception. @@ -113,6 +114,7 @@ public final class {{class}} { * io.opentelemetry.api.trace.Span#recordException(Throwable)} should be used. */ public static final String EXCEPTION_EVENT_NAME = "exception"; + {% endif %} private {{class}}() {} } diff --git a/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporter.java b/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporter.java index fa1bb40290..689ec658b8 100644 --- a/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporter.java +++ b/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporter.java @@ -15,11 +15,11 @@ import io.opentelemetry.api.trace.Span.Kind; import io.opentelemetry.api.trace.StatusCode; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.trace.data.EventData; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.data.StatusData; import io.opentelemetry.sdk.trace.export.SpanExporter; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.IOException; import java.net.InetAddress; import java.net.NetworkInterface; @@ -47,7 +47,6 @@ public final class ZipkinSpanExporter implements SpanExporter { private static final Logger logger = Logger.getLogger(ZipkinSpanExporter.class.getName()); static final String OTEL_STATUS_CODE = "otel.status_code"; - static final String OTEL_STATUS_DESCRIPTION = "otel.status_description"; static final AttributeKey STATUS_ERROR = stringKey("error"); static final String KEY_INSTRUMENTATION_LIBRARY_NAME = "otel.library.name"; diff --git a/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterBuilder.java b/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterBuilder.java index 4adc3375bc..b55215cf83 100644 --- a/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterBuilder.java +++ b/exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterBuilder.java @@ -5,6 +5,8 @@ package io.opentelemetry.exporter.zipkin; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import zipkin2.Span; import zipkin2.codec.BytesEncoder; import zipkin2.codec.SpanBytesEncoder; @@ -25,17 +27,15 @@ public final class ZipkinSpanExporterBuilder { *

This is a primary label for trace lookup and aggregation, so it should be intuitive and * consistent. Many use a name from service discovery. * - *

Note: this value, will be superseded by the value of {@link - * io.opentelemetry.sdk.resources.ResourceAttributes#SERVICE_NAME} if it has been set in the - * {@link io.opentelemetry.sdk.resources.Resource} associated with the Tracer that created the - * spans. + *

Note: this value, will be superseded by the value of {@link ResourceAttributes#SERVICE_NAME} + * if it has been set in the {@link Resource} associated with the Tracer that created the spans. * *

This property is required to be set. * * @param serviceName The service name. It defaults to "unknown". * @return this. - * @see io.opentelemetry.sdk.resources.Resource - * @see io.opentelemetry.sdk.resources.ResourceAttributes + * @see Resource + * @see ResourceAttributes */ public ZipkinSpanExporterBuilder setServiceName(String serviceName) { this.serviceName = serviceName; diff --git a/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterTest.java b/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterTest.java index 7f493fa99c..85225c5c21 100644 --- a/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterTest.java +++ b/exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/ZipkinSpanExporterTest.java @@ -29,11 +29,11 @@ import io.opentelemetry.api.trace.TraceState; import io.opentelemetry.sdk.common.CompletableResultCode; import io.opentelemetry.sdk.common.InstrumentationLibraryInfo; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.testing.trace.TestSpanData; import io.opentelemetry.sdk.trace.data.EventData; import io.opentelemetry.sdk.trace.data.SpanData; import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; import java.io.IOException; import java.util.Arrays; diff --git a/perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java b/perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java index d82662def4..9e7046d916 100644 --- a/perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java +++ b/perf-harness/src/test/java/io/opentelemetry/perf/OtlpPipelineStressTest.java @@ -24,11 +24,11 @@ import io.opentelemetry.sdk.metrics.data.MetricData; import io.opentelemetry.sdk.metrics.data.PointData; import io.opentelemetry.sdk.metrics.export.IntervalMetricReader; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.testing.exporter.InMemoryMetricExporter; import io.opentelemetry.sdk.trace.SdkTracerManagement; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.IOException; import java.util.Collections; import java.util.List; diff --git a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/OpenTelemetrySdkAutoConfigurationTest.java b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/OpenTelemetrySdkAutoConfigurationTest.java index d5b71f2f7b..67a9dce729 100644 --- a/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/OpenTelemetrySdkAutoConfigurationTest.java +++ b/sdk-extensions/autoconfigure/src/test/java/io/opentelemetry/sdk/autoconfigure/OpenTelemetrySdkAutoConfigurationTest.java @@ -8,7 +8,7 @@ package io.opentelemetry.sdk.autoconfigure; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.util.Collections; import org.junit.jupiter.api.Test; @@ -20,7 +20,7 @@ class OpenTelemetrySdkAutoConfigurationTest { OpenTelemetrySdkAutoConfiguration.configureResource( ConfigProperties.createForTest( Collections.singletonMap("otel.resource.attributes", "telemetry.sdk.name=test"))); - assertThat(resource.getAttributes().get(SemanticAttributes.TELEMETRY_SDK_NAME)) + assertThat(resource.getAttributes().get(ResourceAttributes.TELEMETRY_SDK_NAME)) .isEqualTo("test"); } } diff --git a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResource.java b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResource.java index 596c4c4a33..ddc1176788 100644 --- a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResource.java +++ b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResource.java @@ -10,8 +10,8 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.File; import java.io.IOException; import java.util.logging.Level; @@ -67,7 +67,7 @@ public final class BeanstalkResource extends ResourceProvider { String value = parser.getText(); switch (parser.getCurrentName()) { case DEVELOPMENT_ID: - attrBuilders.put(ResourceAttributes.SERVICE_INSTANCE, value); + attrBuilders.put(ResourceAttributes.SERVICE_INSTANCE_ID, value); break; case VERSION_LABEL: attrBuilders.put(ResourceAttributes.SERVICE_VERSION, value); diff --git a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/Ec2Resource.java b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/Ec2Resource.java index b24790007b..a86ef57c26 100644 --- a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/Ec2Resource.java +++ b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/Ec2Resource.java @@ -10,8 +10,8 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -114,7 +114,7 @@ public final class Ec2Resource extends ResourceProvider { attrBuilders.put(ResourceAttributes.HOST_IMAGE_ID, value); break; case "accountId": - attrBuilders.put(ResourceAttributes.CLOUD_ACCOUNT, value); + attrBuilders.put(ResourceAttributes.CLOUD_ACCOUNT_ID, value); break; case "region": attrBuilders.put(ResourceAttributes.CLOUD_REGION, value); @@ -128,7 +128,6 @@ public final class Ec2Resource extends ResourceProvider { return Attributes.empty(); } - attrBuilders.put(ResourceAttributes.HOST_HOSTNAME, hostname); attrBuilders.put(ResourceAttributes.HOST_NAME, hostname); return attrBuilders.build(); diff --git a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EcsResource.java b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EcsResource.java index 7d1b7fd372..54b97cdf9a 100644 --- a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EcsResource.java +++ b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EcsResource.java @@ -7,8 +7,8 @@ package io.opentelemetry.sdk.extension.aws.resource; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Map; diff --git a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EksResource.java b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EksResource.java index 2c081217ec..9ea0466805 100644 --- a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EksResource.java +++ b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/EksResource.java @@ -9,8 +9,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -64,7 +64,7 @@ public final class EksResource extends ResourceProvider { String clusterName = getClusterName(); if (clusterName != null && !clusterName.isEmpty()) { - attrBuilders.put(ResourceAttributes.K8S_CLUSTER, clusterName); + attrBuilders.put(ResourceAttributes.K8S_CLUSTER_NAME, clusterName); } String containerId = dockerHelper.getContainerId(); diff --git a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResource.java b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResource.java index 2692e8d367..decca3752c 100644 --- a/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResource.java +++ b/sdk-extensions/aws/src/main/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResource.java @@ -8,7 +8,7 @@ package io.opentelemetry.sdk.extension.aws.resource; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.sdk.resources.ResourceProvider; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.util.Map; import java.util.stream.Stream; @@ -37,16 +37,16 @@ public final class LambdaResource extends ResourceProvider { AttributesBuilder builder = Attributes.builder() - .put(SemanticAttributes.CLOUD_PROVIDER, SemanticAttributes.CloudProviderValues.AWS); + .put(ResourceAttributes.CLOUD_PROVIDER, ResourceAttributes.CloudProviderValues.AWS); if (!region.isEmpty()) { - builder.put(SemanticAttributes.CLOUD_REGION, region); + builder.put(ResourceAttributes.CLOUD_REGION, region); } if (!functionName.isEmpty()) { - builder.put(SemanticAttributes.FAAS_NAME, functionName); + builder.put(ResourceAttributes.FAAS_NAME, functionName); } if (!functionVersion.isEmpty()) { - builder.put(SemanticAttributes.FAAS_VERSION, functionVersion); + builder.put(ResourceAttributes.FAAS_VERSION, functionVersion); } return builder.build(); diff --git a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResourceTest.java b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResourceTest.java index 87e8d68a1a..5efd5cbeaf 100644 --- a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResourceTest.java +++ b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/BeanstalkResourceTest.java @@ -10,8 +10,8 @@ import static org.assertj.core.api.Assertions.assertThat; import com.google.common.base.Charsets; import com.google.common.io.Files; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.File; import java.io.IOException; import java.util.ServiceLoader; @@ -33,7 +33,7 @@ class BeanstalkResourceTest { .isEqualTo( Attributes.of( ResourceAttributes.CLOUD_PROVIDER, "aws", - ResourceAttributes.SERVICE_INSTANCE, "4", + ResourceAttributes.SERVICE_INSTANCE_ID, "4", ResourceAttributes.SERVICE_VERSION, "2", ResourceAttributes.SERVICE_NAMESPACE, "HttpSubscriber-env")); } diff --git a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/Ec2ResourceTest.java b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/Ec2ResourceTest.java index 30ef2c7cb9..80386dd3c0 100644 --- a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/Ec2ResourceTest.java +++ b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/Ec2ResourceTest.java @@ -14,8 +14,8 @@ import com.linecorp.armeria.common.MediaType; import com.linecorp.armeria.testing.junit5.server.mock.MockWebServerExtension; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.util.ServiceLoader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -66,9 +66,8 @@ class Ec2ResourceTest { expectedAttrBuilders.put(ResourceAttributes.CLOUD_ZONE, "us-west-2b"); expectedAttrBuilders.put(ResourceAttributes.HOST_TYPE, "t2.micro"); expectedAttrBuilders.put(ResourceAttributes.HOST_IMAGE_ID, "ami-5fb8c835"); - expectedAttrBuilders.put(ResourceAttributes.CLOUD_ACCOUNT, "123456789012"); + expectedAttrBuilders.put(ResourceAttributes.CLOUD_ACCOUNT_ID, "123456789012"); expectedAttrBuilders.put(ResourceAttributes.CLOUD_REGION, "us-west-2"); - expectedAttrBuilders.put(ResourceAttributes.HOST_HOSTNAME, "ec2-1-2-3-4"); expectedAttrBuilders.put(ResourceAttributes.HOST_NAME, "ec2-1-2-3-4"); assertThat(attributes).isEqualTo(expectedAttrBuilders.build()); @@ -100,9 +99,8 @@ class Ec2ResourceTest { .put(ResourceAttributes.CLOUD_ZONE, "us-west-2b") .put(ResourceAttributes.HOST_TYPE, "t2.micro") .put(ResourceAttributes.HOST_IMAGE_ID, "ami-5fb8c835") - .put(ResourceAttributes.CLOUD_ACCOUNT, "123456789012") + .put(ResourceAttributes.CLOUD_ACCOUNT_ID, "123456789012") .put(ResourceAttributes.CLOUD_REGION, "us-west-2") - .put(ResourceAttributes.HOST_HOSTNAME, "ec2-1-2-3-4") .put(ResourceAttributes.HOST_NAME, "ec2-1-2-3-4"); assertThat(attributes).isEqualTo(expectedAttrBuilders.build()); diff --git a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EcsResourceTest.java b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EcsResourceTest.java index ef9559def2..2ecc48c9ce 100644 --- a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EcsResourceTest.java +++ b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EcsResourceTest.java @@ -9,8 +9,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.HashMap; diff --git a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EksResourceTest.java b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EksResourceTest.java index c4656b2d00..c6421f61ac 100644 --- a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EksResourceTest.java +++ b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/EksResourceTest.java @@ -15,8 +15,8 @@ import static org.mockito.Mockito.when; import com.google.common.base.Charsets; import com.google.common.io.Files; import io.opentelemetry.api.common.Attributes; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.File; import java.io.IOException; import java.util.ServiceLoader; @@ -62,7 +62,7 @@ public class EksResourceTest { assertThat(attributes) .isEqualTo( Attributes.of( - ResourceAttributes.K8S_CLUSTER, "my-cluster", + ResourceAttributes.K8S_CLUSTER_NAME, "my-cluster", ResourceAttributes.CONTAINER_ID, "0123456789A")); } diff --git a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResourceTest.java b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResourceTest.java index f621ba2b6a..13e3a96627 100644 --- a/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResourceTest.java +++ b/sdk-extensions/aws/src/test/java/io/opentelemetry/sdk/extension/aws/resource/LambdaResourceTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.ResourceProvider; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.util.HashMap; import java.util.Map; import java.util.ServiceLoader; @@ -44,9 +44,9 @@ class LambdaResourceTest { assertThat(attributes) .isEqualTo( Attributes.of( - SemanticAttributes.CLOUD_PROVIDER, + ResourceAttributes.CLOUD_PROVIDER, "aws", - SemanticAttributes.FAAS_NAME, + ResourceAttributes.FAAS_NAME, "my-function")); } @@ -67,13 +67,13 @@ class LambdaResourceTest { assertThat(attributes) .isEqualTo( Attributes.of( - SemanticAttributes.CLOUD_PROVIDER, + ResourceAttributes.CLOUD_PROVIDER, "aws", - SemanticAttributes.CLOUD_REGION, + ResourceAttributes.CLOUD_REGION, "us-east-1", - SemanticAttributes.FAAS_NAME, + ResourceAttributes.FAAS_NAME, "my-function", - SemanticAttributes.FAAS_VERSION, + ResourceAttributes.FAAS_VERSION, "1.2.3")); } diff --git a/sdk-extensions/resources/build.gradle b/sdk-extensions/resources/build.gradle index 68eb5714f2..e4dc89443d 100644 --- a/sdk-extensions/resources/build.gradle +++ b/sdk-extensions/resources/build.gradle @@ -10,6 +10,7 @@ ext.moduleName = "io.opentelemetry.sdk.extension.resources" dependencies { api project(':sdk:common') + api project(':semconv') testImplementation libraries.junit_pioneer diff --git a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/OsResource.java b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/OsResource.java index d15387f775..a8e1737f1d 100644 --- a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/OsResource.java +++ b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/OsResource.java @@ -7,8 +7,8 @@ package io.opentelemetry.sdk.extension.resources; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import javax.annotation.Nullable; /** {@link ResourceProvider} which provides information about the current operating system. */ @@ -32,7 +32,7 @@ public final class OsResource extends ResourceProvider { String osName = getOs(os); if (osName != null) { - attributes.put(ResourceAttributes.OS_NAME, osName); + attributes.put(ResourceAttributes.OS_TYPE, osName); } String version = null; @@ -51,27 +51,27 @@ public final class OsResource extends ResourceProvider { private static String getOs(String os) { os = os.toLowerCase(); if (os.startsWith("windows")) { - return "WINDOWS"; + return ResourceAttributes.OsTypeValues.WINDOWS; } else if (os.startsWith("linux")) { - return "LINUX"; + return ResourceAttributes.OsTypeValues.LINUX; } else if (os.startsWith("mac")) { - return "DARWIN"; + return ResourceAttributes.OsTypeValues.DARWIN; } else if (os.startsWith("freebsd")) { - return "FREEBSD"; + return ResourceAttributes.OsTypeValues.FREEBSD; } else if (os.startsWith("netbsd")) { - return "NETBSD"; + return ResourceAttributes.OsTypeValues.NETBSD; } else if (os.startsWith("openbsd")) { - return "OPENBSD"; + return ResourceAttributes.OsTypeValues.OPENBSD; } else if (os.startsWith("dragonflybsd")) { - return "DRAGONFLYBSD"; + return ResourceAttributes.OsTypeValues.DRAGONFLYBSD; } else if (os.startsWith("hp-ux")) { - return "HPUX"; + return ResourceAttributes.OsTypeValues.HPUX; } else if (os.startsWith("aix")) { - return "AIX"; + return ResourceAttributes.OsTypeValues.AIX; } else if (os.startsWith("solaris")) { - return "SOLARIS"; + return ResourceAttributes.OsTypeValues.SOLARIS; } else if (os.startsWith("z/os")) { - return "ZOS"; + return ResourceAttributes.OsTypeValues.ZOS; } return null; } diff --git a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessResource.java b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessResource.java index 39df5a9c1b..9d0c6cbf69 100644 --- a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessResource.java +++ b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessResource.java @@ -7,8 +7,8 @@ package io.opentelemetry.sdk.extension.resources; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; -import io.opentelemetry.sdk.resources.ResourceAttributes; import io.opentelemetry.sdk.resources.ResourceProvider; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import java.io.File; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; diff --git a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResource.java b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResource.java index 398cfb3103..263687e4a5 100644 --- a/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResource.java +++ b/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResource.java @@ -5,9 +5,9 @@ package io.opentelemetry.sdk.extension.resources; -import static io.opentelemetry.sdk.resources.ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION; -import static io.opentelemetry.sdk.resources.ResourceAttributes.PROCESS_RUNTIME_NAME; -import static io.opentelemetry.sdk.resources.ResourceAttributes.PROCESS_RUNTIME_VERSION; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_RUNTIME_NAME; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_RUNTIME_VERSION; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.ResourceProvider; diff --git a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/OsResourceTest.java b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/OsResourceTest.java index 85adb63a74..2bc575ad95 100644 --- a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/OsResourceTest.java +++ b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/OsResourceTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.sdk.resources.ResourceAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import org.junit.jupiter.api.Test; import org.junitpioneer.jupiter.SetSystemProperty; @@ -21,7 +21,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "Linux 4.11") void linux() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("LINUX"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("LINUX"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -29,7 +29,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "MacOS X 11") void macos() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("DARWIN"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("DARWIN"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -37,7 +37,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "Windows 10") void windows() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("WINDOWS"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("WINDOWS"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -45,7 +45,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "FreeBSD 10") void freebsd() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("FREEBSD"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("FREEBSD"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -53,7 +53,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "NetBSD 10") void netbsd() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("NETBSD"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("NETBSD"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -61,7 +61,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "OpenBSD 10") void openbsd() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("OPENBSD"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("OPENBSD"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -69,7 +69,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "DragonFlyBSD 10") void dragonflybsd() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("DRAGONFLYBSD"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("DRAGONFLYBSD"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -77,7 +77,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "HP-UX 10") void hpux() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("HPUX"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("HPUX"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -85,7 +85,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "AIX 10") void aix() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("AIX"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("AIX"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -93,7 +93,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "Solaris 10") void solaris() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("SOLARIS"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("SOLARIS"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -101,7 +101,7 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "Z/OS 10") void zos() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("ZOS"); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isEqualTo("ZOS"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @@ -109,14 +109,14 @@ class OsResourceTest { @SetSystemProperty(key = "os.name", value = "RagOS 10") void unknown() { Attributes attributes = RESOURCE.getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isNull(); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isNull(); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); } @Test void inDefault() { Attributes attributes = Resource.getDefault().getAttributes(); - assertThat(attributes.get(ResourceAttributes.OS_NAME)).isNotNull(); + assertThat(attributes.get(ResourceAttributes.OS_TYPE)).isNotNull(); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotNull(); } } diff --git a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessResourceTest.java b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessResourceTest.java index 972db027f9..747597b5d5 100644 --- a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessResourceTest.java +++ b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessResourceTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.sdk.resources.ResourceAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import org.junit.jupiter.api.Test; import org.junitpioneer.jupiter.SetSystemProperty; diff --git a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResourceTest.java b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResourceTest.java index a0e41469f9..4e9b183349 100644 --- a/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResourceTest.java +++ b/sdk-extensions/resources/src/test/java/io/opentelemetry/sdk/extension/resources/ProcessRuntimeResourceTest.java @@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.sdk.resources.ResourceAttributes; +import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; import org.junit.jupiter.api.Test; class ProcessRuntimeResourceTest { diff --git a/sdk/common/build.gradle b/sdk/common/build.gradle index fb7641a23f..83e2cfbc59 100644 --- a/sdk/common/build.gradle +++ b/sdk/common/build.gradle @@ -11,6 +11,7 @@ ext.propertiesDir = "build/generated/properties/io/opentelemetry/sdk/common" dependencies { api project(':api:all') + api project(':semconv') annotationProcessor libraries.auto_value diff --git a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java index 0bccdaffe2..a803ecced5 100644 --- a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java +++ b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java @@ -5,9 +5,9 @@ package io.opentelemetry.sdk.resources; -import static io.opentelemetry.sdk.resources.ResourceAttributes.SDK_LANGUAGE; -import static io.opentelemetry.sdk.resources.ResourceAttributes.SDK_NAME; -import static io.opentelemetry.sdk.resources.ResourceAttributes.SDK_VERSION; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TELEMETRY_SDK_LANGUAGE; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TELEMETRY_SDK_NAME; +import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.TELEMETRY_SDK_VERSION; import com.google.auto.value.AutoValue; import com.google.auto.value.extension.memoized.Memoized; @@ -59,9 +59,9 @@ public abstract class Resource { TELEMETRY_SDK = create( Attributes.builder() - .put(SDK_NAME, "opentelemetry") - .put(SDK_LANGUAGE, "java") - .put(SDK_VERSION, readVersion()) + .put(TELEMETRY_SDK_NAME, "opentelemetry") + .put(TELEMETRY_SDK_LANGUAGE, "java") + .put(TELEMETRY_SDK_VERSION, readVersion()) .build()); } diff --git a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java index 6ef1db889f..06e5747889 100644 --- a/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java +++ b/sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceAttributes.java @@ -13,10 +13,12 @@ import io.opentelemetry.api.common.AttributeKey; /** * Provides constants for resource semantic conventions defined by the OpenTelemetry specification. * + * @deprecated Please use the generated class in the `opentelemetry-semconv` module. * @see Resource * Conventions */ +@Deprecated public final class ResourceAttributes { /** The operating system type, such as {@code "WINDOWS"}, {@code "DARWIN"}, {@code "LINUX"}. */ diff --git a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java new file mode 100644 index 0000000000..8139bd6337 --- /dev/null +++ b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java @@ -0,0 +1,436 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.semconv.resource.attributes; + +import static io.opentelemetry.api.common.AttributeKey.longKey; +import static io.opentelemetry.api.common.AttributeKey.stringArrayKey; +import static io.opentelemetry.api.common.AttributeKey.stringKey; + +import io.opentelemetry.api.common.AttributeKey; +import java.util.List; + +// DO NOT EDIT, this is an Auto-generated file from +// buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 +public final class ResourceAttributes { + + /** Name of the cloud provider. */ + public static final AttributeKey CLOUD_PROVIDER = stringKey("cloud.provider"); + + /** The cloud account ID used to identify different entities. */ + public static final AttributeKey CLOUD_ACCOUNT_ID = stringKey("cloud.account.id"); + + /** A specific geographical location where different entities can run. */ + public static final AttributeKey CLOUD_REGION = stringKey("cloud.region"); + + /** + * Zones are a sub set of the region connected through low-latency links. + * + *

Note: In AWS, this is called availability-zone. + */ + public static final AttributeKey CLOUD_ZONE = stringKey("cloud.zone"); + + /** + * The Amazon Resource Name (ARN) of an [ECS container + * instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + */ + public static final AttributeKey AWS_ECS_CONTAINER_ARN = + stringKey("aws.ecs.container.arn"); + + /** + * The ARN of an [ECS + * cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + */ + public static final AttributeKey AWS_ECS_CLUSTER_ARN = stringKey("aws.ecs.cluster.arn"); + + /** + * The [launch + * type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS + * task. + */ + public static final AttributeKey AWS_ECS_LAUNCHTYPE = stringKey("aws.ecs.launchtype"); + + /** + * The ARN of an [ECS task + * definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + */ + public static final AttributeKey AWS_ECS_TASK_ARN = stringKey("aws.ecs.task.arn"); + + /** The task definition family this task definition is a member of. */ + public static final AttributeKey AWS_ECS_TASK_FAMILY = stringKey("aws.ecs.task.family"); + + /** + * The name(s) of the AWS log group(s) an application is writing to. + * + *

Note: Multiple log groups must be supported for cases like multi-container applications, + * where a single application has sidecar containers, and each write to their own log group. + */ + public static final AttributeKey> AWS_LOG_GROUP_NAMES = + stringArrayKey("aws.log.group.names"); + + /** + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + * + *

Note: See the [log group ARN format + * documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + */ + public static final AttributeKey> AWS_LOG_GROUP_ARNS = + stringArrayKey("aws.log.group.arns"); + + /** The name(s) of the AWS log stream(s) an application is writing to. */ + public static final AttributeKey> AWS_LOG_STREAM_NAMES = + stringArrayKey("aws.log.stream.names"); + + /** + * The ARN(s) of the AWS log stream(s). + * + *

Note: See the [log stream ARN format + * documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + * One log group can contain several log streams, so these ARNs necessarily identify both a log + * group and a log stream. + */ + public static final AttributeKey> AWS_LOG_STREAM_ARNS = + stringArrayKey("aws.log.stream.arns"); + + /** Container name. */ + public static final AttributeKey CONTAINER_NAME = stringKey("container.name"); + + /** + * Container id. Usually a UUID, as for example used to [identify Docker + * containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID + * might be abbreviated. + */ + public static final AttributeKey CONTAINER_ID = stringKey("container.id"); + + /** Name of the image the container was built on. */ + public static final AttributeKey CONTAINER_IMAGE_NAME = stringKey("container.image.name"); + + /** Container image tag. */ + public static final AttributeKey CONTAINER_IMAGE_TAG = stringKey("container.image.tag"); + + /** + * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + * deployment tier). + */ + public static final AttributeKey DEPLOYMENT_ENVIRONMENT = + stringKey("deployment.environment"); + + /** The name of the function being executed. */ + public static final AttributeKey FAAS_NAME = stringKey("faas.name"); + + /** + * The unique ID of the function being executed. + * + *

Note: For example, in AWS Lambda this field corresponds to the + * [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) value, in GCP + * to the URI of the resource, and in Azure to the + * [FunctionDirectory](https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function) + * field. + */ + public static final AttributeKey FAAS_ID = stringKey("faas.id"); + + /** + * The version string of the function being executed as defined in [Version + * Attributes](../../resource/semantic_conventions/README.md#version-attributes). + */ + public static final AttributeKey FAAS_VERSION = stringKey("faas.version"); + + /** The execution environment ID as a string. */ + public static final AttributeKey FAAS_INSTANCE = stringKey("faas.instance"); + + /** + * The amount of memory available to the serverless function in MiB. + * + *

Note: It's recommended to set this attribute in since e.g. too little memory can easily + * stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable + * `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + */ + public static final AttributeKey FAAS_MAX_MEMORY = longKey("faas.max_memory"); + + /** Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. */ + public static final AttributeKey HOST_ID = stringKey("host.id"); + + /** + * Name of the host. On Unix systems, it may contain what the hostname command returns, or the + * fully qualified hostname, or another name specified by the user. + */ + public static final AttributeKey HOST_NAME = stringKey("host.name"); + + /** Type of host. For Cloud, this must be the machine type. */ + public static final AttributeKey HOST_TYPE = stringKey("host.type"); + + /** Name of the VM image or OS install the host was instantiated from. */ + public static final AttributeKey HOST_IMAGE_NAME = stringKey("host.image.name"); + + /** VM image ID. For Cloud, this value is from the provider. */ + public static final AttributeKey HOST_IMAGE_ID = stringKey("host.image.id"); + + /** + * The version string of the VM image as defined in [Version + * Attributes](README.md#version-attributes). + */ + public static final AttributeKey HOST_IMAGE_VERSION = stringKey("host.image.version"); + + /** The name of the cluster. */ + public static final AttributeKey K8S_CLUSTER_NAME = stringKey("k8s.cluster.name"); + + /** The name of the namespace that the pod is running in. */ + public static final AttributeKey K8S_NAMESPACE_NAME = stringKey("k8s.namespace.name"); + + /** The UID of the Pod. */ + public static final AttributeKey K8S_POD_UID = stringKey("k8s.pod.uid"); + + /** The name of the Pod. */ + public static final AttributeKey K8S_POD_NAME = stringKey("k8s.pod.name"); + + /** The name of the Container in a Pod template. */ + public static final AttributeKey K8S_CONTAINER_NAME = stringKey("k8s.container.name"); + + /** The UID of the ReplicaSet. */ + public static final AttributeKey K8S_REPLICASET_UID = stringKey("k8s.replicaset.uid"); + + /** The name of the ReplicaSet. */ + public static final AttributeKey K8S_REPLICASET_NAME = stringKey("k8s.replicaset.name"); + + /** The UID of the Deployment. */ + public static final AttributeKey K8S_DEPLOYMENT_UID = stringKey("k8s.deployment.uid"); + + /** The name of the Deployment. */ + public static final AttributeKey K8S_DEPLOYMENT_NAME = stringKey("k8s.deployment.name"); + + /** The UID of the StatefulSet. */ + public static final AttributeKey K8S_STATEFULSET_UID = stringKey("k8s.statefulset.uid"); + + /** The name of the StatefulSet. */ + public static final AttributeKey K8S_STATEFULSET_NAME = stringKey("k8s.statefulset.name"); + + /** The UID of the DaemonSet. */ + public static final AttributeKey K8S_DAEMONSET_UID = stringKey("k8s.daemonset.uid"); + + /** The name of the DaemonSet. */ + public static final AttributeKey K8S_DAEMONSET_NAME = stringKey("k8s.daemonset.name"); + + /** The UID of the Job. */ + public static final AttributeKey K8S_JOB_UID = stringKey("k8s.job.uid"); + + /** The name of the Job. */ + public static final AttributeKey K8S_JOB_NAME = stringKey("k8s.job.name"); + + /** The UID of the CronJob. */ + public static final AttributeKey K8S_CRONJOB_UID = stringKey("k8s.cronjob.uid"); + + /** The name of the CronJob. */ + public static final AttributeKey K8S_CRONJOB_NAME = stringKey("k8s.cronjob.name"); + + /** The operating system type. */ + public static final AttributeKey OS_TYPE = stringKey("os.type"); + + /** + * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` + * or `lsb_release -a` commands. + */ + public static final AttributeKey OS_DESCRIPTION = stringKey("os.description"); + + /** Process identifier (PID). */ + public static final AttributeKey PROCESS_PID = longKey("process.pid"); + + /** + * The name of the process executable. On Linux based systems, can be set to the `Name` in + * `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. + */ + public static final AttributeKey PROCESS_EXECUTABLE_NAME = + stringKey("process.executable.name"); + + /** + * The full path to the process executable. On Linux based systems, can be set to the target of + * `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. + */ + public static final AttributeKey PROCESS_EXECUTABLE_PATH = + stringKey("process.executable.path"); + + /** + * The command used to launch the process (i.e. the command name). On Linux based systems, can be + * set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter + * extracted from `GetCommandLineW`. + */ + public static final AttributeKey PROCESS_COMMAND = stringKey("process.command"); + + /** + * The full command used to launch the process as a single string representing the full command. + * On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to + * assemble it just for monitoring; use `process.command_args` instead. + */ + public static final AttributeKey PROCESS_COMMAND_LINE = stringKey("process.command_line"); + + /** + * All the command arguments (including the command/executable itself) as received by the process. + * On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according + * to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based + * executables, this would be the full argv vector passed to `main`. + */ + public static final AttributeKey> PROCESS_COMMAND_ARGS = + stringArrayKey("process.command_args"); + + /** The username of the user that owns the process. */ + public static final AttributeKey PROCESS_OWNER = stringKey("process.owner"); + + /** + * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name + * of the compiler. + */ + public static final AttributeKey PROCESS_RUNTIME_NAME = stringKey("process.runtime.name"); + + /** + * The version of the runtime of this process, as returned by the runtime without modification. + */ + public static final AttributeKey PROCESS_RUNTIME_VERSION = + stringKey("process.runtime.version"); + + /** + * An additional description about the runtime of the process, for example a specific vendor + * customization of the runtime environment. + */ + public static final AttributeKey PROCESS_RUNTIME_DESCRIPTION = + stringKey("process.runtime.description"); + + /** + * Logical name of the service. + * + *

Note: MUST be the same for all instances of horizontally scaled services. If the value was + * not specified, SDKs MUST fallback to `unknown_service:` concatenated with + * [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If + * `process.executable.name` is not available, the value MUST be set to `unknown_service`. + */ + public static final AttributeKey SERVICE_NAME = stringKey("service.name"); + + /** + * A namespace for `service.name`. + * + *

Note: A string value having a meaning that helps to distinguish a group of services, for + * example the team name that owns a group of services. `service.name` is expected to be unique + * within the same namespace. If `service.namespace` is not specified in the Resource then + * `service.name` is expected to be unique for all services that have no explicit namespace + * defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length + * namespace string is assumed equal to unspecified namespace. + */ + public static final AttributeKey SERVICE_NAMESPACE = stringKey("service.namespace"); + + /** + * The string ID of the service instance. + * + *

Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in + * other words `service.namespace,service.name,service.id` triplet MUST be globally unique). The + * ID helps to distinguish instances of the same service that exist at the same time (e.g. + * instances of a horizontally scaled service). It is preferable for the ID to be persistent and + * stay the same for the lifetime of the service instance, however it is acceptable that the ID is + * ephemeral and changes during important lifetime events for the service (e.g. service restarts). + * If the service has no inherent unique ID that can be used as the value of this attribute it is + * recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for + * reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). + */ + public static final AttributeKey SERVICE_INSTANCE_ID = stringKey("service.instance.id"); + + /** The version string of the service API or implementation. */ + public static final AttributeKey SERVICE_VERSION = stringKey("service.version"); + + /** The name of the telemetry SDK as defined above. */ + public static final AttributeKey TELEMETRY_SDK_NAME = stringKey("telemetry.sdk.name"); + + /** The language of the telemetry SDK. */ + public static final AttributeKey TELEMETRY_SDK_LANGUAGE = + stringKey("telemetry.sdk.language"); + + /** The version string of the telemetry SDK. */ + public static final AttributeKey TELEMETRY_SDK_VERSION = + stringKey("telemetry.sdk.version"); + + /** The version string of the auto instrumentation agent, if used. */ + public static final AttributeKey TELEMETRY_AUTO_VERSION = + stringKey("telemetry.auto.version"); + + // Enum definitions + public static final class CloudProviderValues { + /** Amazon Web Services. */ + public static final String AWS = "aws"; + /** Microsoft Azure. */ + public static final String AZURE = "azure"; + /** Google Cloud Platform. */ + public static final String GCP = "gcp"; + + private CloudProviderValues() {} + } + + public enum AwsEcsLaunchtypeValues { + /** ec2. */ + EC2("EC2"), + /** fargate. */ + FARGATE("Fargate"), + ; + + private final String value; + + AwsEcsLaunchtypeValues(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + } + + public static final class OsTypeValues { + /** Microsoft Windows. */ + public static final String WINDOWS = "WINDOWS"; + /** Linux. */ + public static final String LINUX = "LINUX"; + /** Apple Darwin. */ + public static final String DARWIN = "DARWIN"; + /** FreeBSD. */ + public static final String FREEBSD = "FREEBSD"; + /** NetBSD. */ + public static final String NETBSD = "NETBSD"; + /** OpenBSD. */ + public static final String OPENBSD = "OPENBSD"; + /** DragonFly BSD. */ + public static final String DRAGONFLYBSD = "DRAGONFLYBSD"; + /** HP-UX (Hewlett Packard Unix). */ + public static final String HPUX = "HPUX"; + /** AIX (Advanced Interactive eXecutive). */ + public static final String AIX = "AIX"; + /** Oracle Solaris. */ + public static final String SOLARIS = "SOLARIS"; + /** IBM z/OS. */ + public static final String ZOS = "ZOS"; + + private OsTypeValues() {} + } + + public static final class TelemetrySdkLanguageValues { + /** cpp. */ + public static final String CPP = "cpp"; + /** dotnet. */ + public static final String DOTNET = "dotnet"; + /** erlang. */ + public static final String ERLANG = "erlang"; + /** go. */ + public static final String GO = "go"; + /** java. */ + public static final String JAVA = "java"; + /** nodejs. */ + public static final String NODEJS = "nodejs"; + /** php. */ + public static final String PHP = "php"; + /** python. */ + public static final String PYTHON = "python"; + /** ruby. */ + public static final String RUBY = "ruby"; + /** webjs. */ + public static final String WEBJS = "webjs"; + + private TelemetrySdkLanguageValues() {} + } + + private ResourceAttributes() {} +} diff --git a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java index dfeb46f32e..9230af5827 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java @@ -14,52 +14,93 @@ import io.opentelemetry.api.common.AttributeKey; import java.util.List; // DO NOT EDIT, this is an Auto-generated file from -// buildscripts/semantic-convention//templates/SemanticAttributes.java.j2 +// buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 public final class SemanticAttributes { - /** Name of the cloud provider. */ - public static final AttributeKey CLOUD_PROVIDER = stringKey("cloud.provider"); + /** + * Name of the cloud provider. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CLOUD_PROVIDER = stringKey("cloud.provider"); - /** The cloud account ID used to identify different entities. */ + /** + * The cloud account ID used to identify different entities. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CLOUD_ACCOUNT_ID = stringKey("cloud.account.id"); - /** A specific geographical location where different entities can run. */ - public static final AttributeKey CLOUD_REGION = stringKey("cloud.region"); + /** + * A specific geographical location where different entities can run. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CLOUD_REGION = stringKey("cloud.region"); /** * Zones are a sub set of the region connected through low-latency links. * *

Note: In AWS, this is called availability-zone. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey CLOUD_ZONE = stringKey("cloud.zone"); + @Deprecated public static final AttributeKey CLOUD_ZONE = stringKey("cloud.zone"); /** * The Amazon Resource Name (ARN) of an [ECS container * instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey AWS_ECS_CONTAINER_ARN = stringKey("aws.ecs.container.arn"); /** * The ARN of an [ECS * cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey AWS_ECS_CLUSTER_ARN = stringKey("aws.ecs.cluster.arn"); /** * The [launch * type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS * task. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey AWS_ECS_LAUNCHTYPE = stringKey("aws.ecs.launchtype"); /** * The ARN of an [ECS task * definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey AWS_ECS_TASK_ARN = stringKey("aws.ecs.task.arn"); - /** The task definition family this task definition is a member of. */ + /** + * The task definition family this task definition is a member of. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey AWS_ECS_TASK_FAMILY = stringKey("aws.ecs.task.family"); /** @@ -67,7 +108,11 @@ public final class SemanticAttributes { * *

Note: Multiple log groups must be supported for cases like multi-container applications, * where a single application has sidecar containers, and each write to their own log group. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey> AWS_LOG_GROUP_NAMES = stringArrayKey("aws.log.group.names"); @@ -76,11 +121,21 @@ public final class SemanticAttributes { * *

Note: See the [log group ARN format * documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey> AWS_LOG_GROUP_ARNS = stringArrayKey("aws.log.group.arns"); - /** The name(s) of the AWS log stream(s) an application is writing to. */ + /** + * The name(s) of the AWS log stream(s) an application is writing to. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey> AWS_LOG_STREAM_NAMES = stringArrayKey("aws.log.stream.names"); @@ -91,35 +146,68 @@ public final class SemanticAttributes { * documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). * One log group can contain several log streams, so these ARNs necessarily identify both a log * group and a log stream. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey> AWS_LOG_STREAM_ARNS = stringArrayKey("aws.log.stream.arns"); - /** Container name. */ - public static final AttributeKey CONTAINER_NAME = stringKey("container.name"); + /** + * Container name. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CONTAINER_NAME = stringKey("container.name"); /** * Container id. Usually a UUID, as for example used to [identify Docker * containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID * might be abbreviated. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey CONTAINER_ID = stringKey("container.id"); + @Deprecated public static final AttributeKey CONTAINER_ID = stringKey("container.id"); - /** Name of the image the container was built on. */ + /** + * Name of the image the container was built on. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CONTAINER_IMAGE_NAME = stringKey("container.image.name"); - /** Container image tag. */ + /** + * Container image tag. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey CONTAINER_IMAGE_TAG = stringKey("container.image.tag"); /** * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka * deployment tier). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey DEPLOYMENT_ENVIRONMENT = stringKey("deployment.environment"); - /** The name of the function being executed. */ - public static final AttributeKey FAAS_NAME = stringKey("faas.name"); + /** + * The name of the function being executed. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey FAAS_NAME = stringKey("faas.name"); /** * The unique ID of the function being executed. @@ -129,17 +217,28 @@ public final class SemanticAttributes { * to the URI of the resource, and in Azure to the * [FunctionDirectory](https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function) * field. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey FAAS_ID = stringKey("faas.id"); + @Deprecated public static final AttributeKey FAAS_ID = stringKey("faas.id"); /** * The version string of the function being executed as defined in [Version * Attributes](../../resource/semantic_conventions/README.md#version-attributes). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey FAAS_VERSION = stringKey("faas.version"); + @Deprecated public static final AttributeKey FAAS_VERSION = stringKey("faas.version"); - /** The execution environment ID as a string. */ - public static final AttributeKey FAAS_INSTANCE = stringKey("faas.instance"); + /** + * The execution environment ID as a string. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey FAAS_INSTANCE = stringKey("faas.instance"); /** * The amount of memory available to the serverless function in MiB. @@ -147,107 +246,257 @@ public final class SemanticAttributes { *

Note: It's recommended to set this attribute in since e.g. too little memory can easily * stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable * `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey FAAS_MAX_MEMORY = longKey("faas.max_memory"); + @Deprecated public static final AttributeKey FAAS_MAX_MEMORY = longKey("faas.max_memory"); - /** Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. */ - public static final AttributeKey HOST_ID = stringKey("host.id"); + /** + * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey HOST_ID = stringKey("host.id"); /** * Name of the host. On Unix systems, it may contain what the hostname command returns, or the * fully qualified hostname, or another name specified by the user. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey HOST_NAME = stringKey("host.name"); + @Deprecated public static final AttributeKey HOST_NAME = stringKey("host.name"); - /** Type of host. For Cloud, this must be the machine type. */ - public static final AttributeKey HOST_TYPE = stringKey("host.type"); + /** + * Type of host. For Cloud, this must be the machine type. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey HOST_TYPE = stringKey("host.type"); - /** Name of the VM image or OS install the host was instantiated from. */ + /** + * Name of the VM image or OS install the host was instantiated from. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey HOST_IMAGE_NAME = stringKey("host.image.name"); - /** VM image ID. For Cloud, this value is from the provider. */ - public static final AttributeKey HOST_IMAGE_ID = stringKey("host.image.id"); + /** + * VM image ID. For Cloud, this value is from the provider. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey HOST_IMAGE_ID = stringKey("host.image.id"); /** * The version string of the VM image as defined in [Version * Attributes](README.md#version-attributes). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey HOST_IMAGE_VERSION = stringKey("host.image.version"); - /** The name of the cluster. */ + /** + * The name of the cluster. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_CLUSTER_NAME = stringKey("k8s.cluster.name"); - /** The name of the namespace that the pod is running in. */ + /** + * The name of the namespace that the pod is running in. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_NAMESPACE_NAME = stringKey("k8s.namespace.name"); - /** The UID of the Pod. */ - public static final AttributeKey K8S_POD_UID = stringKey("k8s.pod.uid"); + /** + * The UID of the Pod. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_POD_UID = stringKey("k8s.pod.uid"); - /** The name of the Pod. */ - public static final AttributeKey K8S_POD_NAME = stringKey("k8s.pod.name"); + /** + * The name of the Pod. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_POD_NAME = stringKey("k8s.pod.name"); - /** The name of the Container in a Pod template. */ + /** + * The name of the Container in a Pod template. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_CONTAINER_NAME = stringKey("k8s.container.name"); - /** The UID of the ReplicaSet. */ + /** + * The UID of the ReplicaSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_REPLICASET_UID = stringKey("k8s.replicaset.uid"); - /** The name of the ReplicaSet. */ + /** + * The name of the ReplicaSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_REPLICASET_NAME = stringKey("k8s.replicaset.name"); - /** The UID of the Deployment. */ + /** + * The UID of the Deployment. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_DEPLOYMENT_UID = stringKey("k8s.deployment.uid"); - /** The name of the Deployment. */ + /** + * The name of the Deployment. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_DEPLOYMENT_NAME = stringKey("k8s.deployment.name"); - /** The UID of the StatefulSet. */ + /** + * The UID of the StatefulSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_STATEFULSET_UID = stringKey("k8s.statefulset.uid"); - /** The name of the StatefulSet. */ + /** + * The name of the StatefulSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_STATEFULSET_NAME = stringKey("k8s.statefulset.name"); - /** The UID of the DaemonSet. */ + /** + * The UID of the DaemonSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_DAEMONSET_UID = stringKey("k8s.daemonset.uid"); - /** The name of the DaemonSet. */ + /** + * The name of the DaemonSet. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_DAEMONSET_NAME = stringKey("k8s.daemonset.name"); - /** The UID of the Job. */ - public static final AttributeKey K8S_JOB_UID = stringKey("k8s.job.uid"); + /** + * The UID of the Job. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_JOB_UID = stringKey("k8s.job.uid"); - /** The name of the Job. */ - public static final AttributeKey K8S_JOB_NAME = stringKey("k8s.job.name"); + /** + * The name of the Job. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_JOB_NAME = stringKey("k8s.job.name"); - /** The UID of the CronJob. */ + /** + * The UID of the CronJob. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_CRONJOB_UID = stringKey("k8s.cronjob.uid"); - /** The name of the CronJob. */ + /** + * The name of the CronJob. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey K8S_CRONJOB_NAME = stringKey("k8s.cronjob.name"); - /** The operating system type. */ - public static final AttributeKey OS_TYPE = stringKey("os.type"); + /** + * The operating system type. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey OS_TYPE = stringKey("os.type"); /** * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` * or `lsb_release -a` commands. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey OS_DESCRIPTION = stringKey("os.description"); + @Deprecated public static final AttributeKey OS_DESCRIPTION = stringKey("os.description"); - /** Process identifier (PID). */ - public static final AttributeKey PROCESS_PID = longKey("process.pid"); + /** + * Process identifier (PID). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey PROCESS_PID = longKey("process.pid"); /** * The name of the process executable. On Linux based systems, can be set to the `Name` in * `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_EXECUTABLE_NAME = stringKey("process.executable.name"); /** * The full path to the process executable. On Linux based systems, can be set to the target of * `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_EXECUTABLE_PATH = stringKey("process.executable.path"); @@ -255,14 +504,22 @@ public final class SemanticAttributes { * The command used to launch the process (i.e. the command name). On Linux based systems, can be * set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter * extracted from `GetCommandLineW`. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_COMMAND = stringKey("process.command"); /** * The full command used to launch the process as a single string representing the full command. * On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to * assemble it just for monitoring; use `process.command_args` instead. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_COMMAND_LINE = stringKey("process.command_line"); /** @@ -270,29 +527,50 @@ public final class SemanticAttributes { * On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according * to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based * executables, this would be the full argv vector passed to `main`. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey> PROCESS_COMMAND_ARGS = stringArrayKey("process.command_args"); - /** The username of the user that owns the process. */ - public static final AttributeKey PROCESS_OWNER = stringKey("process.owner"); + /** + * The username of the user that owns the process. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey PROCESS_OWNER = stringKey("process.owner"); /** * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name * of the compiler. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_RUNTIME_NAME = stringKey("process.runtime.name"); /** * The version of the runtime of this process, as returned by the runtime without modification. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_RUNTIME_VERSION = stringKey("process.runtime.version"); /** * An additional description about the runtime of the process, for example a specific vendor * customization of the runtime environment. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey PROCESS_RUNTIME_DESCRIPTION = stringKey("process.runtime.description"); @@ -303,8 +581,11 @@ public final class SemanticAttributes { * not specified, SDKs MUST fallback to `unknown_service:` concatenated with * [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If * `process.executable.name` is not available, the value MUST be set to `unknown_service`. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ - public static final AttributeKey SERVICE_NAME = stringKey("service.name"); + @Deprecated public static final AttributeKey SERVICE_NAME = stringKey("service.name"); /** * A namespace for `service.name`. @@ -315,7 +596,11 @@ public final class SemanticAttributes { * `service.name` is expected to be unique for all services that have no explicit namespace * defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length * namespace string is assumed equal to unspecified namespace. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey SERVICE_NAMESPACE = stringKey("service.namespace"); /** @@ -330,24 +615,58 @@ public final class SemanticAttributes { * If the service has no inherent unique ID that can be used as the value of this attribute it is * recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for * reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} */ + @Deprecated public static final AttributeKey SERVICE_INSTANCE_ID = stringKey("service.instance.id"); - /** The version string of the service API or implementation. */ + /** + * The version string of the service API or implementation. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey SERVICE_VERSION = stringKey("service.version"); - /** The name of the telemetry SDK as defined above. */ + /** + * The name of the telemetry SDK as defined above. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey TELEMETRY_SDK_NAME = stringKey("telemetry.sdk.name"); - /** The language of the telemetry SDK. */ + /** + * The language of the telemetry SDK. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey TELEMETRY_SDK_LANGUAGE = stringKey("telemetry.sdk.language"); - /** The version string of the telemetry SDK. */ + /** + * The version string of the telemetry SDK. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey TELEMETRY_SDK_VERSION = stringKey("telemetry.sdk.version"); - /** The version string of the auto instrumentation agent, if used. */ + /** + * The version string of the auto instrumentation agent, if used. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final AttributeKey TELEMETRY_AUTO_VERSION = stringKey("telemetry.auto.version"); @@ -878,6 +1197,14 @@ public final class SemanticAttributes { public static final AttributeKey RPC_GRPC_STATUS_CODE = longKey("rpc.grpc.status_code"); // Enum definitions + + /** + * This has been deprecated. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final class CloudProviderValues { /** Amazon Web Services. */ public static final String AWS = "aws"; @@ -889,6 +1216,13 @@ public final class SemanticAttributes { private CloudProviderValues() {} } + /** + * This has been deprecated. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public enum AwsEcsLaunchtypeValues { /** ec2. */ EC2("EC2"), @@ -907,6 +1241,13 @@ public final class SemanticAttributes { } } + /** + * This has been deprecated. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final class OsTypeValues { /** Microsoft Windows. */ public static final String WINDOWS = "WINDOWS"; @@ -934,6 +1275,13 @@ public final class SemanticAttributes { private OsTypeValues() {} } + /** + * This has been deprecated. + * + * @deprecated Will be removed in favor of {@link + * io.opentelemetry.semconv.resource.attributes.ResourceAttributes} + */ + @Deprecated public static final class TelemetrySdkLanguageValues { /** cpp. */ public static final String CPP = "cpp";