Skip to content

Commit

Permalink
Move string literals to AWS Semnatic Conventions class
Browse files Browse the repository at this point in the history
  • Loading branch information
ppittle committed Dec 5, 2024
1 parent 053fc35 commit 5a21cd2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/OpenTelemetry.Resources.AWS/AWSEBSDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ internal static List<KeyValuePair<string, object>> ExtractResourceAttributes(AWS
{
var resourceAttributes = new List<KeyValuePair<string, object>>()
{
new(AWSSemanticConventions.AttributeCloudProvider, "aws"),
new(AWSSemanticConventions.AttributeCloudPlatform, "aws_elastic_beanstalk"),
new(AWSSemanticConventions.AttributeServiceName, "aws_elastic_beanstalk"),
new(AWSSemanticConventions.AttributeCloudProvider, AWSSemanticConventions.CloudProviderValuesAws),
new(AWSSemanticConventions.AttributeCloudPlatform, AWSSemanticConventions.CloudPlatformValuesAwsElasticBeanstalk),
new(AWSSemanticConventions.AttributeServiceName, AWSSemanticConventions.ServiceNameValuesAwsElasticBeanstalk),
};

if (metadata != null)
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Resources.AWS/AWSEC2Detector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ internal static List<KeyValuePair<string, object>> ExtractResourceAttributes(AWS
{
var resourceAttributes = new List<KeyValuePair<string, object>>()
{
new(AWSSemanticConventions.AttributeCloudProvider, "aws"),
new(AWSSemanticConventions.AttributeCloudPlatform, "aws_ec2"),
new(AWSSemanticConventions.AttributeCloudProvider, AWSSemanticConventions.CloudProviderValuesAws),
new(AWSSemanticConventions.AttributeCloudPlatform, AWSSemanticConventions.CloudPlatformValuesAwsEc2),
new(AWSSemanticConventions.AttributeHostName, hostName),
};

Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Resources.AWS/AWSECSDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public Resource Detect()

var resourceAttributes = new List<KeyValuePair<string, object>>()
{
new(AWSSemanticConventions.AttributeCloudProvider, "aws"),
new(AWSSemanticConventions.AttributeCloudPlatform, "aws_ecs"),
new(AWSSemanticConventions.AttributeCloudProvider, AWSSemanticConventions.CloudProviderValuesAws),
new(AWSSemanticConventions.AttributeCloudPlatform, AWSSemanticConventions.CloudPlatformValuesAwsEcs),
};

try
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Resources.AWS/AWSEKSDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ internal static List<KeyValuePair<string, object>> ExtractResourceAttributes(str
{
var resourceAttributes = new List<KeyValuePair<string, object>>()
{
new(AWSSemanticConventions.AttributeCloudProvider, "aws"),
new(AWSSemanticConventions.AttributeCloudPlatform, "aws_eks"),
new(AWSSemanticConventions.AttributeCloudProvider, AWSSemanticConventions.CloudProviderValuesAws),
new(AWSSemanticConventions.AttributeCloudPlatform, AWSSemanticConventions.CloudPlatformValuesAwsEks),
};

if (!string.IsNullOrEmpty(clusterName))
Expand Down
6 changes: 6 additions & 0 deletions src/OpenTelemetry.Resources.AWS/AWSSemanticConventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ internal static class AWSSemanticConventions
public const string AttributeCloudProvider = "cloud.provider";
public const string AttributeCloudRegion = "cloud.region";
public const string AttributeCloudResourceId = "cloud.resource_id";
public const string CloudPlatformValuesAwsEc2 = "aws_ec2";
public const string CloudPlatformValuesAwsEcs = "aws_ecs";
public const string CloudPlatformValuesAwsEks = "aws_eks";
public const string CloudPlatformValuesAwsElasticBeanstalk = "aws_elastic_beanstalk";
public const string CloudProviderValuesAws = "aws";

public const string AttributeContainerID = "container.id";

Expand Down Expand Up @@ -43,4 +48,5 @@ internal static class AWSSemanticConventions
public const string AttributeServiceNamespace = "service.namespace";
public const string AttributeServiceInstanceID = "service.instance.id";
public const string AttributeServiceVersion = "service.version";
public const string ServiceNameValuesAwsElasticBeanstalk = "aws_elastic_beanstalk";
}

0 comments on commit 5a21cd2

Please sign in to comment.