Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline incubating attributes + central semconv-incubating dependency #1298

Merged
merged 16 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
2 changes: 1 addition & 1 deletion aws-resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
api("io.opentelemetry:opentelemetry-sdk")

implementation("io.opentelemetry.semconv:opentelemetry-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.25.0-alpha")
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")

compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudPlatformValues.AWS_ELASTIC_BEANSTALK;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.SERVICE_INSTANCE_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.SERVICE_NAMESPACE;
import static io.opentelemetry.semconv.ServiceAttributes.SERVICE_VERSION;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudPlatformValues.AWS_ELASTIC_BEANSTALK;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes.SERVICE_INSTANCE_ID;
import static io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes.SERVICE_NAMESPACE;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;

import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.internal.ConditionalResourceProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_ACCOUNT_ID;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_AVAILABILITY_ZONE;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudPlatformValues.AWS_EC2;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_ID;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_IMAGE_ID;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_NAME;
import static io.opentelemetry.semconv.incubating.HostIncubatingAttributes.HOST_TYPE;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_ACCOUNT_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_AVAILABILITY_ZONE;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudPlatformValues.AWS_EC2;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.HOST_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.HOST_IMAGE_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.HOST_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.HOST_TYPE;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
Expand All @@ -23,7 +23,6 @@
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.SchemaUrls;
import io.opentelemetry.semconv.incubating.CloudIncubatingAttributes;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -90,7 +89,7 @@ static Resource buildResource(String endpoint) {
String hostname = fetchHostname(hostnameUrl, token);

AttributesBuilder attrBuilders = Attributes.builder();
attrBuilders.put(CLOUD_PROVIDER, CloudIncubatingAttributes.CloudProviderValues.AWS);
attrBuilders.put(CLOUD_PROVIDER, IncubatingAttributes.CloudProviderValues.AWS);
attrBuilders.put(CLOUD_PLATFORM, AWS_EC2);

try (JsonParser parser = JSON_FACTORY.createParser(identity)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_ECS_CONTAINER_ARN;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_ECS_LAUNCHTYPE;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_ECS_TASK_ARN;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_ECS_TASK_FAMILY;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_ECS_TASK_REVISION;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_LOG_GROUP_ARNS;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_LOG_GROUP_NAMES;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_LOG_STREAM_ARNS;
import static io.opentelemetry.semconv.incubating.AwsIncubatingAttributes.AWS_LOG_STREAM_NAMES;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_ACCOUNT_ID;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_AVAILABILITY_ZONE;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_RESOURCE_ID;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudPlatformValues.AWS_ECS;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_ID;
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_IMAGE_NAME;
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_ECS_CONTAINER_ARN;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_ECS_LAUNCHTYPE;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_ECS_TASK_ARN;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_ECS_TASK_FAMILY;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_ECS_TASK_REVISION;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_LOG_GROUP_ARNS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_LOG_GROUP_NAMES;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_LOG_STREAM_ARNS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.AWS_LOG_STREAM_NAMES;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_ACCOUNT_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_AVAILABILITY_ZONE;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_RESOURCE_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CONTAINER_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CONTAINER_IMAGE_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CONTAINER_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudPlatformValues.AWS_ECS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudProviderValues.AWS;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudPlatformValues.AWS_EKS;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.semconv.incubating.ContainerIncubatingAttributes.CONTAINER_ID;
import static io.opentelemetry.semconv.incubating.K8sIncubatingAttributes.K8S_CLUSTER_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CONTAINER_ID;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudPlatformValues.AWS_EKS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.K8S_CLUSTER_NAME;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.contrib.aws.resource;

import io.opentelemetry.api.common.AttributeKey;
import java.util.List;

/**
* Inlines incubating attributes until they are stable, doing this prevents having a direct
* dependency on incubating artifact which can conflict with another incubating version.
*/
class IncubatingAttributes {
private IncubatingAttributes() {}

public static final AttributeKey<String> CLOUD_ACCOUNT_ID =
AttributeKey.stringKey("cloud.account.id");
public static final AttributeKey<String> CLOUD_AVAILABILITY_ZONE =
AttributeKey.stringKey("cloud.availability_zone");
public static final AttributeKey<String> CLOUD_PLATFORM =
AttributeKey.stringKey("cloud.platform");
public static final AttributeKey<String> CLOUD_PROVIDER =
AttributeKey.stringKey("cloud.provider");
public static final AttributeKey<String> CLOUD_REGION = AttributeKey.stringKey("cloud.region");
public static final AttributeKey<String> CLOUD_RESOURCE_ID =
AttributeKey.stringKey("cloud.resource_id");

public static final class CloudPlatformValues {
public static final String AWS_EC2 = "aws_ec2";
public static final String AWS_ECS = "aws_ecs";
public static final String AWS_EKS = "aws_eks";
public static final String AWS_LAMBDA = "aws_lambda";
public static final String AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk";

private CloudPlatformValues() {}
}

public static final class CloudProviderValues {
public static final String AWS = "aws";

private CloudProviderValues() {}
}

public static final AttributeKey<String> SERVICE_INSTANCE_ID =
AttributeKey.stringKey("service.instance.id");
public static final AttributeKey<String> SERVICE_NAMESPACE =
AttributeKey.stringKey("service.namespace");

public static final AttributeKey<String> HOST_ID = AttributeKey.stringKey("host.id");
public static final AttributeKey<String> HOST_IMAGE_ID = AttributeKey.stringKey("host.image.id");
public static final AttributeKey<String> HOST_NAME = AttributeKey.stringKey("host.name");
public static final AttributeKey<String> HOST_TYPE = AttributeKey.stringKey("host.type");

public static final AttributeKey<String> CONTAINER_ID = AttributeKey.stringKey("container.id");
public static final AttributeKey<String> CONTAINER_IMAGE_NAME =
AttributeKey.stringKey("container.image.name");
public static final AttributeKey<String> CONTAINER_NAME =
AttributeKey.stringKey("container.name");

public static final AttributeKey<String> K8S_CLUSTER_NAME =
AttributeKey.stringKey("k8s.cluster.name");

public static final AttributeKey<String> AWS_ECS_CONTAINER_ARN =
AttributeKey.stringKey("aws.ecs.container.arn");
public static final AttributeKey<String> AWS_ECS_LAUNCHTYPE =
AttributeKey.stringKey("aws.ecs.launchtype");
public static final AttributeKey<String> AWS_ECS_TASK_ARN =
AttributeKey.stringKey("aws.ecs.task.arn");
public static final AttributeKey<String> AWS_ECS_TASK_FAMILY =
AttributeKey.stringKey("aws.ecs.task.family");
public static final AttributeKey<String> AWS_ECS_TASK_REVISION =
AttributeKey.stringKey("aws.ecs.task.revision");
public static final AttributeKey<List<String>> AWS_LOG_GROUP_ARNS =
AttributeKey.stringArrayKey("aws.log.group.arns");
public static final AttributeKey<List<String>> AWS_LOG_GROUP_NAMES =
AttributeKey.stringArrayKey("aws.log.group.names");
public static final AttributeKey<List<String>> AWS_LOG_STREAM_ARNS =
AttributeKey.stringArrayKey("aws.log.stream.arns");
public static final AttributeKey<List<String>> AWS_LOG_STREAM_NAMES =
AttributeKey.stringArrayKey("aws.log.stream.names");

public static final AttributeKey<String> FAAS_NAME = AttributeKey.stringKey("faas.name");
public static final AttributeKey<String> FAAS_VERSION = AttributeKey.stringKey("faas.version");
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudPlatformValues.AWS_LAMBDA;
import static io.opentelemetry.semconv.incubating.CloudIncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_NAME;
import static io.opentelemetry.semconv.incubating.FaasIncubatingAttributes.FAAS_VERSION;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PLATFORM;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_PROVIDER;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CLOUD_REGION;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudPlatformValues.AWS_LAMBDA;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.CloudProviderValues.AWS;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.FAAS_NAME;
import static io.opentelemetry.contrib.aws.resource.IncubatingAttributes.FAAS_VERSION;

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
Expand Down
2 changes: 2 additions & 0 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ val errorProneVersion = "2.27.1"
val prometheusVersion = "0.16.0"
val mockitoVersion = "4.11.0"
val slf4jVersion = "2.0.13"
val contribIncubatingVersion = "1.25.0-alpha"
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved

val CORE_DEPENDENCIES = listOf(
"com.google.auto.service:auto-service:${autoServiceVersion}",
Expand All @@ -33,6 +34,7 @@ val CORE_DEPENDENCIES = listOf(
"com.google.errorprone:error_prone_core:${errorProneVersion}",
"io.github.netmikey.logunit:logunit-jul:2.0.0",
"io.opentelemetry.proto:opentelemetry-proto:1.0.0-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv-incubating:${contribIncubatingVersion}",
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
"io.prometheus:simpleclient:${prometheusVersion}",
"io.prometheus:simpleclient_common:${prometheusVersion}",
"io.prometheus:simpleclient_httpserver:${prometheusVersion}",
Expand Down
2 changes: 1 addition & 1 deletion gcp-resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies {
implementation("com.google.cloud.opentelemetry:detector-resources-support:0.28.0")

implementation("io.opentelemetry.semconv:opentelemetry-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.25.0-alpha")
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")

compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")

Expand Down
Loading
Loading