Skip to content

Commit

Permalink
Enabled Eventuate Tram distributed tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
cer committed Nov 28, 2018
1 parent 7b084b2 commit 56edc2c
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 65 deletions.
3 changes: 2 additions & 1 deletion build-and-test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ fi

./wait-for-services.sh

./gradlew :ftgo-end-to-end-tests:cleanTest :ftgo-end-to-end-tests:test
./run-end-to-end-tests.sh


./run-graphql-api-gateway-tests.sh

Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:$springDependencyManagementPluginVersion"
}

apply plugin: WaitForMySqlPlugin
Expand Down
32 changes: 32 additions & 0 deletions buildSrc/src/main/groovy/FtgoServicePlugin.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test

class FtgoServicePlugin implements Plugin<Project> {

@Override
void apply(Project project) {

project.apply(plugin: 'org.springframework.boot')
project.apply(plugin: "io.spring.dependency-management")

project.dependencyManagement {
imports {
mavenBom "org.springframework" +
".cloud:spring-cloud-contract-dependencies:${project.ext.springCloudContractDependenciesVersion}"
mavenBom "org.springframework.cloud:spring-cloud-sleuth:${project.ext.springCloudSleuthVersion}"
}
}


project.dependencies {

compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
compile 'org.springframework.cloud:spring-cloud-starter-zipkin'
compile 'io.zipkin.brave:brave-bom:4.17.1'

compile "io.eventuate.tram.core:eventuate-tram-spring-cloud-sleuth-integration:${project.ext.eventuateTramVersion}"
}

}
}
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ services:
EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
JAVA_OPTS: -Xmx192m
SPRING_SLEUTH_ENABLED: "true"
SPRING_SLEUTH_SAMPLER_PROBABILITY: 1
SPRING_ZIPKIN_BASE_URL: http://zipkin:9411/
ftgo-order-service:
build: ./ftgo-order-service
ports:
Expand Down Expand Up @@ -112,6 +115,9 @@ services:
EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
JAVA_OPTS: -Xmx192m
SPRING_SLEUTH_ENABLED: "true"
SPRING_SLEUTH_SAMPLER_PROBABILITY: 1
SPRING_ZIPKIN_BASE_URL: http://zipkin:9411/
ftgo-restaurant-service:
build: ./ftgo-restaurant-service
ports:
Expand All @@ -129,6 +135,9 @@ services:
EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
JAVA_OPTS: -Xmx192m
SPRING_SLEUTH_ENABLED: "true"
SPRING_SLEUTH_SAMPLER_PROBABILITY: 1
SPRING_ZIPKIN_BASE_URL: http://zipkin:9411/
ftgo-accounting-service:
build: ./ftgo-accounting-service
ports:
Expand All @@ -146,6 +155,9 @@ services:
EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
JAVA_OPTS: -Xmx192m
SPRING_SLEUTH_ENABLED: "true"
SPRING_SLEUTH_SAMPLER_PROBABILITY: 1
SPRING_ZIPKIN_BASE_URL: http://zipkin:9411/
ftgo-order-history-service:
build: ./ftgo-order-history-service
ports:
Expand All @@ -168,6 +180,9 @@ services:
AWS_DYNAMODB_ENDPOINT_URL: http://dynamodblocal:8000
AWS_REGION: ${AWS_REGION:-us-west-2}
JAVA_OPTS: -Xmx192m
SPRING_SLEUTH_ENABLED: "true"
SPRING_SLEUTH_SAMPLER_PROBABILITY: 1
SPRING_ZIPKIN_BASE_URL: http://zipkin:9411/
ftgo-api-gateway:
build: ./ftgo-api-gateway
ports:
Expand Down
2 changes: 1 addition & 1 deletion ftgo-accounting-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

apply plugin: 'org.springframework.boot'
apply plugin: FtgoServicePlugin


