From 98c3781675a12d7866e5645336a7b533faba8af7 Mon Sep 17 00:00:00 2001 From: William Armiros <54150514+willarmiros@users.noreply.github.com> Date: Fri, 22 Jan 2021 09:47:07 -0800 Subject: [PATCH] Added new semantic conventions (#2365) * added new semantic conventions * renamed package * removed subpackage --- translator/conventions/aws.go | 36 +++++++ translator/conventions/opentelemetry.go | 126 ++++++++++++++---------- 2 files changed, 110 insertions(+), 52 deletions(-) create mode 100644 translator/conventions/aws.go diff --git a/translator/conventions/aws.go b/translator/conventions/aws.go new file mode 100644 index 00000000000..a64dc7c139d --- /dev/null +++ b/translator/conventions/aws.go @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package conventions + +// OpenTelemetry semantic convention values for AWS-specific resource attributes +// See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/semantic_conventions/cloud_provider/aws/README.md +const ( + AttributeAWSECSContainerARN = "aws.ecs.container.arn" + AttributeAWSECSClusterARN = "aws.ecs.cluster.arn" + AttributeAWSECSLaunchType = "aws.ecs.launchtype" + AttributeAWSECSTaskARN = "aws.ecs.task.arn" + AttributeAWSECSTaskFamily = "aws.ecs.task.family" + AttributeAWSLogGroupNames = "aws.log.group.names" + AttributeAWSLogGroupARNs = "aws.log.group.arns" + AttributeAWSLogStreamNames = "aws.log.stream.names" + AttributeAWSLogStreamARNs = "aws.log.stream.arns" +) + +// OpenTelemetry Semantic Convention values for Resource attribute "aws.ecs.launchtype" values. +// See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/semantic_conventions/cloud_provider/aws/ecs.md +const ( + AttributeAWSECSLaunchTypeEC2 = "ec2" + AttributeAWSECSLaunchTypeFargate = "fargate" +) diff --git a/translator/conventions/opentelemetry.go b/translator/conventions/opentelemetry.go index 3f3b81cdf55..ec255ca22bb 100644 --- a/translator/conventions/opentelemetry.go +++ b/translator/conventions/opentelemetry.go @@ -17,58 +17,59 @@ package conventions // OpenTelemetry Semantic Convention values for Resource attribute names. // See: https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions/README.md const ( - AttributeCloudAccount = "cloud.account.id" - AttributeCloudProvider = "cloud.provider" - AttributeCloudRegion = "cloud.region" - AttributeCloudZone = "cloud.zone" - AttributeContainerID = "container.id" - AttributeContainerImage = "container.image.name" - AttributeContainerName = "container.name" - AttributeContainerTag = "container.image.tag" - AttributeDeploymentEnvironment = "deployment.environment" - AttributeFaasID = "faas.id" - AttributeFaasInstance = "faas.instance" - AttributeFaasName = "faas.name" - AttributeFaasVersion = "faas.version" - AttributeHostID = "host.id" - AttributeHostImageID = "host.image.id" - AttributeHostImageName = "host.image.name" - AttributeHostImageVersion = "host.image.version" - AttributeHostName = "host.name" - AttributeHostType = "host.type" - AttributeK8sCluster = "k8s.cluster.name" - AttributeK8sContainer = "k8s.container.name" - AttributeK8sCronJob = "k8s.cronjob.name" - AttributeK8sCronJobUID = "k8s.cronjob.uid" - AttributeK8sDaemonSet = "k8s.daemonset.name" - AttributeK8sDaemonSetUID = "k8s.daemonset.uid" - AttributeK8sDeployment = "k8s.deployment.name" - AttributeK8sDeploymentUID = "k8s.deployment.uid" - AttributeK8sJob = "k8s.job.name" - AttributeK8sJobUID = "k8s.job.uid" - AttributeK8sNamespace = "k8s.namespace.name" - AttributeK8sPod = "k8s.pod.name" - AttributeK8sPodUID = "k8s.pod.uid" - AttributeK8sReplicaSet = "k8s.replicaset.name" - AttributeK8sReplicaSetUID = "k8s.replicaset.uid" - AttributeK8sStatefulSet = "k8s.statefulset.name" - AttributeK8sStatefulSetUID = "k8s.statefulset.uid" - AttributeOSType = "os.type" - AttributeOSDescription = "os.description" - AttributeProcessCommand = "process.command" - AttributeProcessCommandLine = "process.command_line" - AttributeProcessExecutableName = "process.executable.name" - AttributeProcessExecutablePath = "process.executable.path" - AttributeProcessID = "process.pid" - AttributeProcessOwner = "process.owner" - AttributeServiceInstance = "service.instance.id" - AttributeServiceName = "service.name" - AttributeServiceNamespace = "service.namespace" - AttributeServiceVersion = "service.version" - AttributeTelemetryAutoVersion = "telemetry.auto.version" - AttributeTelemetrySDKLanguage = "telemetry.sdk.language" - AttributeTelemetrySDKName = "telemetry.sdk.name" - AttributeTelemetrySDKVersion = "telemetry.sdk.version" + AttributeCloudAccount = "cloud.account.id" + AttributeCloudProvider = "cloud.provider" + AttributeCloudRegion = "cloud.region" + AttributeCloudZone = "cloud.zone" + AttributeCloudInfrastructureService = "cloud.infrastructure_service" + AttributeContainerID = "container.id" + AttributeContainerImage = "container.image.name" + AttributeContainerName = "container.name" + AttributeContainerTag = "container.image.tag" + AttributeDeploymentEnvironment = "deployment.environment" + AttributeFaasID = "faas.id" + AttributeFaasInstance = "faas.instance" + AttributeFaasName = "faas.name" + AttributeFaasVersion = "faas.version" + AttributeHostID = "host.id" + AttributeHostImageID = "host.image.id" + AttributeHostImageName = "host.image.name" + AttributeHostImageVersion = "host.image.version" + AttributeHostName = "host.name" + AttributeHostType = "host.type" + AttributeK8sCluster = "k8s.cluster.name" + AttributeK8sContainer = "k8s.container.name" + AttributeK8sCronJob = "k8s.cronjob.name" + AttributeK8sCronJobUID = "k8s.cronjob.uid" + AttributeK8sDaemonSet = "k8s.daemonset.name" + AttributeK8sDaemonSetUID = "k8s.daemonset.uid" + AttributeK8sDeployment = "k8s.deployment.name" + AttributeK8sDeploymentUID = "k8s.deployment.uid" + AttributeK8sJob = "k8s.job.name" + AttributeK8sJobUID = "k8s.job.uid" + AttributeK8sNamespace = "k8s.namespace.name" + AttributeK8sPod = "k8s.pod.name" + AttributeK8sPodUID = "k8s.pod.uid" + AttributeK8sReplicaSet = "k8s.replicaset.name" + AttributeK8sReplicaSetUID = "k8s.replicaset.uid" + AttributeK8sStatefulSet = "k8s.statefulset.name" + AttributeK8sStatefulSetUID = "k8s.statefulset.uid" + AttributeOSType = "os.type" + AttributeOSDescription = "os.description" + AttributeProcessCommand = "process.command" + AttributeProcessCommandLine = "process.command_line" + AttributeProcessExecutableName = "process.executable.name" + AttributeProcessExecutablePath = "process.executable.path" + AttributeProcessID = "process.pid" + AttributeProcessOwner = "process.owner" + AttributeServiceInstance = "service.instance.id" + AttributeServiceName = "service.name" + AttributeServiceNamespace = "service.namespace" + AttributeServiceVersion = "service.version" + AttributeTelemetryAutoVersion = "telemetry.auto.version" + AttributeTelemetrySDKLanguage = "telemetry.sdk.language" + AttributeTelemetrySDKName = "telemetry.sdk.name" + AttributeTelemetrySDKVersion = "telemetry.sdk.version" ) // OpenTelemetry Semantic Convention values for Resource attribute "telemetry.sdk.language" values. @@ -94,6 +95,26 @@ const ( AttributeCloudProviderGCP = "gcp" ) +// OpenTelemetry Semantic Convention values for Resource attribute "cloud.infrastructure_service" values. +// See: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/semantic_conventions/cloud.md +const ( + AttributeCloudProviderAWSEC2 = "aws_ec2" + AttributeCloudProviderAWSECS = "aws_ecs" + AttributeCloudProviderAWSEKS = "aws_eks" + AttributeCloudProviderAWSLambda = "aws_lambda" + AttributeCloudProviderAWSElasticBeanstalk = "aws_elastic_beanstalk" + AttributeCloudProviderAzureVM = "azure_vm" + AttributeCloudProviderAzureContainerInstances = "azure_container_instances" + AttributeCloudProviderAzureAKS = "azure_aks" + AttributeCloudProviderAzureFunctions = "azure_functions" + AttributeCloudProviderAzureAppService = "azure_app_service" + AttributeCloudProviderGCPComputeEngine = "gcp_compute_engine" + AttributeCloudProviderGCPCloudRun = "gcp_cloud_run" + AttributeCloudProviderGCPGKE = "gcp_gke" + AttributeCloudProviderGCPCloudFunctions = "gcp_cloud_functions" + AttributeCloudProviderGCPAppEngine = "gcp_app_engine" +) + // GetResourceSemanticConventionAttributeNames a slice with all the Resource Semantic Conventions attribute names. func GetResourceSemanticConventionAttributeNames() []string { return []string{ @@ -101,6 +122,7 @@ func GetResourceSemanticConventionAttributeNames() []string { AttributeCloudProvider, AttributeCloudRegion, AttributeCloudZone, + AttributeCloudInfrastructureService, AttributeContainerID, AttributeContainerImage, AttributeContainerName,