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

[Resources.AWS] Move string literals to AWS Semantic Conventions class #2363

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 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";
}
Loading