From 86c5831e9f07bbfb949c81587dc1995843a1919c Mon Sep 17 00:00:00 2001 From: Andrew Hobson Date: Wed, 19 Jul 2023 16:30:42 +0000 Subject: [PATCH] Filter out aws log group/stream ARNs so AWS Xray log display works --- pkg/telemetry/init.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/telemetry/init.go b/pkg/telemetry/init.go index 0f146d281272..e45c5f0548e3 100644 --- a/pkg/telemetry/init.go +++ b/pkg/telemetry/init.go @@ -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