9
9
10
10
"github.com/aws/aws-sdk-go/aws"
11
11
"go.opentelemetry.io/collector/pdata/pcommon"
12
- conventions "go.opentelemetry.io/collector/semconv/v1.12.0"
12
+ conventionsv112 "go.opentelemetry.io/collector/semconv/v1.12.0"
13
+ conventions "go.opentelemetry.io/collector/semconv/v1.27.0"
13
14
14
15
awsxray "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray"
15
16
)
@@ -58,71 +59,71 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
58
59
filtered := make (map [string ]pcommon.Value )
59
60
resource .Attributes ().Range (func (key string , value pcommon.Value ) bool {
60
61
switch key {
61
- case conventions .AttributeCloudProvider :
62
+ case conventionsv112 .AttributeCloudProvider :
62
63
cloud = value .Str ()
63
- case conventions .AttributeCloudPlatform :
64
+ case conventionsv112 .AttributeCloudPlatform :
64
65
service = value .Str ()
65
- case conventions .AttributeCloudAccountID :
66
+ case conventionsv112 .AttributeCloudAccountID :
66
67
account = value .Str ()
67
- case conventions .AttributeCloudAvailabilityZone :
68
+ case conventionsv112 .AttributeCloudAvailabilityZone :
68
69
zone = value .Str ()
69
- case conventions .AttributeHostID :
70
+ case conventionsv112 .AttributeHostID :
70
71
hostID = value .Str ()
71
- case conventions .AttributeHostType :
72
+ case conventionsv112 .AttributeHostType :
72
73
hostType = value .Str ()
73
- case conventions .AttributeHostImageID :
74
+ case conventionsv112 .AttributeHostImageID :
74
75
amiID = value .Str ()
75
- case conventions .AttributeContainerName :
76
+ case conventionsv112 .AttributeContainerName :
76
77
if container == "" {
77
78
container = value .Str ()
78
79
}
79
- case conventions .AttributeK8SPodName :
80
+ case conventionsv112 .AttributeK8SPodName :
80
81
podUID = value .Str ()
81
- case conventions .AttributeServiceNamespace :
82
+ case conventionsv112 .AttributeServiceNamespace :
82
83
namespace = value .Str ()
83
- case conventions .AttributeServiceInstanceID :
84
+ case conventionsv112 .AttributeServiceInstanceID :
84
85
deployID = value .Str ()
85
- case conventions .AttributeServiceVersion :
86
+ case conventionsv112 .AttributeServiceVersion :
86
87
versionLabel = value .Str ()
87
- case conventions .AttributeTelemetrySDKName :
88
+ case conventionsv112 .AttributeTelemetrySDKName :
88
89
sdkName = value .Str ()
89
- case conventions .AttributeTelemetrySDKLanguage :
90
+ case conventionsv112 .AttributeTelemetrySDKLanguage :
90
91
sdkLanguage = value .Str ()
91
- case conventions .AttributeTelemetrySDKVersion :
92
+ case conventionsv112 .AttributeTelemetrySDKVersion :
92
93
sdkVersion = value .Str ()
93
- case conventions .AttributeTelemetryAutoVersion :
94
+ case conventionsv112 .AttributeTelemetryAutoVersion , conventions . AttributeTelemetryDistroVersion :
94
95
autoVersion = value .Str ()
95
- case conventions .AttributeContainerID :
96
+ case conventionsv112 .AttributeContainerID :
96
97
containerID = value .Str ()
97
- case conventions .AttributeK8SClusterName :
98
+ case conventionsv112 .AttributeK8SClusterName :
98
99
clusterName = value .Str ()
99
- case conventions .AttributeAWSECSClusterARN :
100
+ case conventionsv112 .AttributeAWSECSClusterARN :
100
101
clusterArn = value .Str ()
101
- case conventions .AttributeAWSECSContainerARN :
102
+ case conventionsv112 .AttributeAWSECSContainerARN :
102
103
containerArn = value .Str ()
103
- case conventions .AttributeAWSECSTaskARN :
104
+ case conventionsv112 .AttributeAWSECSTaskARN :
104
105
taskArn = value .Str ()
105
- case conventions .AttributeAWSECSTaskFamily :
106
+ case conventionsv112 .AttributeAWSECSTaskFamily :
106
107
taskFamily = value .Str ()
107
- case conventions .AttributeAWSECSLaunchtype :
108
+ case conventionsv112 .AttributeAWSECSLaunchtype :
108
109
launchType = value .Str ()
109
- case conventions .AttributeAWSLogGroupNames :
110
+ case conventionsv112 .AttributeAWSLogGroupNames :
110
111
logGroups = normalizeToSlice (value )
111
- case conventions .AttributeAWSLogGroupARNs :
112
+ case conventionsv112 .AttributeAWSLogGroupARNs :
112
113
logGroupArns = normalizeToSlice (value )
113
114
}
114
115
return true
115
116
})
116
117
117
118
if awsOperation , ok := attributes [awsxray .AWSOperationAttribute ]; ok {
118
119
operation = awsOperation .Str ()
119
- } else if rpcMethod , ok := attributes [conventions .AttributeRPCMethod ]; ok {
120
+ } else if rpcMethod , ok := attributes [conventionsv112 .AttributeRPCMethod ]; ok {
120
121
operation = rpcMethod .Str ()
121
122
}
122
123
123
124
for key , value := range attributes {
124
125
switch key {
125
- case conventions .AttributeRPCMethod :
126
+ case conventionsv112 .AttributeRPCMethod :
126
127
// Determinstically handled with if else above
127
128
case awsxray .AWSOperationAttribute :
128
129
// Determinstically handled with if else above
@@ -148,15 +149,15 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
148
149
filtered [key ] = value
149
150
}
150
151
}
151
- if cloud != conventions .AttributeCloudProviderAWS && cloud != "" {
152
+ if cloud != conventionsv112 .AttributeCloudProviderAWS && cloud != "" {
152
153
return filtered , nil // not AWS so return nil
153
154
}
154
155
155
156
// Favor Semantic Conventions for specific SQS and DynamoDB attributes.
156
- if value , ok := attributes [conventions .AttributeMessagingURL ]; ok {
157
+ if value , ok := attributes [conventionsv112 .AttributeMessagingURL ]; ok {
157
158
queueURL = value .Str ()
158
159
}
159
- if value , ok := attributes [conventions .AttributeAWSDynamoDBTableNames ]; ok {
160
+ if value , ok := attributes [conventionsv112 .AttributeAWSDynamoDBTableNames ]; ok {
160
161
switch value .Type () {
161
162
case pcommon .ValueTypeSlice :
162
163
if value .Slice ().Len () == 1 {
@@ -176,7 +177,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
176
177
// EC2 - add ec2 metadata to xray request if
177
178
// 1. cloud.platfrom is set to "aws_ec2" or
178
179
// 2. there is an non-blank host/instance id found
179
- if service == conventions .AttributeCloudPlatformAWSEC2 || hostID != "" {
180
+ if service == conventionsv112 .AttributeCloudPlatformAWSEC2 || hostID != "" {
180
181
ec2 = & awsxray.EC2Metadata {
181
182
InstanceID : awsxray .String (hostID ),
182
183
AvailabilityZone : awsxray .String (zone ),
@@ -186,7 +187,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
186
187
}
187
188
188
189
// ECS
189
- if service == conventions .AttributeCloudPlatformAWSECS {
190
+ if service == conventionsv112 .AttributeCloudPlatformAWSECS {
190
191
ecs = & awsxray.ECSMetadata {
191
192
ContainerName : awsxray .String (container ),
192
193
ContainerID : awsxray .String (containerID ),
@@ -200,7 +201,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
200
201
}
201
202
202
203
// Beanstalk
203
- if service == conventions .AttributeCloudPlatformAWSElasticBeanstalk && deployID != "" {
204
+ if service == conventionsv112 .AttributeCloudPlatformAWSElasticBeanstalk && deployID != "" {
204
205
deployNum , err := strconv .ParseInt (deployID , 10 , 64 )
205
206
if err != nil {
206
207
deployNum = 0
@@ -213,7 +214,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
213
214
}
214
215
215
216
// EKS or native Kubernetes
216
- if service == conventions .AttributeCloudPlatformAWSEKS || clusterName != "" {
217
+ if service == conventionsv112 .AttributeCloudPlatformAWSEKS || clusterName != "" {
217
218
eks = & awsxray.EKSMetadata {
218
219
ClusterName : awsxray .String (clusterName ),
219
220
Pod : awsxray .String (podUID ),
@@ -242,7 +243,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
242
243
243
244
if sdkName != "" && sdkLanguage != "" {
244
245
// Convention for SDK name for xray SDK information is e.g., `X-Ray SDK for Java`, `X-Ray for Go`.
245
- // We fill in with e.g, `opentelemetry for java` by using the conventions
246
+ // We fill in with e.g, `opentelemetry for java` by using the conventionsv112
246
247
sdk = sdkName + " for " + sdkLanguage
247
248
} else {
248
249
sdk = sdkName
0 commit comments