-
Notifications
You must be signed in to change notification settings - Fork 575
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
Implement aws.ecs.* resource attributes #2626
Implement aws.ecs.* resource attributes #2626
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2626 +/- ##
=======================================
- Coverage 69.7% 68.9% -0.8%
=======================================
Files 147 147
Lines 6806 6875 +69
=======================================
- Hits 4746 4743 -3
- Misses 1944 2014 +70
- Partials 116 118 +2
|
There's discussion on open-telemetry/opentelemetry-java#4574 (comment) whether the ARNs like the one this PR builds are actually correct. Until we are use, let's not merge :D |
Update: The uncertainty about ARNs seems sorted out |
Can we add test cases that utilize the fargate examples responses also? |
Looks like there may be slight differences between fargate and ec2 metadata response. As a sanity check can we add those example responses linked in the comment above to the unit tests? |
Done in 2ef2026. There are no factual differences that this patch cares about. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the ADOT team perspective this looks good to go.
Any long term concerns with using AWS ECS Metadata Go as it describes itself being built for fargate services?
semconv.AWSLogGroupNamesKey.String(logsOptions.AwsLogsGroup), | ||
semconv.AWSLogGroupARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)), | ||
semconv.AWSLogStreamNamesKey.String(logsOptions.AwsLogsStream), | ||
semconv.AWSLogStreamARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semconv.AWSLogGroupNamesKey.String(logsOptions.AwsLogsGroup), | |
semconv.AWSLogGroupARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)), | |
semconv.AWSLogStreamNamesKey.String(logsOptions.AwsLogsStream), | |
semconv.AWSLogStreamARNsKey.String(fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)), | |
semconv.AWSLogGroupARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:*", logsRegion, awsAccount, logsOptions.AwsLogsGroup)}), | |
semconv.AWSLogStreamARNsKey.StringSlice([]string{fmt.Sprintf("arn:aws:logs:%s:%s:log-group:%s:log-stream:%s", logsRegion, awsAccount, logsOptions.AwsLogsGroup, logsOptions.AwsLogsStream)}), |
These are duplicative, so I'd suggest only including the ARN as the name can be extracted from it.
The values are expected to be string[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String slices introduced in 4e857dd. I am not sold on skipping attributes though, see #2626 (comment).
5804768
to
4e857dd
Compare
@Aneurysm9 about the duplication of Log Group|Stream Name|ARN attributes, I implemented the spec: https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/cloud_provider/aws/logs/ . They may be duplicative (provided that the backend behind does processing, which is not the case with some OSS backends that have only limited query capabilities), but at the end of the day, if we wanna drop them, I'd rather first they get dropped from the spec. |
All of the log group/stream fields are optional. There is no requirement to include all of them if any of them are included. |
IMO, this would wreak havoc with less sophisticated tracing backends that do not have processing capabilities to normalize the attributes, as the same Log stream or group could be represented with different values. |
838e75c
to
6fb0790
Compare
a47260b
to
f379b94
Compare
2fe086b
to
0654cc1
Compare
@mmanciop This requires an additional approval from @open-telemetry/go-approvers before it can be merged. |
"strings" | ||
|
||
ecsmetadata "github.com/brunoscheufler/aws-ecs-metadata-go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repository has 3 stars and 14 commits. I wonder how reliable it can be in the future.
It's also fairly simple. So we can also extract its content and bring it back into this package later on if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was committing fixed to that repo. The maintainer was nice and responsive. If worse comes to worse, can always be incorporated here.
@Aneurysm9 does this ring a bell?
I copied the test code from the Ec2Detector and the tests pass on my Mac; am I perhaps missing something in the CI configs? (The fact that the CI does not trigger every time I push a commit makes it is even more daunting to troubleshoot...) |
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
abbc6a2
to
e518c40
Compare
After a surreal session of debugging, it turns out that httptest.NewServer fails on Windows by failing to bind the server socket unless the GoLang package name contains "test". To deal with that, I split the tests between "integration tests" needing a HTTP server into "ecs/test", and the other in "ecs". In order to work around the need of being resilient to the lack of /proc/self/cgroup (which happens in our tests but, above all, when running containers on Windows), the ECVS detector is now more lenient to not finding the container id.
Implemented retrieving the
aws.ecs.*
resource attributes ingo.opentelemetry.io/detectors/aws/ecs
based on the ECS Metadata v4 endpoint.