dependencies {
Expand Down
23 changes: 23 additions & 0 deletions ftgo-accounting-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spring.application.name=ftgo-accounting-service

spring.jpa.generate-ddl=true
logging.level.org.springframework.orm.jpa=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.io.eventuate=DEBUG
logging.level.net.chrisrichardson.ftgo=DEBUG
logging.level.io.eventuate.tram=TRACE
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver.class.name=com.mysql.jdbc.Driver
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/bankingexampledb

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=rootpassword
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181

aws.access.key_id=id_key
aws.secret.access.key=access_key
aws.dynamodb.endpoint.url=http://${DOCKER_HOST_IP:localhost}:8000
aws.region=us-west-2
1 change: 0 additions & 1 deletion ftgo-api-gateway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {

apply plugin: "io.spring.dependency-management"


apply plugin: "java"
apply plugin: 'org.springframework.boot'

Expand Down
4 changes: 2 additions & 2 deletions ftgo-consumer-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

apply plugin: 'org.springframework.boot'

apply plugin: FtgoServicePlugin

dependencies {

dependencies {

compile "io.eventuate.tram.core:eventuate-tram-jdbc-kafka:$eventuateTramVersion"
compile "io.eventuate.tram.core:eventuate-tram-events:$eventuateTramVersion"
Expand Down
17 changes: 17 additions & 0 deletions ftgo-consumer-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
spring.application.name=ftgo-consumer-service

spring.jpa.generate-ddl=true
logging.level.org.springframework.orm.jpa=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.io.eventuate=DEBUG
logging.level.net.chrisrichardson.ftgo=DEBUG
logging.level.io.eventuate.tram=TRACE
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver.class.name=com.mysql.jdbc.Driver

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=rootpassword
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181
2 changes: 1 addition & 1 deletion ftgo-kitchen-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contracts {
baseClassForTests = 'net.chrisrichardson.ftgo.kitchenservice.contract.AbstractKitchenServiceConsumerContractTest'
}

apply plugin: 'org.springframework.boot'
apply plugin: FtgoServicePlugin


dependencies {
Expand Down
23 changes: 23 additions & 0 deletions ftgo-kitchen-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spring.application.name=ftgo-kitchen-service

spring.jpa.generate-ddl=true
logging.level.org.springframework.orm.jpa=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.io.eventuate=DEBUG
logging.level.net.chrisrichardson.ftgo=DEBUG
logging.level.io.eventuate.tram=TRACE
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver.class.name=com.mysql.jdbc.Driver
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/bankingexampledb

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=rootpassword
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181

aws.access.key_id=id_key
aws.secret.access.key=access_key
aws.dynamodb.endpoint.url=http://${DOCKER_HOST_IP:localhost}:8000
aws.region=us-west-2
2 changes: 1 addition & 1 deletion ftgo-order-history-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
}

apply plugin: 'org.springframework.boot'
apply plugin: FtgoServicePlugin
apply plugin: "io.spring.dependency-management"
apply plugin: 'spring-cloud-contract'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spring.application.name=ftgo-order-history-service

spring.jpa.generate-ddl=true
logging.level.org.springframework.orm.jpa=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.io.eventuate=DEBUG
logging.level.net.chrisrichardson.ftgo=DEBUG
logging.level.io.eventuate.tram=TRACE
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver.class.name=com.mysql.jdbc.Driver
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/bankingexampledb

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=rootpassword
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181

aws.access.key_id=id_key
aws.secret.access.key=access_key
aws.dynamodb.endpoint.url=http://${DOCKER_HOST_IP:localhost}:8000
aws.region=us-west-2
16 changes: 4 additions & 12 deletions ftgo-order-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ buildscript {
}
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:$springDependencyManagementPluginVersion"
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:$springCloudContractDependenciesVersion"
classpath "com.avast.gradle:gradle-docker-compose-plugin:$dockerComposePluginVersion"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'
}
}

apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
apply plugin: FtgoServicePlugin

apply plugin: 'spring-cloud-contract'
apply plugin: 'docker-compose'
apply plugin: 'com.google.protobuf'
Expand All @@ -27,7 +26,6 @@ apply plugin: ComponentTestsPlugin
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:$springCloudContractDependenciesVersion"
mavenBom "org.springframework.cloud:spring-cloud-sleuth:$springCloudSleuthVersion"
}
}

