Skip to content

Commit e846069

Browse files
committed
Pull Request review changes for #27232
- Define "aws-api" as a const - Rename some variables in cause.go to make the intended behavior a little more clear - PR: #27232
1 parent 7c037ad commit e846069

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

exporter/awsxrayexporter/internal/translator/cause.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,23 @@ func makeCause(span ptrace.Span, attributes map[string]pcommon.Value, resource p
3939
)
4040

4141
isAwsSdkSpan := isAwsSdkSpan(span)
42-
hasExceptions := false
42+
hasExceptionEvents := false
4343
hasAwsIndividualHTTPError := false
4444
for i := 0; i < span.Events().Len(); i++ {
4545
event := span.Events().At(i)
4646
if event.Name() == ExceptionEventName {
47-
hasExceptions = true
47+
hasExceptionEvents = true
4848
break
4949
}
5050
if isAwsSdkSpan && event.Name() == AwsIndividualHTTPEventName {
5151
hasAwsIndividualHTTPError = true
5252
break
5353
}
5454
}
55+
hasExceptions := hasExceptionEvents || hasAwsIndividualHTTPError
5556

5657
switch {
57-
case hasExceptions || hasAwsIndividualHTTPError:
58+
case hasExceptions:
5859
language := ""
5960
if val, ok := resource.Attributes().Get(conventions.AttributeTelemetrySDKLanguage); ok {
6061
language = val.Str()

exporter/awsxrayexporter/internal/translator/segment.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const (
5353
defaultSegmentName = "span"
5454
// maxSegmentNameLength the maximum length of a Segment name
5555
maxSegmentNameLength = 200
56+
// rpc.system value for AWS service remotes
57+
awsAPIRPCSystem = "aws-api"
5658
)
5759

5860
const (
@@ -82,7 +84,7 @@ func MakeSegmentDocumentString(span ptrace.Span, resource pcommon.Resource, inde
8284
func isAwsSdkSpan(span ptrace.Span) bool {
8385
attributes := span.Attributes()
8486
if rpcSystem, ok := attributes.Get(conventions.AttributeRPCSystem); ok {
85-
return rpcSystem.Str() == "aws-api"
87+
return rpcSystem.Str() == awsAPIRPCSystem
8688
}
8789
return false
8890
}

0 commit comments

Comments
 (0)