Skip to content

Commit 61252ba

Browse files
committed
instrument ECS branch with X-Ray
1 parent b1957f5 commit 61252ba

File tree

22 files changed

+175
-6
lines changed

22 files changed

+175
-6
lines changed

.ebextensions/xray.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
option_settings:
2+
aws:elasticbeanstalk:xray:
3+
XRayEnabled: true
4+
5+
files:
6+
"/opt/elasticbeanstalk/tasks/taillogs.d/xray-daemon.conf" :
7+
mode: "000644"
8+
owner: root
9+
group: root
10+
content: |
11+
/var/log/xray/xray.log

bin/bundle-source.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
git archive --format=zip HEAD > eb-java-scorekeep-xray-gettingstarted-v1.zip
2+
unzip -l eb-java-scorekeep-xray-gettingstarted-v1.zip

bin/full-traces.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
EPOCH=$(date +%s)
2+
echo "epoch is $EPOCH"
3+
TRACEIDS=$(aws xray get-trace-summaries --start-time $(($EPOCH-120)) --end-time $(($EPOCH-60)) --query 'TraceSummaries[*].Id' --output text | cut -c 1-180)
4+
aws xray batch-get-traces --trace-ids $TRACEIDS --query 'Traces[*]'

bin/put-trace-segments.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aws xray put-trace-segments --trace-segment-documents "{\"id\":\"20312a0e2b8809f4\",\"name\":\"DynamoDB\",\"trace_id\":\"1-5832862d-a43aafded3334a971fe312db\",\"start_time\":1.479706157195E9,\"end_time\":1.479706157202E9,\"parent_id\":\"79736b962fe3239e\",\"http\":{\"response\":{\"content_length\":60,\"status\":200}},\"inferred\":true,\"aws\":{\"consistent_read\":false,\"table_name\":\"scorekeep-session-xray\",\"operation\":\"GetItem\",\"request_id\":\"SCAU23OM6M8FO38UASGC7785ARVV4KQNSO5AEMVJF66Q9ASUAAJG\",\"resource_names\":[\"scorekeep-session-xray\"]},\"origin\":\"AWS::DynamoDB::Table\"}"

bin/service-graph.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EPOCH=$(date +%s)
2+
echo "epoch is $EPOCH"
3+
aws xray get-service-graph --start-time $(($EPOCH-600)) --end-time $EPOCH

bin/trace-summaries.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
EPOCH=$(date +%s)
2+
echo "epoch is $EPOCH"
3+
aws xray get-trace-summaries --start-time $(($EPOCH-120)) --end-time $(($EPOCH-60))
4+

bin/trace-urls.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EPOCH=$(date +%s)
2+
echo "epoch is $EPOCH"
3+
aws xray get-trace-summaries --start-time $(($EPOCH-120)) --end-time $(($EPOCH-60)) --query 'TraceSummaries[*].Http.HttpURL'

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ dependencies {
3333
testCompile("org.springframework.boot:spring-boot-starter-test")
3434
compile("com.amazonaws:aws-java-sdk-dynamodb")
3535
compile("com.amazonaws:aws-java-sdk-sns")
36+
compile("com.amazonaws:aws-xray-recorder-sdk-core")
37+
compile("com.amazonaws:aws-xray-recorder-sdk-aws-sdk")
38+
compile("com.amazonaws:aws-xray-recorder-sdk-aws-sdk-instrumentor")
3639
compile("com.fasterxml.jackson.core:jackson-databind:2.8.4")
3740
testCompile("org.junit.jupiter:junit-jupiter-api:5.0.0")
3841
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.0.0")
@@ -41,6 +44,7 @@ dependencies {
4144
dependencyManagement {
4245
imports {
4346
mavenBom("com.amazonaws:aws-java-sdk-bom:1.11.67")
47+
mavenBom("com.amazonaws:aws-xray-recorder-sdk-bom:1.2.0")
4448
}
4549
}
4650
task wrapper(type: Wrapper) {

cloudformation/cf-resources.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Resources:
9090
Type: AWS::ECR::Repository
9191
Properties:
9292
RepositoryName: "scorekeep-frontend"
93+
XRayDaemonRepository:
94+
Type: AWS::ECR::Repository
95+
Properties:
96+
RepositoryName: "xray-daemon"
9397
ECSExecutionRole:
9498
Type: AWS::IAM::Role
9599
Properties:
98.9 KB
Loading

0 commit comments

Comments
 (0)