Skip to content

Commit

Permalink
Filter out aws log group/stream ARNs so AWS Xray log display works
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hobson committed Jul 19, 2023
1 parent 0b4f846 commit 86c5831
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/telemetry/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,25 @@ func Init(logger *zap.Logger, config *Config) (shutdown func()) {
}
if ecsResource.Attributes() != nil {
logger.Info("ECS resource for telemetry", zap.Any("attributes", ecsResource.Attributes()))
resourceAttrs = append(resourceAttrs, ecsResource.Attributes()...)
ecsAttrs := ecsResource.Attributes()
for _, attr := range ecsAttrs {
// For unknown reasons, when viewing traces in the AWS
// console, the logs do not show up. Looking at the
// network requests in the developer tools, I see errors
// that say
//
// Querying LogGroups by ARN is not supported
//
// Clicking on the "View in CloudWatch Logs Insights"
// button does work, but it is a better user experience to
// be able to preview the logs
//
// Filter out the log ARN attributes so things work.
// *sigh*
if attr.Key != semconv.AWSLogGroupARNsKey && attr.Key != semconv.AWSLogStreamARNsKey {
resourceAttrs = append(resourceAttrs, attr)
}
}
}

// only add a single sdktrace.WithResource option, as adding more
Expand Down

0 comments on commit 86c5831

Please sign in to comment.