Skip to content

Commit 85f4749

Browse files
author
Michael Wunderlich
committed
use AWS X-Ray
1 parent b76a9d4 commit 85f4749

29 files changed

+581
-56
lines changed

.ebextensions/dev.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ option_settings:
44
aws:elasticbeanstalk:command:
55
DeploymentPolicy: AllAtOnce
66
IgnoreHealthCheck: "true"
7+
Timeout: 300
78
aws:elasticbeanstalk:monitoring:
89
Automatically Terminate Unhealthy Instances: "false"
910
aws:elasticbeanstalk:healthreporting:system:

.ebextensions/xray.config

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
commands:
2+
01-stop-tracing:
3+
command: yum remove -y xray
4+
ignoreErrors: true
5+
02-copy-tracing:
6+
command: curl https://s3.amazonaws.com/aws-xray-assets.us-east-1/xray-daemon/aws-xray-daemon-1.x.rpm -o /home/ec2-user/xray.rpm
7+
03-start-tracing:
8+
command: yum install -y /home/ec2-user/xray.rpm
9+
10+
files:
11+
"/opt/elasticbeanstalk/tasks/taillogs.d/xray-daemon.conf" :
12+
mode: "000644"
13+
owner: root
14+
group: root
15+
content: |
16+
/var/log/xray/xray.log
17+
"/etc/amazon/xray/cfg.yaml" :
18+
mode: "000644"
19+
owner: root
20+
group: root
21+
content: |
22+
Logging:
23+
LogLevel: "warn"

Buildfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
build: gradle build
1+
01build: gradle build

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: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,26 @@ targetCompatibility = 1.8
2828

2929
dependencies {
3030
compile("org.springframework.boot:spring-boot-starter-web")
31+
compile("org.springframework.boot:spring-boot-starter-data-jpa")
3132
testCompile("org.springframework.boot:spring-boot-starter-test")
3233
compile("com.amazonaws:aws-java-sdk-dynamodb")
34+
compile("com.amazonaws:aws-xray-recorder-sdk-core")
35+
compile("com.amazonaws:aws-xray-recorder-sdk-aws-sdk")
36+
compile("com.amazonaws:aws-xray-recorder-sdk-aws-sdk-instrumentor")
37+
compile("com.amazonaws:aws-xray-recorder-sdk-apache-http")
38+
compile("com.amazonaws:aws-xray-recorder-sdk-sql-postgres")
39+
compile("com.amazonaws:aws-xray-recorder-sdk-sql-mysql")
40+
compile("com.h2database:h2:1.4.193")
41+
compile("org.postgresql:postgresql:9.4.1211.jre7")
3342
testCompile("junit:junit:4.11")
3443
compile("com.fasterxml.jackson.core:jackson-databind:2.8.4")
44+
compile("commons-validator:commons-validator:1.5.1")
3545
}
3646

3747
dependencyManagement {
3848
imports {
39-
mavenBom("com.amazonaws:aws-java-sdk-bom:1.11.39")
49+
mavenBom("com.amazonaws:aws-java-sdk-bom:1.11.52")
50+
mavenBom("com.amazonaws:aws-xray-recorder-sdk-bom:1.0.0-beta")
4051
}
4152
}
4253
task wrapper(type: Wrapper) {

public/app/game-history-model.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var module = angular.module('scorekeep');
2+
module.service('GameHistoryModel', function($http, GameHistoryService, api) {
3+
var model = {};
4+
5+
model.get = function() {
6+
return GameHistoryService.query().$promise;
7+
};
8+
9+
model.create = function() {
10+
var service = new GameHistoryService();
11+
return service.$save();
12+
};
13+
return model;
14+
});

0 commit comments

Comments
 (0)