Expand Down Expand Up @@ -108,16 +106,13 @@ idea {
dependencies {


compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
compile 'org.springframework.cloud:spring-cloud-starter-zipkin'
compile 'io.zipkin.brave:brave-bom:4.17.1'

compile project(":common-swagger")
compile project(":ftgo-common-jpa")

compile "io.eventuate.tram.core:eventuate-tram-aggregate-domain-events:$eventuateTramVersion"
compile "io.eventuate.tram.core:eventuate-tram-jdbc-kafka:$eventuateTramVersion"
compile "io.eventuate.tram.core:eventuate-tram-commands:$eventuateTramVersion"

compile "io.eventuate.tram.sagas:eventuate-tram-sagas-simple-dsl:$eventuateTramSagasVersion"

compile project(":ftgo-accounting-service-api")
Expand All @@ -143,7 +138,7 @@ dependencies {
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

// Added this stuff

testCompile "net.chrisrichardson.ftgo:ftgo-accounting-service-contracts:unspecified:stubs"
testCompile "net.chrisrichardson.ftgo:ftgo-consumer-service-contracts:unspecified:stubs"
testCompile "net.chrisrichardson.ftgo:ftgo-kitchen-service-contracts:unspecified:stubs"
Expand All @@ -163,6 +158,3 @@ dependencies {
testCompile project(":ftgo-test-util")

}



Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
spring.application.name=ftgo-order-service

spring.sleuth.sampler.probability=1.0
spring.sleuth.web.skipPattern=(^health.*)

management.endpoints.web.exposure.include=health,prometheus

Expand Down
2 changes: 1 addition & 1 deletion ftgo-restaurant-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

apply plugin: 'org.springframework.boot'
apply plugin: FtgoServicePlugin


dependencies {
Expand Down
23 changes: 23 additions & 0 deletions ftgo-restaurant-service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
spring.application.name=ftgo-restaurant-service

spring.jpa.generate-ddl=true
logging.level.org.springframework.orm.jpa=INFO
logging.level.org.hibernate.SQL=DEBUG
logging.level.io.eventuate=DEBUG
logging.level.net.chrisrichardson.ftgo=DEBUG
logging.level.io.eventuate.tram=TRACE
spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/eventuate
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver.class.name=com.mysql.jdbc.Driver
spring.data.mongodb.uri=mongodb://${DOCKER_HOST_IP:localhost}/bankingexampledb

eventuatelocal.kafka.bootstrap.servers=${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=rootpassword
eventuatelocal.zookeeper.connection.string=${DOCKER_HOST_IP:localhost}:2181

aws.access.key_id=id_key
aws.secret.access.key=access_key
aws.dynamodb.endpoint.url=http://${DOCKER_HOST_IP:localhost}:8000
aws.region=us-west-2
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ springDependencyManagementPluginVersion=1.0.3.RELEASE
eventuateClientVersion=0.20.1.RELEASE
eventuateLocalVersion=0.22.1.RELEASE

eventuateTramVersion=0.11.1.RELEASE
eventuateTramVersion=0.12.0.RELEASE
eventuateTramSagasVersion=0.7.0.RELEASE
eventuateUtilVersion=0.1.0.RELEASE

Expand Down
43 changes: 0 additions & 43 deletions run-end-to-end-tests.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
#! /bin/bash -e

. ./set-env.sh

KEEP_RUNNING=

while [ ! -z "$*" ] ; do
case $1 in
"--keep-running" )
KEEP_RUNNING=yes
;;
"--help" )
echo ./run-end-to-end-tests.sh --keep-running --assemble-only
;;
esac
shift
done

initializeDynamoDB() {
./initialize-dynamodb.sh
}


./gradlew assemble

docker-compose up -d --build dynamodblocal mysql

./wait-for-mysql.sh

echo mysql is started

initializeDynamoDB

docker-compose up -d --build

date

./wait-for-services.sh

./gradlew :ftgo-end-to-end-tests:cleanTest :ftgo-end-to-end-tests:test

./run-graphql-api-gateway-tests.sh

if [ -z "$KEEP_RUNNING" ] ; then
docker-compose down -v
fi

0 comments on commit 56edc2c

Please sign in to comment.