-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add EKS integration testing for APM Traces #327
Conversation
util/awsservice/constant.go
Outdated
@@ -48,4 +48,5 @@ var ( | |||
DynamodbClient = dynamodb.NewFromConfig(awsCfg) | |||
S3Client = s3.NewFromConfig(awsCfg) | |||
CloudformationClient = cloudformation.NewFromConfig(awsCfg) | |||
XrayClient = xray.NewFromConfig(awsCfg) |
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.
Not sure why this didn't format correctly...it's lined up on my local.
terraform/eks/daemon/apm/main.tf
Outdated
} | ||
} | ||
command = [ | ||
"/bin/sh", | ||
"-c", | ||
"while true; do echo '${data.template_file.server_consumer.rendered}' | sed -e \"s/START_TIME/$(date +%s%N)/\" > server_consumer.json; curl -H 'Content-Type: application/json' -d @server_consumer.json -i http://127.0.0.1:4318/v1/metrics --verbose --http0.9; echo '${data.template_file.client_producer.rendered}' | sed -e \"s/START_TIME/$(date +%s%N)/\" > client_producer.json; curl -H 'Content-Type: application/json' -d @client_producer.json -i http://127.0.0.1:4318/v1/metrics --verbose --http0.9; sleep 1; done" | ||
"while true; echo '${data.template_file.traceid_generator.rendered}' > traceid_generator.go && chmod +x traceid_generator.go; export START_TIME=$(date +%s%N); export TRACE_ID=$(go run ./traceid_generator.go); do echo '${data.template_file.server_consumer.rendered}' | sed -e \"s/START_TIME/$START_TIME/\" > server_consumer.json; curl -H 'Content-Type: application/json' -d @server_consumer.json -i http://127.0.0.1:4318/v1/metrics --verbose; echo '${data.template_file.client_producer.rendered}' | sed -e \"s/START_TIME/$START_TIME/\" > client_producer.json; curl -H 'Content-Type: application/json' -d @client_producer.json -i http://127.0.0.1:4318/v1/metrics --verbose; echo '${data.template_file.traces.rendered}' | sed -e \"s/START_TIME/$START_TIME/\" | sed -e \"s/TRACE_ID/$TRACE_ID/\" > traces.json; curl -H 'Content-Type: application/json' -d @traces.json -i http://127.0.0.1:4318/v1/traces --verbose; sleep 1; done" |
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 understand what this is doing, but I think it's still hard to follow. Can we build the generator?
nit: There has to be a better way to mount the files you need to run in this container instead of the template rendering.
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.
yeah ideally we can build the generator bin, and mount it on a volume along with the other json files. The templating comes from the metric tests which I've borrowed.
I could try to spend some time to make this cleaner and easier to follow
data "template_file" "traces" { | ||
template = file(local.traces) | ||
vars = { | ||
} | ||
} |
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.
nit: Use local_file instead of template_file if it isn't templating anything.
data "template_file" "traces" { | |
template = file(local.traces) | |
vars = { | |
} | |
} | |
data "local_file" "traces" { | |
filename = local.traces | |
} |
"time" | ||
) | ||
|
||
func main() { |
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 understand that this is probably to avoid dependencies, but https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/propagators/aws/xray provides an ID generator, which is what customers would be using as well.
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.
oh nice! I can look into this
Description of the issue
Description of changes
Was hoping to get this CR merged in first but can refactor afterwards - https://github.com/aws/amazon-cloudwatch-agent-test/pull/318/files
I took some functions from this CR for validation logic.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
Succeeded test - https://github.com/aws/private-amazon-cloudwatch-agent-staging/actions/runs/5777874930/job/15660745029