├── zipkin-server ├── .gitignore └── manifest.yml ├── .github ├── dco.yml ├── dependabot.yml └── workflows │ └── maven.yml ├── zipkin-server-legacy ├── settings.gradle ├── src │ └── main │ │ ├── resources │ │ ├── application-cloud.yaml │ │ └── application.yaml │ │ └── java │ │ └── io │ │ └── spring │ │ └── cloud │ │ └── samples │ │ └── docs │ │ └── zipkin │ │ └── Application.java ├── manifest.yml └── build.gradle ├── acceptance-tests ├── src │ ├── test │ │ ├── resources │ │ │ ├── bootstrap.yaml │ │ │ └── logback-test.xml │ │ ├── groovy │ │ │ └── io │ │ │ │ └── spring │ │ │ │ └── cloud │ │ │ │ └── samples │ │ │ │ └── docs │ │ │ │ └── acceptance │ │ │ │ ├── common │ │ │ │ └── tech │ │ │ │ │ ├── TestConfiguration.groovy │ │ │ │ │ ├── ExceptionLoggingErrorHandler.groovy │ │ │ │ │ └── ExceptionLoggingRestTemplate.groovy │ │ │ │ └── MessageFlowTests.groovy │ │ └── java │ │ │ └── io │ │ │ └── spring │ │ │ └── cloud │ │ │ └── samples │ │ │ └── docs │ │ │ └── acceptance │ │ │ └── common │ │ │ └── tech │ │ │ └── SpanUtil.java │ └── main │ │ └── resources │ │ └── banner.txt ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── mvnw.cmd ├── pom.xml └── mvnw ├── docker-compose.yml ├── docker-compose-rabbit.yml ├── scripts ├── run_performance_tests.sh ├── curl_exception.sh ├── curl_start.sh ├── start_with_zipkin_server_and_run_tests.sh ├── start_with_running_infra.sh ├── run_acceptance_tests.sh ├── kill.sh ├── runAcceptanceTests.sh ├── start_with_wavefront.sh └── start_with_zipkin_server.sh ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── service1 ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ └── main │ │ ├── resources │ │ ├── application-logzio.yml │ │ ├── application.yaml │ │ └── logback-spring.xml │ │ └── java │ │ └── io │ │ └── spring │ │ └── cloud │ │ └── sleuth │ │ └── docs │ │ └── service1 │ │ ├── Application.java │ │ ├── Service1Controller.java │ │ └── Service2Client.java ├── manifest.yml ├── mvnw.cmd ├── pom.xml └── mvnw ├── service2 ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ └── main │ │ ├── resources │ │ ├── application-logzio.yml │ │ ├── application.yaml │ │ └── logback-spring.xml │ │ └── java │ │ └── io │ │ └── spring │ │ └── cloud │ │ └── sleuth │ │ └── docs │ │ └── service2 │ │ └── Application.java ├── manifest.yml ├── mvnw.cmd ├── pom.xml └── mvnw ├── service3 ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ └── main │ │ ├── resources │ │ ├── application-logzio.yml │ │ ├── application.yaml │ │ └── logback-spring.xml │ │ └── java │ │ └── io │ │ └── spring │ │ └── cloud │ │ └── sleuth │ │ └── docs │ │ └── service3 │ │ └── Application.java ├── manifest.yml ├── mvnw.cmd ├── pom.xml └── mvnw ├── service4 ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ └── main │ │ ├── resources │ │ ├── application-logzio.yml │ │ ├── application.yaml │ │ └── logback-spring.xml │ │ └── java │ │ └── io │ │ └── spring │ │ └── cloud │ │ └── sleuth │ │ └── docs │ │ └── service4 │ │ └── Application.java ├── manifest.yml ├── mvnw.cmd ├── pom.xml └── mvnw ├── deploy_script ├── .travis.yml ├── presentation-service ├── run.sh ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── logback-spring.xml │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── presentationservice │ │ │ └── PresentationServiceApplication.java │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── presentationservice │ │ └── PresentationServiceApplicationTests.java ├── HELP.md ├── pom.xml ├── mvnw.cmd └── mvnw ├── .gitignore ├── README.md ├── pom.xml ├── mvnw.cmd └── mvnw /zipkin-server/.gitignore: -------------------------------------------------------------------------------- 1 | zipkin.jar 2 | build/ -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | require: 2 | members: false 3 | -------------------------------------------------------------------------------- /zipkin-server-legacy/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "zipkin" 2 | -------------------------------------------------------------------------------- /acceptance-tests/src/test/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: acceptance-tests -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | rabbitmq: 2 | image: rabbitmq:management 3 | ports: 4 | - 9672:5672 5 | - 15672:15672 6 | -------------------------------------------------------------------------------- /docker-compose-rabbit.yml: -------------------------------------------------------------------------------- 1 | rabbitmq: 2 | image: rabbitmq:management 3 | ports: 4 | - 5672:5672 5 | - 15672:15672 6 | -------------------------------------------------------------------------------- /scripts/run_performance_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | wrk -t2 -c100 -d5 -R 18000 -L http://localhost:9876/ 6 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-cloud-samples/sleuth-documentation-apps/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /service1/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-cloud-samples/sleuth-documentation-apps/HEAD/service1/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /service1/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /service2/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-cloud-samples/sleuth-documentation-apps/HEAD/service2/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /service2/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /service3/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-cloud-samples/sleuth-documentation-apps/HEAD/service3/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /service3/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /service4/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-cloud-samples/sleuth-documentation-apps/HEAD/service4/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /service4/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /acceptance-tests/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /deploy_script: -------------------------------------------------------------------------------- 1 | cd service1 2 | cf push 3 | cd .. 4 | cd service2 5 | cf push 6 | cd .. 7 | cd service3 8 | cf push 9 | cd .. 10 | cd service4 11 | cf push 12 | 13 | -------------------------------------------------------------------------------- /service1/src/main/resources/application-logzio.yml: -------------------------------------------------------------------------------- 1 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" -------------------------------------------------------------------------------- /service2/src/main/resources/application-logzio.yml: -------------------------------------------------------------------------------- 1 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" -------------------------------------------------------------------------------- /service3/src/main/resources/application-logzio.yml: -------------------------------------------------------------------------------- 1 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" -------------------------------------------------------------------------------- /service4/src/main/resources/application-logzio.yml: -------------------------------------------------------------------------------- 1 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" -------------------------------------------------------------------------------- /zipkin-server-legacy/src/main/resources/application-cloud.yaml: -------------------------------------------------------------------------------- 1 | spring.rabbitmq.addresses: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 2 | 3 | spring.datasource.initialize: false -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - oraclejdk8 3 | 4 | install: 5 | - true 6 | 7 | before_script: 8 | - "echo $JAVA_OPTS" 9 | - "export JAVA_OPTS=-Xmx256m" 10 | 11 | script: 12 | - ./mvnw clean install -------------------------------------------------------------------------------- /acceptance-tests/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /scripts/curl_exception.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo -e "Sending a request to service1" 6 | 7 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 8 | 9 | curl --fail localhost:${SERVICE1_PORT}/readtimeout 10 | -------------------------------------------------------------------------------- /scripts/curl_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo -e "Sending a request to service1" 6 | 7 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 8 | 9 | curl --fail localhost:${SERVICE1_PORT}/start && echo -e "\nIt worked!" && exit 0 || echo -e "\nFailed to send the request" && exit 1 10 | -------------------------------------------------------------------------------- /scripts/start_with_zipkin_server_and_run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | CURRENT=`pwd` 5 | 6 | if [[ ! -e "${CURRENT}/scripts" ]]; then 7 | . ./start_with_zipkin_server.sh 8 | . ./run_acceptance_tests.sh 9 | else 10 | . ./scripts/start_with_zipkin_server.sh 11 | . ./scripts/run_acceptance_tests.sh 12 | fi 13 | -------------------------------------------------------------------------------- /presentation-service/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | sdk use java 15.0.0.hs-adpt 6 | 7 | # Generate project with Sleuth, Wavefront, Web 8 | # Add logback encoder, logz.io integration 9 | # Copy the properties and logback 10 | # Run without wavefront props 11 | # Run with wavefront props from the command line 12 | 13 | ./mvnw spring-boot:run 14 | 15 | http :9876/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | #* 3 | *# 4 | .#* 5 | .classpath 6 | .project 7 | .settings/ 8 | .springBeans 9 | target/ 10 | _site/ 11 | .idea 12 | *.iml 13 | *.swp 14 | .factorypath 15 | *.log 16 | .gradle 17 | *.jar 18 | */target/** 19 | */build/** 20 | *.class 21 | target/ 22 | build/ 23 | zipkin.jar 24 | zipkin.jar.asc 25 | zipkin.jar.md5.asc 26 | out/ 27 | bin/ 28 | target/ 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /zipkin-server-legacy/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring.application.name: zipkin 2 | 3 | logging: 4 | level.org.springframework.cloud: DEBUG 5 | 6 | server: 7 | port: 9411 8 | 9 | spring: 10 | rabbitmq: 11 | host: ${RABBIT_HOST:localhost} 12 | sleuth: 13 | enabled: false 14 | zipkin: 15 | store: 16 | type: mem 17 | 18 | logging.file: target/zipkin-server.log -------------------------------------------------------------------------------- /zipkin-server-legacy/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: docssleuth-zipkin-server 4 | memory: 1024M 5 | instances: 1 6 | host: docssleuth-zipkin-server 7 | path: target/zipkin-server-1.0.0.SLEUTH_DOCS.jar 8 | services: 9 | - docssleuth-rabbitmq 10 | - docssleuth-mysql 11 | #- mysql-sleuth-rk 12 | env: 13 | SPRING_PROFILES_ACTIVE: cloud 14 | DEBUG: "true" 15 | -------------------------------------------------------------------------------- /acceptance-tests/src/test/groovy/io/spring/cloud/samples/docs/acceptance/common/tech/TestConfiguration.groovy: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.samples.docs.acceptance.common.tech 2 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration 3 | import org.springframework.context.annotation.Configuration 4 | 5 | @Configuration 6 | @EnableAutoConfiguration 7 | class TestConfiguration { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /zipkin-server/manifest.yml: -------------------------------------------------------------------------------- 1 | applications: 2 | - name: docssleuth-zipkin-server 3 | memory: 1024M 4 | instances: 1 5 | host: docssleuth-zipkin-server 6 | path: build/zipkin.jar 7 | services: 8 | - docssleuth-rabbitmq 9 | - docssleuth-mysql 10 | env: 11 | SPRING_PROFILES_ACTIVE: cloud 12 | DEBUG: "true" 13 | RABBIT_URI: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 14 | -------------------------------------------------------------------------------- /service3/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: docssleuth-service3 4 | memory: 1024M 5 | instances: 1 6 | host: docssleuth-service3 7 | path: target/service3-1.0.0.SLEUTH_DOCS.jar 8 | services: 9 | - docssleuth-rabbitmq 10 | env: 11 | SPRING_PROFILES_ACTIVE: cloud 12 | SPRING_RABBITMQ_ADDRESSES: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 13 | DEBUG: "true" 14 | -------------------------------------------------------------------------------- /service4/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: docssleuth-service4 4 | memory: 1024M 5 | instances: 1 6 | host: docssleuth-service4 7 | path: target/service4-1.0.0.SLEUTH_DOCS.jar 8 | services: 9 | - docssleuth-rabbitmq 10 | env: 11 | SPRING_PROFILES_ACTIVE: cloud 12 | SPRING_RABBITMQ_ADDRESSES: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 13 | DEBUG: "true" 14 | -------------------------------------------------------------------------------- /zipkin-server-legacy/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | runtime 'org.hsqldb:hsqldb' 3 | compile "org.springframework:spring-jdbc" 4 | compile "org.springframework.boot:spring-boot-starter-actuator" 5 | compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" 6 | compile "org.springframework.cloud:spring-cloud-starter-stream-rabbit" 7 | runtime "io.zipkin.java:zipkin-autoconfigure-ui:1.29.0" 8 | } 9 | -------------------------------------------------------------------------------- /presentation-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name: presentation-service 2 | 3 | wavefront.application.name: sleuth-documentation-apps 4 | wavefront.application.service: ${spring.application.name} 5 | 6 | # Taken from env vars 7 | management.metrics.export.wavefront.api-token=${WAVEFRONT_API_TOKEN} 8 | management.metrics.export.wavefront.uri=https://demo.wavefront.com 9 | 10 | server.port: 9876 -------------------------------------------------------------------------------- /service1/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: docssleuth-service1 4 | memory: 1024m 5 | instances: 1 6 | host: docssleuth-service1 7 | path: target/service1-1.0.0.SLEUTH_DOCS.jar 8 | services: 9 | - docssleuth-rabbitmq 10 | env: 11 | SPRING_PROFILES_ACTIVE: cloud 12 | SERVICE2_ADDRESS: docssleuth-service2.cfapps.io 13 | SPRING_RABBITMQ_ADDRESSES: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 14 | DEBUG: "true" 15 | -------------------------------------------------------------------------------- /acceptance-tests/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | _ ___ ___ __ ___ _____ _ __ ___ __ _____ __ __ _____ __ 2 | /_\ / __\ / __\ /__\/ _ \/__ \/_\ /\ \ \/ __\ /__\ /__ \/__\/ _\/__ \/ _\ 3 | //_\\ / / / / /_\ / /_)/ / /\//_\\ / \/ / / /_\_____ / /\/_\ \ \ / /\/\ \ 4 | / _ \/ /___/ /___//__/ ___/ / / / _ \/ /\ / /___//_|_____/ / //__ _\ \ / / _\ \ 5 | \_/ \_/\____/\____/\__/\/ \/ \_/ \_/\_\ \/\____/\__/ \/ \__/ \__/ \/ \__/ 6 | -------------------------------------------------------------------------------- /service2/manifest.yml: -------------------------------------------------------------------------------- 1 | --- 2 | applications: 3 | - name: docssleuth-service2 4 | memory: 1024M 5 | instances: 1 6 | host: docssleuth-service2 7 | path: target/service2-1.0.0.SLEUTH_DOCS.jar 8 | services: 9 | - docssleuth-rabbitmq 10 | env: 11 | SPRING_PROFILES_ACTIVE: cloud 12 | SERVICE3_ADDRESS: docssleuth-service3.cfapps.io 13 | SERVICE4_ADDRESS: docssleuth-service4.cfapps.io 14 | SPRING_RABBITMQ_ADDRESSES: ${vcap.services.docssleuth-rabbitmq.credentials.uri} 15 | DEBUG: "true" 16 | -------------------------------------------------------------------------------- /presentation-service/src/test/java/com/example/presentationservice/PresentationServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.presentationservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | import org.springframework.test.context.TestPropertySource; 6 | 7 | @TestPropertySource(properties = "management.metrics.export.wavefront.enabled=false") 8 | @SpringBootTest 9 | class PresentationServiceApplicationTests { 10 | 11 | @Test 12 | void contextLoads() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: maven 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | ignore: 9 | - dependency-name: org.springframework.cloud:spring-cloud-dependencies 10 | versions: 11 | - ">= 2020.1.a, < 2020.2" 12 | - dependency-name: org.springframework.cloud:spring-cloud-dependencies 13 | versions: 14 | - 2020.0.2 15 | - 2021.0.0-SNAPSHOT 16 | - dependency-name: org.springframework.boot:spring-boot-starter-parent 17 | versions: 18 | - 2.4.4 19 | -------------------------------------------------------------------------------- /zipkin-server-legacy/src/main/java/io/spring/cloud/samples/docs/zipkin/Application.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.samples.docs.zipkin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer; 6 | 7 | @SpringBootApplication 8 | @EnableZipkinStreamServer 9 | public class Application { 10 | public static void main(String[] args) { 11 | new SpringApplication(Application.class).run(args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /service1/src/main/java/io/spring/cloud/sleuth/docs/service1/Application.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service1; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.reactive.function.client.WebClient; 7 | 8 | @SpringBootApplication 9 | public class Application { 10 | 11 | @Bean WebClient webClient() { return WebClient.create(); } 12 | 13 | public static void main(String... args) { 14 | new SpringApplication(Application.class).run(args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Java CI with Maven 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 1.8 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: 1.8 23 | - name: Build with Maven 24 | run: ./scripts/runAcceptanceTests.sh 25 | -------------------------------------------------------------------------------- /acceptance-tests/src/test/groovy/io/spring/cloud/samples/docs/acceptance/common/tech/ExceptionLoggingErrorHandler.groovy: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.samples.docs.acceptance.common.tech 2 | 3 | import groovy.util.logging.Slf4j 4 | import org.springframework.http.client.ClientHttpResponse 5 | import org.springframework.web.client.DefaultResponseErrorHandler 6 | 7 | @Slf4j 8 | class ExceptionLoggingErrorHandler extends DefaultResponseErrorHandler { 9 | @Override 10 | void handleError(ClientHttpResponse response) throws IOException { 11 | if (hasError(response)) { 12 | log.error("Response has status code [${response.statusCode}] and text [${response.statusText}]") 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /service2/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server.port: 8082 2 | spring: 3 | application: 4 | name: service2 5 | sleuth: 6 | propagation: 7 | type: 8 | - b3 9 | - w3c 10 | baggage: 11 | remote-fields: 12 | - baggage 13 | - key 14 | correlation-fields: 15 | - key 16 | sampler: 17 | probability: 1.0 18 | 19 | logging.level.org.springframework.cloud.sleuth: DEBUG 20 | 21 | management.endpoints.web.base-path: / 22 | management.endpoints.web.exposure.include: "*" 23 | 24 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" 25 | 26 | wavefront.application.name: sleuth-documentation-apps 27 | wavefront.application.service: service2 28 | -------------------------------------------------------------------------------- /service3/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server.port: 8083 2 | spring: 3 | application: 4 | name: service3 5 | sleuth: 6 | propagation: 7 | type: 8 | - b3 9 | - w3c 10 | baggage: 11 | remote-fields: 12 | - baggage 13 | - key 14 | correlation-fields: 15 | - key 16 | sampler: 17 | probability: 1.0 18 | 19 | logging.level.org.springframework.cloud.sleuth: DEBUG 20 | 21 | management.endpoints.web.base-path: / 22 | management.endpoints.web.exposure.include: "*" 23 | 24 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" 25 | 26 | wavefront.application.name: sleuth-documentation-apps 27 | wavefront.application.service: service3 28 | -------------------------------------------------------------------------------- /service4/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server.port: 8084 2 | spring: 3 | application: 4 | name: service4 5 | sleuth: 6 | propagation: 7 | type: 8 | - b3 9 | - w3c 10 | baggage: 11 | remote-fields: 12 | - baggage 13 | - key 14 | correlation-fields: 15 | - key 16 | otel: 17 | config: 18 | trace-id-ratio-based: 1.0 19 | 20 | logging.level.org.springframework.cloud.sleuth: DEBUG 21 | 22 | management.endpoints.web.base-path: / 23 | management.endpoints.web.exposure.include: "*" 24 | 25 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" 26 | 27 | wavefront.application.name: sleuth-documentation-apps 28 | wavefront.application.service: service4 -------------------------------------------------------------------------------- /service1/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server.port: 8081 2 | spring: 3 | application: 4 | name: service1 5 | sleuth: 6 | propagation: 7 | type: 8 | - b3 9 | - w3c 10 | baggage: 11 | remote-fields: 12 | - baggage 13 | - key 14 | correlation-fields: 15 | - key 16 | otel: 17 | config: 18 | trace-id-ratio-based: 1.0 19 | sampler: 20 | probability: 1.0 21 | 22 | logging.level.org.springframework.cloud.sleuth: INFO 23 | 24 | management.endpoints.web.base-path: / 25 | management.endpoints.web.exposure.include: "*" 26 | 27 | logging.pattern.level: "%5p [${spring.zipkin.service.name:${spring.application.name:}},%X{traceId:-},%X{spanId:-},%X{key:-}]" 28 | 29 | wavefront.application.name: sleuth-documentation-apps 30 | wavefront.application.service: service1 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Java CI with Maven](https://github.com/spring-cloud-samples/sleuth-documentation-apps/workflows/Java%20CI%20with%20Maven/badge.svg) 2 | 3 | # Sleuth documentation apps 4 | 5 | [Apps used for the Sleuth documentation graphs](https://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html) . They're not using 6 | service discovery so don't treat them as reference production applications ;) 7 | 8 | The apps are sending spans to Zipkin via RabbitMQ and `spring-cloud-sleuth-stream`. 9 | 10 | # Running acceptance tests 11 | 12 | Run: 13 | 14 | ``` 15 | ./runAcceptanceTests.sh 16 | ``` 17 | 18 | # Running the apps locally with RabbitMQ 19 | 20 | Provide the env variable `DEFAULT_HEALTH_HOST` pointing to your Docker Machine. By default it will be `localhost`. 21 | That way we'll start a RabbitMQ instance for you. 22 | 23 | Run: 24 | 25 | ``` 26 | ./scripts/start_with_zipkin_server.sh 27 | ``` 28 | -------------------------------------------------------------------------------- /acceptance-tests/src/test/groovy/io/spring/cloud/samples/docs/acceptance/common/tech/ExceptionLoggingRestTemplate.groovy: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.samples.docs.acceptance.common.tech 2 | 3 | import groovy.util.logging.Slf4j 4 | import org.springframework.http.HttpMethod 5 | import org.springframework.web.client.RequestCallback 6 | import org.springframework.web.client.ResponseExtractor 7 | import org.springframework.web.client.RestClientException 8 | import org.springframework.web.client.RestTemplate 9 | 10 | @Slf4j 11 | class ExceptionLoggingRestTemplate extends RestTemplate { 12 | 13 | ExceptionLoggingRestTemplate() { 14 | errorHandler = new ExceptionLoggingErrorHandler() 15 | } 16 | 17 | @Override 18 | protected T doExecute(URI url, HttpMethod method, RequestCallback requestCallback, ResponseExtractor responseExtractor) throws RestClientException { 19 | try { 20 | return super.doExecute(url, method, requestCallback, responseExtractor) 21 | } catch (Exception e) { 22 | log.error("Exception occurred while trying to send a request", e) 23 | throw new AssertionError(e) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /scripts/start_with_running_infra.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 6 | SERVICE2_PORT="${SERVICE2_PORT:-8082}" 7 | SERVICE3_PORT="${SERVICE3_PORT:-8083}" 8 | SERVICE4_PORT="${SERVICE4_PORT:-8084}" 9 | 10 | # build apps 11 | ./mvnw clean install -Pnotests 12 | 13 | ROOT_FOLDER=${ROOT_FOLDER:-.} 14 | if [[ "${JAVA_HOME}" != "" ]]; then 15 | JAVA_BIN="${JAVA_HOME}/bin/java" 16 | else 17 | JAVA_BIN="java" 18 | fi 19 | 20 | mkdir -p "${ROOT_FOLDER}/service1/build/" 21 | mkdir -p "${ROOT_FOLDER}/service2/build/" 22 | mkdir -p "${ROOT_FOLDER}/service3/build/" 23 | mkdir -p "${ROOT_FOLDER}/service4/build/" 24 | 25 | nohup ${JAVA_BIN} -jar "${ROOT_FOLDER}/service1/build/*.jar" --server.port="${SERVICE1_PORT}" > target/service1.log & 26 | nohup ${JAVA_BIN} -jar "${ROOT_FOLDER}/service2/build/*.jar" --server.port="${SERVICE2_PORT}" > target/service2.log & 27 | nohup ${JAVA_BIN} -jar "${ROOT_FOLDER}/service3/build/*.jar" --server.port="${SERVICE3_PORT}" > target/service3.log & 28 | nohup ${JAVA_BIN} -jar "${ROOT_FOLDER}/service4/build/*.jar" --server.port="${SERVICE4_PORT}" > target/service4.log & 29 | -------------------------------------------------------------------------------- /service3/src/main/java/io/spring/cloud/sleuth/docs/service3/Application.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service3; 2 | 3 | import brave.baggage.BaggageField; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @SpringBootApplication 12 | public class Application { 13 | 14 | public static void main(String... args) { 15 | new SpringApplication(Application.class).run(args); 16 | } 17 | } 18 | 19 | @RestController 20 | class Service3Controller { 21 | private static final Logger log = LoggerFactory.getLogger(Service3Controller.class); 22 | 23 | @RequestMapping("/bar") 24 | public String service3MethodInController() throws InterruptedException { 25 | Thread.sleep(300); 26 | log.info("Hello from service3"); 27 | log.info("Service3: Baggage for [key] is [" + BaggageField.getByName("key").getValue() + "]"); 28 | return "Hello from service3"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /scripts/run_acceptance_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DEFAULT_HEALTH_HOST=${DEFAULT_HEALTH_HOST:-localhost} 6 | 7 | if [[ "${REPORTING_SYSTEM}" == "zipkin" ]]; then 8 | ./mvnw clean install -Ptests 9 | fi 10 | 11 | mkdir -p build 12 | TESTS_PASSED="no" 13 | echo -e "\n\nChecking if baggage was properly propagated\n\n" 14 | grep "Service1: Baggage for \[key\] is \[foo\]" build/service1.log && 15 | grep "Service2: Baggage for \[key\] is \[foo\]" build/service2.log && 16 | grep "Service3: Baggage for \[key\] is \[foo\]" build/service3.log && 17 | grep "Service4: Baggage for \[key\] is \[foo\]" build/service4.log 18 | 19 | echo -e "\n\nChecking if baggage was properly set in the logs\n\n" 20 | grep "\,foo" build/service1.log && 21 | grep "\,foo" build/service2.log && 22 | grep "\,foo" build/service3.log && 23 | grep "\,foo" build/service4.log && 24 | TESTS_PASSED="yes" && echo "Baggage works fine!" 25 | 26 | 27 | # Check the result of tests execution 28 | if [[ "${TESTS_PASSED}" == "yes" ]] ; then 29 | echo -e "\n\nBaggage was propagated successfully" 30 | exit 0 31 | else 32 | echo -e "\n\nBaggage wasn't propagated" 33 | exit 1 34 | fi 35 | -------------------------------------------------------------------------------- /service1/src/main/java/io/spring/cloud/sleuth/docs/service1/Service1Controller.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service1; 2 | 3 | import java.time.LocalDateTime; 4 | 5 | import reactor.core.publisher.Mono; 6 | 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | public class Service1Controller { 13 | 14 | private final Service2Client service2Client; 15 | 16 | public Service1Controller(Service2Client service2Client) { 17 | this.service2Client = service2Client; 18 | } 19 | 20 | @GetMapping("/start") 21 | public Mono start() { 22 | return this.service2Client.start(); 23 | } 24 | 25 | @GetMapping("/readtimeout") 26 | public Mono timeout() throws InterruptedException { 27 | return service2Client.timeout(LocalDateTime.now().toString()); 28 | } 29 | 30 | @PostMapping("/start") 31 | public Mono postStart() { 32 | return start(); 33 | } 34 | 35 | @PostMapping("/readtimeout") 36 | public Mono postTimeout() throws InterruptedException { 37 | return timeout(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /scripts/kill.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 4 | SERVICE2_PORT="${SERVICE2_PORT:-8082}" 5 | SERVICE3_PORT="${SERVICE3_PORT:-8083}" 6 | SERVICE4_PORT="${SERVICE4_PORT:-8084}" 7 | 8 | function kill_app_at_port() { 9 | kill -9 $(lsof -t -i:$1) && echo "Killed an app running on port [$1]" || echo "No app running on port [$1]" 10 | } 11 | 12 | echo "Running apps:" 13 | jps | grep "1.0.0.SLEUTH_DOCS.jar" 14 | 15 | echo "Running docker processes" 16 | docker ps 17 | docker ps -a -q | xargs -n 1 -P 8 -I {} docker rm --force {} || echo 'No docker containers running'; 18 | 19 | kill `jps | grep "1.0.0.SLEUTH_DOCS.jar" | cut -d " " -f 1` || echo "No apps running" 20 | pkill -9 -f 1.0.0.SLEUTH_DOCS.jar || echo "Apps not running" 21 | kill `jps | grep "zipkin.jar" | cut -d " " -f 1` || echo "No zipkin running" 22 | kill_app_at_port ${SERVICE1_PORT} || echo "Failed to kill service" 23 | kill_app_at_port ${SERVICE2_PORT} || echo "Failed to kill service" 24 | kill_app_at_port ${SERVICE3_PORT} || echo "Failed to kill service" 25 | kill_app_at_port ${SERVICE4_PORT} || echo "Failed to kill service" 26 | 27 | echo "Running apps:" 28 | jps | grep "1.0.0.SLEUTH_DOCS.jar" 29 | 30 | echo "Running docker processes" 31 | docker ps 32 | 33 | rm -rf "${CURRENT_DIR}/build" -------------------------------------------------------------------------------- /acceptance-tests/src/test/java/io/spring/cloud/samples/docs/acceptance/common/tech/SpanUtil.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.samples.docs.acceptance.common.tech; 2 | 3 | /** 4 | * @author Marcin Grzejszczak 5 | * @since 6 | */ 7 | public class SpanUtil { 8 | 9 | /** 10 | * Represents given long id as 16-character lower-hex string 11 | */ 12 | public static String idToHex(long id) { 13 | char[] data = new char[16]; 14 | writeHexLong(data, 0, id); 15 | return new String(data); 16 | } 17 | 18 | /** Inspired by {@code okio.Buffer.writeLong} */ 19 | static void writeHexLong(char[] data, int pos, long v) { 20 | writeHexByte(data, pos + 0, (byte) ((v >>> 56L) & 0xff)); 21 | writeHexByte(data, pos + 2, (byte) ((v >>> 48L) & 0xff)); 22 | writeHexByte(data, pos + 4, (byte) ((v >>> 40L) & 0xff)); 23 | writeHexByte(data, pos + 6, (byte) ((v >>> 32L) & 0xff)); 24 | writeHexByte(data, pos + 8, (byte) ((v >>> 24L) & 0xff)); 25 | writeHexByte(data, pos + 10, (byte) ((v >>> 16L) & 0xff)); 26 | writeHexByte(data, pos + 12, (byte) ((v >>> 8L) & 0xff)); 27 | writeHexByte(data, pos + 14, (byte) (v & 0xff)); 28 | } 29 | 30 | static void writeHexByte(char[] data, int pos, byte b) { 31 | data[pos + 0] = HEX_DIGITS[(b >> 4) & 0xf]; 32 | data[pos + 1] = HEX_DIGITS[b & 0xf]; 33 | } 34 | 35 | static final char[] HEX_DIGITS = 36 | {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; 37 | } 38 | -------------------------------------------------------------------------------- /presentation-service/HELP.md: -------------------------------------------------------------------------------- 1 | # Read Me First 2 | The following was discovered as part of building this project: 3 | 4 | * The original package name 'com.example.presentation-service' is invalid and this project uses 'com.example.presentationservice' instead. 5 | 6 | # Getting Started 7 | 8 | ### Reference Documentation 9 | For further reference, please consider the following sections: 10 | 11 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 12 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.3-SNAPSHOT/maven-plugin/reference/html/) 13 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.3-SNAPSHOT/maven-plugin/reference/html/#build-image) 14 | * [Wavefront for Spring Boot documentation](https://docs.wavefront.com/wavefront_springboot.html) 15 | * [Wavefront for Spring Boot repository](https://github.com/wavefrontHQ/wavefront-spring-boot) 16 | * [Spring Boot Actuator](https://docs.spring.io/spring-boot/docs/2.4.3/reference/htmlsingle/#production-ready) 17 | 18 | ### Guides 19 | The following guides illustrate how to use some features concretely: 20 | 21 | * [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/) 22 | 23 | ## Observability with Wavefront 24 | 25 | If you don't have a Wavefront account, the starter will create a freemium account for you. 26 | The URL to access the Wavefront Service dashboard is logged on startup. 27 | -------------------------------------------------------------------------------- /service4/src/main/java/io/spring/cloud/sleuth/docs/service4/Application.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service4; 2 | 3 | import io.opentelemetry.api.baggage.Baggage; 4 | import io.opentelemetry.api.trace.Span; 5 | import io.opentelemetry.api.trace.Tracer; 6 | import io.opentelemetry.context.Scope; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | import org.springframework.boot.SpringApplication; 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | @SpringBootApplication 16 | public class Application { 17 | 18 | public static void main(String... args) { 19 | new SpringApplication(Application.class).run(args); 20 | } 21 | } 22 | 23 | @RestController 24 | class Service4Controller { 25 | private static final Logger log = LoggerFactory.getLogger(Service4Controller.class); 26 | 27 | private final Tracer tracer; 28 | 29 | Service4Controller(Tracer tracer) { 30 | this.tracer = tracer; 31 | } 32 | 33 | @RequestMapping("/baz") 34 | public String service4MethodInController() throws InterruptedException { 35 | Thread.sleep(400); 36 | Span newSpan = this.tracer.spanBuilder("new_span").startSpan(); 37 | try (Scope scope = newSpan.makeCurrent()) { 38 | log.info("Hello from service4"); 39 | log.info("Service4: Baggage for [key] is [" + Baggage.current().getEntryValue("key") + "]"); 40 | } 41 | return "Hello from service4"; 42 | } 43 | } -------------------------------------------------------------------------------- /presentation-service/src/main/java/com/example/presentationservice/PresentationServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.presentationservice; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | import org.springframework.web.client.RestTemplate; 13 | 14 | @SpringBootApplication 15 | public class PresentationServiceApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(PresentationServiceApplication.class, args); 19 | } 20 | 21 | @Bean 22 | RestTemplate restTemplate() { 23 | return new RestTemplate(); 24 | } 25 | } 26 | 27 | @RestController 28 | class PresentationController { 29 | 30 | private static final Logger log = LoggerFactory.getLogger(PresentationController.class); 31 | 32 | private final RestTemplate restTemplate; 33 | 34 | private final String serviceUrl; 35 | 36 | PresentationController(RestTemplate restTemplate, @Value("${service1.address:localhost:9081}") String serviceUrl) { 37 | this.restTemplate = restTemplate; 38 | this.serviceUrl = serviceUrl; 39 | } 40 | 41 | @GetMapping("/") 42 | String start() { 43 | log.info("HELLO FROM PRESENTATION-SERVICE"); 44 | return "PRESENTATION SERVICE: " + this.restTemplate.postForObject("http://" + this.serviceUrl + "/start", "", String.class); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /presentation-service/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | DEBUG 13 | 14 | 15 | ${CONSOLE_LOG_PATTERN} 16 | utf8 17 | 18 | 19 | 20 | 21 | ${LOGZ_IO_API_TOKEN} 22 | https://listener.logz.io:8071 23 | 24 | INFO 25 | 26 | 27 | 28 | 29 | UTC 30 | 31 | 32 | 33 | { 34 | "timestamp": "@timestamp", 35 | "severity": "%level", 36 | "service": "${springAppName:-}", 37 | "trace": "%X{traceId:-}", 38 | "span": "%X{spanId:-}", 39 | "baggage": "%X{key:-}", 40 | "pid": "${PID:-}", 41 | "thread": "%thread", 42 | "class": "%logger{40}", 43 | "rest": "%message" 44 | } 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /scripts/runAcceptanceTests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | 5 | export CURRENT_DIR="$( pwd )" 6 | export KILL_AT_END="${KILL_AT_END:-yes}" 7 | # since 8081-8084 are often taken will bump those to 9081-9084 8 | export DEFAULT_HEALTH_HOST=${DEFAULT_HEALTH_HOST:-localhost} 9 | export SERVICE1_PORT="${SERVICE1_PORT:-9081}" 10 | export SERVICE1_ADDRESS="${SERVICE1_ADDRESS:-${DEFAULT_HEALTH_HOST}:${SERVICE1_PORT}}" 11 | export SERVICE2_PORT="${SERVICE2_PORT:-9082}" 12 | export SERVICE2_ADDRESS="${SERVICE2_ADDRESS:-${DEFAULT_HEALTH_HOST}:${SERVICE2_PORT}}" 13 | export SERVICE3_PORT="${SERVICE3_PORT:-9083}" 14 | export SERVICE3_ADDRESS="${SERVICE3_ADDRESS:-${DEFAULT_HEALTH_HOST}:${SERVICE3_PORT}}" 15 | export SERVICE4_PORT="${SERVICE4_PORT:-9084}" 16 | export SERVICE4_ADDRESS="${SERVICE4_ADDRESS:-${DEFAULT_HEALTH_HOST}:${SERVICE4_PORT}}" 17 | export REPORTING_SYSTEM="${REPORTING_SYSTEM:-zipkin}" 18 | 19 | echo -e "\n\nRunning apps on addresses:\nservice1: [${SERVICE1_ADDRESS}]\nservice2: [${SERVICE2_ADDRESS}]\nservice3: [${SERVICE3_ADDRESS}]\nservice4: [${SERVICE4_ADDRESS}]\n\n" 20 | 21 | function print_logs() { 22 | echo -e "\n\nSOMETHING WENT WRONG :( :( \n\n" 23 | echo -e "\n\nPRINTING LOGS FROM ALL APPS\n\n" 24 | tail -n +1 -- "${CURRENT_DIR}"/build/*.log 25 | } 26 | 27 | function fail_with_message() { 28 | echo -e $1 29 | print_logs 30 | exit 1 31 | } 32 | 33 | export -f print_logs 34 | export -f fail_with_message 35 | 36 | if [[ "${KILL_AT_END}" == "yes" ]] ; then 37 | trap "{ ./scripts/kill.sh;docker ps -a -q | xargs -n 1 -P 8 -I {} docker rm --force {} || echo 'No docker containers running'; }" EXIT 38 | fi 39 | 40 | # Kill the running apps 41 | ./scripts/kill.sh 42 | 43 | echo "Running reporting system [${REPORTING_SYSTEM}]" 44 | 45 | if [[ "${REPORTING_SYSTEM}" == "zipkin" ]]; then 46 | # Next run the `./runApps.sh` script to initialize Zipkin and the apps (check the `README` of `sleuth-documentation-apps` for Docker setup info) 47 | ./scripts/start_with_zipkin_server.sh 48 | elif [[ "${REPORTING_SYSTEM}" == "wavefront" ]]; then 49 | ./scripts/start_with_wavefront.sh 50 | else 51 | fail_with_message "No matching reporting system" 52 | fi 53 | 54 | echo -e "\n\nReady to curl first request" 55 | 56 | ./scripts/curl_start.sh || fail_with_message "Failed to send the request" 57 | 58 | echo -e "\n\nReady to curl a request that will cause an exception" 59 | 60 | ./scripts/curl_exception.sh && fail_with_message "\n\nShould have failed the request but didn't :/" || echo -e "\n\nSent a request and got an exception!" 61 | 62 | echo -e "\n\nRunning acceptance tests" 63 | ./scripts/run_acceptance_tests.sh 64 | -------------------------------------------------------------------------------- /service1/src/main/java/io/spring/cloud/sleuth/docs/service1/Service2Client.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service1; 2 | 3 | import java.lang.invoke.MethodHandles; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import reactor.core.publisher.Mono; 8 | 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.cloud.sleuth.annotation.NewSpan; 11 | import org.springframework.cloud.sleuth.annotation.SpanTag; 12 | import org.springframework.cloud.sleuth.BaggageInScope; 13 | import org.springframework.cloud.sleuth.Span; 14 | import org.springframework.cloud.sleuth.Tracer; 15 | import org.springframework.http.HttpStatus; 16 | import org.springframework.stereotype.Component; 17 | import org.springframework.util.StringUtils; 18 | import org.springframework.web.reactive.function.client.ClientResponse; 19 | import org.springframework.web.reactive.function.client.WebClient; 20 | 21 | /** 22 | * @author Marcin Grzejszczak 23 | */ 24 | @Component 25 | class Service2Client { 26 | 27 | private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); 28 | 29 | private final WebClient webClient; 30 | private final String serviceAddress; 31 | private final Tracer tracer; 32 | 33 | Service2Client(WebClient webClient, 34 | @Value("${service2.address:localhost:8082}") String serviceAddress, 35 | Tracer tracer) { 36 | this.webClient = webClient; 37 | this.serviceAddress = serviceAddress; 38 | this.tracer = tracer; 39 | } 40 | 41 | public Mono start() { 42 | log.info("Hello from service1. Setting baggage foo=>bar"); 43 | Span span = tracer.currentSpan(); 44 | BaggageInScope secretBaggageField = this.tracer.getBaggage("baggage"); 45 | String secretBaggage = secretBaggageField != null ? secretBaggageField.get() : null; 46 | log.info("Super secret baggage item for key [baggage] is [{}]", secretBaggage); 47 | if (StringUtils.hasText(secretBaggage)) { 48 | span.event("secret_baggage_received"); 49 | span.tag("baggage", secretBaggage); 50 | } 51 | String baggageKey = "key"; 52 | String baggageValue = "foo"; 53 | BaggageInScope baggageField = this.tracer.createBaggage(baggageKey); 54 | baggageField.set(span.context(), baggageValue); 55 | span.event("baggage_set"); 56 | span.tag(baggageKey, baggageValue); 57 | log.info("Hello from service1. Calling service2"); 58 | return webClient.get() 59 | .uri("http://" + serviceAddress + "/foo") 60 | .exchange() 61 | .doOnSuccess(clientResponse -> { 62 | log.info("Got response from service2 [{}]", clientResponse); 63 | try (BaggageInScope bs = this.tracer.getBaggage("key")) { 64 | log.info("Service1: Baggage for [key] is [" + (bs == null ? null : bs.get()) + "]"); 65 | } 66 | }) 67 | .flatMap(clientResponse -> clientResponse.bodyToMono(String.class)) 68 | .doOnTerminate(() -> { 69 | if (secretBaggageField != null) { 70 | secretBaggageField.close(); 71 | } 72 | baggageField.close(); 73 | }); 74 | } 75 | 76 | @NewSpan("first_span") 77 | Mono timeout(@SpanTag("someTag") String tag) throws InterruptedException { 78 | Thread.sleep(300); 79 | log.info("Hello from service1. Calling service2 - should end up with read timeout"); 80 | return webClient.get() 81 | .uri("http://" + serviceAddress + "/readtimeout") 82 | .retrieve() 83 | .onStatus(HttpStatus::is5xxServerError, ClientResponse::createException) 84 | .bodyToMono(String.class); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.spring.cloud.sleuth.docs 8 | sleuth-documentation-apps-parent 9 | pom 10 | 1.0.0.SLEUTH_DOCS 11 | 12 | Sleuth Documentation Apps 13 | Sleuth Documentation Apps 14 | 15 | 16 | 17 | tests 18 | 19 | acceptance-tests 20 | 21 | 22 | 23 | notests 24 | 25 | service1 26 | service2 27 | service3 28 | service4 29 | 30 | 31 | 32 | all 33 | 34 | true 35 | 36 | 37 | service1 38 | service2 39 | service3 40 | service4 41 | acceptance-tests 42 | 43 | 44 | 45 | ide 46 | 47 | false 48 | 49 | 50 | presentation-service 51 | service1 52 | service2 53 | service3 54 | service4 55 | acceptance-tests 56 | 57 | 58 | 59 | 60 | 61 | 62 | spring-snapshots 63 | Spring Snapshots 64 | https://repo.spring.io/snapshot 65 | 66 | true 67 | 68 | 69 | 70 | spring-milestones 71 | Spring Milestones 72 | https://repo.spring.io/milestone 73 | 74 | false 75 | 76 | 77 | 78 | spring-releases 79 | Spring Releases 80 | https://repo.spring.io/release 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | spring-snapshots 89 | Spring Snapshots 90 | https://repo.spring.io/snapshot 91 | 92 | true 93 | 94 | 95 | 96 | spring-milestones 97 | Spring Milestones 98 | https://repo.spring.io/milestone 99 | 100 | false 101 | 102 | 103 | 104 | spring-plugin-snapshots 105 | Spring Snapshots 106 | https://repo.spring.io/snapshot 107 | 108 | true 109 | 110 | 111 | 112 | spring-plugin-milestones 113 | Spring Milestones 114 | https://repo.spring.io/release 115 | 116 | false 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /service3/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | DEBUG 18 | 19 | 20 | ${CONSOLE_LOG_PATTERN} 21 | utf8 22 | 23 | 24 | 25 | 26 | 27 | ${LOG_FILE} 28 | 29 | ${LOG_FILE}.%d{yyyy-MM-dd}.gz 30 | 7 31 | 32 | 33 | ${CONSOLE_LOG_PATTERN} 34 | utf8 35 | 36 | 37 | 38 | 39 | 40 | ${LOG_FILE}.json 41 | 42 | ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz 43 | 7 44 | 45 | 46 | 47 | 48 | UTC 49 | 50 | 51 | 52 | { 53 | "timestamp": "@timestamp", 54 | "severity": "%level", 55 | "service": "${springAppName:-}", 56 | "trace": "%X{traceId:-}", 57 | "span": "%X{spanId:-}", 58 | "baggage": "%X{key:-}", 59 | "pid": "${PID:-}", 60 | "thread": "%thread", 61 | "class": "%logger{40}", 62 | "rest": "%message" 63 | } 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | ${LOGZ_IO_API_TOKEN} 75 | https://listener.logz.io:8071 76 | 77 | INFO 78 | 79 | true 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /scripts/start_with_wavefront.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | RABBIT_PORT=${RABBIT_PORT:-9672} 6 | DEFAULT_HEALTH_HOST=${DEFAULT_HEALTH_HOST:-localhost} 7 | export SPRING_RABBITMQ_HOST="${DEFAULT_HEALTH_HOST}" 8 | export SPRING_RABBITMQ_PORT="${RABBIT_PORT}" 9 | WITH_RABBIT="${WITH_RABBIT:-no}" 10 | WAIT_TIME="${WAIT_TIME:-5}" 11 | RETRIES="${RETRIES:-30}" 12 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 13 | SERVICE2_PORT="${SERVICE2_PORT:-8082}" 14 | SERVICE3_PORT="${SERVICE3_PORT:-8083}" 15 | SERVICE4_PORT="${SERVICE4_PORT:-8084}" 16 | ZIPKIN_PORT="${ZIPKIN_PORT:-9411}" 17 | JAVA_PATH_TO_BIN="${JAVA_HOME}/bin/" 18 | if [[ -z "${JAVA_HOME}" ]] ; then 19 | JAVA_PATH_TO_BIN="" 20 | fi 21 | 22 | [[ -z "${MEM_ARGS}" ]] && MEM_ARGS="-Xmx128m -Xss1024k" 23 | 24 | mkdir -p target 25 | 26 | function check_app() { 27 | READY_FOR_TESTS="no" 28 | curl_local_health_endpoint $1 && READY_FOR_TESTS="yes" || echo "Failed to reach health endpoint" 29 | if [[ "${READY_FOR_TESTS}" == "no" ]] ; then 30 | echo "Failed to start service running at port $1" 31 | print_logs 32 | exit 1 33 | fi 34 | } 35 | 36 | # ${RETRIES} number of times will try to curl to /health endpoint to passed port $1 and localhost 37 | function curl_local_health_endpoint() { 38 | curl_health_endpoint $1 "127.0.0.1" 39 | } 40 | 41 | # ${RETRIES} number of times will try to curl to /health endpoint to passed port $1 and host $2 42 | function curl_health_endpoint() { 43 | local PASSED_HOST="${2:-$HEALTH_HOST}" 44 | local READY_FOR_TESTS=1 45 | for i in $( seq 1 "${RETRIES}" ); do 46 | sleep "${WAIT_TIME}" 47 | curl --fail -m 5 "${PASSED_HOST}:$1/health" && READY_FOR_TESTS=0 && break || echo "Failed" 48 | echo "Fail #$i/${RETRIES}... will try again in [${WAIT_TIME}] seconds" 49 | done 50 | return ${READY_FOR_TESTS} 51 | } 52 | 53 | # Kills all docker related elements 54 | function kill_docker() { 55 | docker ps -a -q | xargs -n 1 -P 8 -I {} docker stop {} || echo "No running docker containers are left" 56 | } 57 | 58 | export LOGZ_IO_API_TOKEN="${LOGZ_IO_API_TOKEN:-}" 59 | PROFILES="notests,wavefront" 60 | 61 | if [[ "${LOGZ_IO_API_TOKEN}" != "" ]]; then 62 | echo "Logz io token present - will enable the logzio profile" 63 | PROFILES="${PROFILES},logzio" 64 | TOKENS="--spring.profiles.active=logzio" 65 | rm -rf /tmp/logzio-logback-queue/ 66 | else 67 | echo "Logz io token missing" 68 | TOKENS="--spring.profiles.active=default" 69 | fi 70 | 71 | echo "Building the apps with profiles [${PROFILES}]" 72 | 73 | ./mvnw clean install -P"${PROFILES}" 74 | 75 | if [[ "${WITH_RABBIT}" == "yes" ]] ; then 76 | # run rabbit 77 | #kill_docker || echo "Failed to kill" 78 | docker-compose kill || echo "Failed to kill" 79 | docker-compose pull 80 | docker-compose up -d 81 | fi 82 | 83 | if [[ "${JAVA_HOME}" != "" ]]; then 84 | JAVA_BIN="${JAVA_HOME}/bin/java" 85 | else 86 | JAVA_BIN="java" 87 | fi 88 | 89 | export WAVEFRONT_API_TOKEN="${WAVEFRONT_API_TOKEN:-}" 90 | echo "Will prepend the following runtime arguments [${TOKENS}]" 91 | TOKENS="${TOKENS} --management.metrics.export.wavefront.api-token=${WAVEFRONT_API_TOKEN} --management.metrics.export.wavefront.uri=${WAVEFRONT_URI:-https://demo.wavefront.com}" 92 | 93 | mkdir -p build 94 | 95 | echo -e "\nStarting the apps..." 96 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service1/target/*.jar --debug --server.port="${SERVICE1_PORT}" ${TOKENS} > build/service1.log 2>&1 & 97 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service2/target/*.jar --debug --server.port="${SERVICE2_PORT}" ${TOKENS} > build/service2.log 2>&1 & 98 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service3/target/*.jar --debug --server.port="${SERVICE3_PORT}" ${TOKENS} > build/service3.log 2>&1 & 99 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service4/target/*.jar --debug --server.port="${SERVICE4_PORT}" ${TOKENS} > build/service4.log 2>&1 & 100 | 101 | echo -e "\n\nChecking if Service1 is alive" 102 | check_app ${SERVICE1_PORT} 103 | echo -e "\n\nChecking if Service2 is alive" 104 | check_app ${SERVICE2_PORT} 105 | echo -e "\n\nChecking if Service3 is alive" 106 | check_app ${SERVICE3_PORT} 107 | echo -e "\n\nChecking if Service4 is alive" 108 | check_app ${SERVICE4_PORT} 109 | -------------------------------------------------------------------------------- /presentation-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.4 9 | 10 | 11 | io.spring.cloud.sleuth.docs 12 | presentation-service 13 | 1.0.0.SLEUTH_DOCS 14 | presentation-service 15 | Demo project for Spring Boot 16 | 17 | 11 18 | 2021.0.2-SNAPSHOT 19 | 2.3.0 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-actuator 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter-web 29 | 30 | 31 | com.wavefront 32 | wavefront-spring-boot-starter 33 | 34 | 35 | org.springframework.cloud 36 | spring-cloud-starter-sleuth 37 | 38 | 39 | io.logz.logback 40 | logzio-logback-appender 41 | 1.0.28 42 | 43 | 44 | net.logstash.logback 45 | logstash-logback-encoder 46 | 7.2 47 | runtime 48 | 49 | 50 | logback-core 51 | ch.qos.logback 52 | 53 | 54 | 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-starter-test 59 | test 60 | 61 | 62 | 63 | 64 | 65 | org.springframework.cloud 66 | spring-cloud-dependencies 67 | ${spring-cloud.version} 68 | pom 69 | import 70 | 71 | 72 | com.wavefront 73 | wavefront-spring-boot-bom 74 | ${wavefront.version} 75 | pom 76 | import 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-maven-plugin 86 | 87 | 88 | build-image 89 | package 90 | 91 | build-image 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | spring-milestones 101 | Spring Milestones 102 | https://repo.spring.io/milestone 103 | 104 | 105 | spring-snapshots 106 | Spring Snapshots 107 | https://repo.spring.io/snapshot 108 | 109 | true 110 | 111 | 112 | 113 | 114 | 115 | spring-milestones 116 | Spring Milestones 117 | https://repo.spring.io/milestone 118 | 119 | 120 | spring-snapshots 121 | Spring Snapshots 122 | https://repo.spring.io/snapshot 123 | 124 | true 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /service1/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | DEBUG 18 | 19 | 20 | ${CONSOLE_LOG_PATTERN} 21 | utf8 22 | 23 | 24 | 25 | 26 | 27 | ${LOG_FILE} 28 | 29 | ${LOG_FILE}.%d{yyyy-MM-dd}.gz 30 | 7 31 | 32 | 33 | ${CONSOLE_LOG_PATTERN} 34 | utf8 35 | 36 | 37 | 38 | 39 | 40 | ${LOG_FILE}.json 41 | 42 | ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz 43 | 7 44 | 45 | 46 | 47 | 48 | UTC 49 | 50 | 51 | 52 | { 53 | "timestamp": "@timestamp", 54 | "severity": "%level", 55 | "service": "${springAppName:-}", 56 | "trace": "%X{traceId:-}", 57 | "span": "%X{spanId:-}", 58 | "baggage": "%X{key:-}", 59 | "pid": "${PID:-}", 60 | "thread": "%thread", 61 | "class": "%logger{40}", 62 | "rest": "%message" 63 | } 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | ${LOGZ_IO_API_TOKEN} 75 | https://listener.logz.io:8071 76 | 77 | INFO 78 | 79 | true 80 | 81 | 82 | 83 | UTC 84 | 85 | 86 | 87 | { 88 | "timestamp": "@timestamp", 89 | "severity": "%level", 90 | "service": "${springAppName:-}", 91 | "trace": "%X{traceId:-}", 92 | "span": "%X{spanId:-}", 93 | "baggage": "%X{key:-}", 94 | "pid": "${PID:-}", 95 | "thread": "%thread", 96 | "class": "%logger{40}", 97 | "rest": "%message" 98 | } 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /service2/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | DEBUG 18 | 19 | 20 | ${CONSOLE_LOG_PATTERN} 21 | utf8 22 | 23 | 24 | 25 | 26 | 27 | ${LOG_FILE} 28 | 29 | ${LOG_FILE}.%d{yyyy-MM-dd}.gz 30 | 7 31 | 32 | 33 | ${CONSOLE_LOG_PATTERN} 34 | utf8 35 | 36 | 37 | 38 | 39 | 40 | ${LOG_FILE}.json 41 | 42 | ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz 43 | 7 44 | 45 | 46 | 47 | 48 | UTC 49 | 50 | 51 | 52 | { 53 | "timestamp": "@timestamp", 54 | "severity": "%level", 55 | "service": "${springAppName:-}", 56 | "trace": "%X{traceId:-}", 57 | "span": "%X{spanId:-}", 58 | "baggage": "%X{key:-}", 59 | "pid": "${PID:-}", 60 | "thread": "%thread", 61 | "class": "%logger{40}", 62 | "rest": "%message" 63 | } 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | ${LOGZ_IO_API_TOKEN} 75 | https://listener.logz.io:8071 76 | 77 | INFO 78 | 79 | true 80 | 81 | 82 | 83 | UTC 84 | 85 | 86 | 87 | { 88 | "timestamp": "@timestamp", 89 | "severity": "%level", 90 | "service": "${springAppName:-}", 91 | "trace": "%X{traceId:-}", 92 | "span": "%X{spanId:-}", 93 | "baggage": "%X{key:-}", 94 | "pid": "${PID:-}", 95 | "thread": "%thread", 96 | "class": "%logger{40}", 97 | "rest": "%message" 98 | } 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /service4/src/main/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | DEBUG 18 | 19 | 20 | ${CONSOLE_LOG_PATTERN} 21 | utf8 22 | 23 | 24 | 25 | 26 | 27 | ${LOG_FILE} 28 | 29 | ${LOG_FILE}.%d{yyyy-MM-dd}.gz 30 | 7 31 | 32 | 33 | ${CONSOLE_LOG_PATTERN} 34 | utf8 35 | 36 | 37 | 38 | 39 | 40 | ${LOG_FILE}.json 41 | 42 | ${LOG_FILE}.json.%d{yyyy-MM-dd}.gz 43 | 7 44 | 45 | 46 | 47 | 48 | UTC 49 | 50 | 51 | 52 | { 53 | "timestamp": "@timestamp", 54 | "severity": "%level", 55 | "service": "${springAppName:-}", 56 | "trace": "%X{traceId:-}", 57 | "span": "%X{spanId:-}", 58 | "baggage": "%X{key:-}", 59 | "pid": "${PID:-}", 60 | "thread": "%thread", 61 | "class": "%logger{40}", 62 | "rest": "%message" 63 | } 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | ${LOGZ_IO_API_TOKEN} 75 | https://listener.logz.io:8071 76 | 77 | INFO 78 | 79 | true 80 | 81 | 82 | 83 | UTC 84 | 85 | 86 | 87 | { 88 | "timestamp": "@timestamp", 89 | "severity": "%level", 90 | "service": "${springAppName:-}", 91 | "trace": "%X{traceId:-}", 92 | "span": "%X{spanId:-}", 93 | "baggage": "%X{key:-}", 94 | "pid": "${PID:-}", 95 | "thread": "%thread", 96 | "class": "%logger{40}", 97 | "rest": "%message" 98 | } 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /scripts/start_with_zipkin_server.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | RABBIT_PORT=${RABBIT_PORT:-9672} 6 | DEFAULT_HEALTH_HOST=${DEFAULT_HEALTH_HOST:-localhost} 7 | export SPRING_RABBITMQ_HOST="${DEFAULT_HEALTH_HOST}" 8 | export SPRING_RABBITMQ_PORT="${RABBIT_PORT}" 9 | WITH_RABBIT="${WITH_RABBIT:-no}" 10 | WAIT_TIME="${WAIT_TIME:-5}" 11 | RETRIES="${RETRIES:-30}" 12 | SERVICE1_PORT="${SERVICE1_PORT:-8081}" 13 | SERVICE2_PORT="${SERVICE2_PORT:-8082}" 14 | SERVICE3_PORT="${SERVICE3_PORT:-8083}" 15 | SERVICE4_PORT="${SERVICE4_PORT:-8084}" 16 | ZIPKIN_PORT="${ZIPKIN_PORT:-9411}" 17 | JAVA_PATH_TO_BIN="${JAVA_HOME}/bin/" 18 | if [[ -z "${JAVA_HOME}" ]] ; then 19 | JAVA_PATH_TO_BIN="" 20 | fi 21 | DOWNLOAD_ZIPKIN="${DOWNLOAD_ZIPKIN:-true}" 22 | 23 | [[ -z "${MEM_ARGS}" ]] && MEM_ARGS="-Xmx128m -Xss1024k" 24 | 25 | mkdir -p target 26 | 27 | function check_app() { 28 | READY_FOR_TESTS="no" 29 | curl_local_health_endpoint $1 && READY_FOR_TESTS="yes" || echo "Failed to reach health endpoint" 30 | if [[ "${READY_FOR_TESTS}" == "no" ]] ; then 31 | echo "Failed to start service running at port $1" 32 | print_logs 33 | exit 1 34 | fi 35 | } 36 | 37 | # ${RETRIES} number of times will try to curl to /health endpoint to passed port $1 and localhost 38 | function curl_local_health_endpoint() { 39 | curl_health_endpoint $1 "127.0.0.1" 40 | } 41 | 42 | # ${RETRIES} number of times will try to curl to /health endpoint to passed port $1 and host $2 43 | function curl_health_endpoint() { 44 | local PASSED_HOST="${2:-$HEALTH_HOST}" 45 | local READY_FOR_TESTS=1 46 | for i in $( seq 1 "${RETRIES}" ); do 47 | sleep "${WAIT_TIME}" 48 | curl --fail -m 5 "${PASSED_HOST}:$1/health" && READY_FOR_TESTS=0 && break || echo "Failed" 49 | echo "Fail #$i/${RETRIES}... will try again in [${WAIT_TIME}] seconds" 50 | done 51 | return ${READY_FOR_TESTS} 52 | } 53 | 54 | # Kills all docker related elements 55 | function kill_docker() { 56 | docker ps -a -q | xargs -n 1 -P 8 -I {} docker stop {} || echo "No running docker containers are left" 57 | } 58 | 59 | # build apps 60 | ./mvnw clean install -Pnotests 61 | 62 | if [[ "${WITH_RABBIT}" == "yes" ]] ; then 63 | # run rabbit 64 | #kill_docker || echo "Failed to kill" 65 | docker-compose kill || echo "Failed to kill" 66 | docker-compose pull 67 | docker-compose up -d 68 | fi 69 | 70 | if [[ "${JAVA_HOME}" != "" ]]; then 71 | JAVA_BIN="${JAVA_HOME}/bin/java" 72 | else 73 | JAVA_BIN="java" 74 | fi 75 | 76 | # nohup ${JAVA_HOME}/bin/java ${DEFAULT_ARGS} ${MEM_ARGS} -jar zipkin-server/zipkin-server-*-exec.jar > target/zipkin-server.out & 77 | pushd zipkin-server 78 | mkdir -p target 79 | cd target 80 | if [[ "${DOWNLOAD_ZIPKIN}" == "true" ]]; then 81 | echo -e "\nDownloading Zipkin Server" 82 | rm -rf zipkin.jar || echo "No zipkin.jar to remove" 83 | curl -sSL https://zipkin.io/quickstart.sh | bash -s 84 | else 85 | echo "Won't download zipkin - the [DOWNLOAD_ZIPKIN] switch is set to false" 86 | fi 87 | popd 88 | 89 | echo -e "\nWaiting for 30 seconds for rabbit to work" 90 | sleep 30 91 | 92 | echo -e "\nStarting Zipkin Server..." 93 | if [[ "${WITH_RABBIT}" == "yes" ]] ; then 94 | echo "Will use rabbit to send spans" 95 | ZIPKIN_ARGS="-DRABBIT_ADDRESSES=${DEFAULT_HEALTH_HOST}:${RABBIT_PORT}" 96 | else 97 | echo "Will use web to send spans" 98 | MEM_ARGS="${MEM_ARGS} -Dspring.zipkin.sender.type=WEB" 99 | fi 100 | 101 | mkdir -p build 102 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} ${ZIPKIN_ARGS} -jar zipkin-server/target/zipkin.jar > build/zipkin.log & 103 | 104 | echo -e "\nStarting the apps..." 105 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service1/target/*.jar --server.port="${SERVICE1_PORT}" > build/service1.log & 106 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service2/target/*.jar --server.port="${SERVICE2_PORT}" > build/service2.log & 107 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service3/target/*.jar --server.port="${SERVICE3_PORT}" > build/service3.log & 108 | nohup ${JAVA_PATH_TO_BIN}java ${MEM_ARGS} -jar service4/target/*.jar --server.port="${SERVICE4_PORT}" > build/service4.log & 109 | 110 | echo -e "\n\nChecking if Zipkin is alive" 111 | check_app ${ZIPKIN_PORT} 112 | echo -e "\n\nChecking if Service1 is alive" 113 | check_app ${SERVICE1_PORT} 114 | echo -e "\n\nChecking if Service2 is alive" 115 | check_app ${SERVICE2_PORT} 116 | echo -e "\n\nChecking if Service3 is alive" 117 | check_app ${SERVICE3_PORT} 118 | echo -e "\n\nChecking if Service4 is alive" 119 | check_app ${SERVICE4_PORT} 120 | -------------------------------------------------------------------------------- /service2/src/main/java/io/spring/cloud/sleuth/docs/service2/Application.java: -------------------------------------------------------------------------------- 1 | package io.spring.cloud.sleuth.docs.service2; 2 | 3 | import java.io.IOException; 4 | import java.util.concurrent.Callable; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.boot.SpringApplication; 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; 12 | import org.springframework.cloud.sleuth.BaggageInScope; 13 | import org.springframework.cloud.sleuth.Span; 14 | import org.springframework.cloud.sleuth.Tracer; 15 | import org.springframework.context.annotation.Bean; 16 | import org.springframework.http.client.ClientHttpResponse; 17 | import org.springframework.http.client.SimpleClientHttpRequestFactory; 18 | import org.springframework.web.bind.annotation.GetMapping; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | import org.springframework.web.bind.annotation.RestController; 21 | import org.springframework.web.client.DefaultResponseErrorHandler; 22 | import org.springframework.web.client.RestTemplate; 23 | 24 | @SpringBootApplication 25 | @RestController 26 | public class Application { 27 | 28 | private static final Logger log = LoggerFactory.getLogger(Application.class); 29 | 30 | @Bean 31 | RestTemplate restTemplate() { 32 | SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); 33 | clientHttpRequestFactory.setConnectTimeout(2000); 34 | clientHttpRequestFactory.setReadTimeout(3000); 35 | RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory); 36 | restTemplate.setErrorHandler(new DefaultResponseErrorHandler() { 37 | @Override 38 | public boolean hasError(ClientHttpResponse response) 39 | throws IOException { 40 | try { 41 | return super.hasError(response); 42 | } 43 | catch (Exception e) { 44 | return true; 45 | } 46 | } 47 | 48 | @Override 49 | public void handleError(ClientHttpResponse response) 50 | throws IOException { 51 | try { 52 | super.handleError(response); 53 | } 54 | catch (Exception e) { 55 | log.error("Exception [" + e.getMessage() + "] occurred while trying to send the request", e); 56 | throw e; 57 | } 58 | } 59 | }); 60 | return restTemplate; 61 | } 62 | 63 | 64 | public static void main(String... args) { 65 | new SpringApplication(Application.class).run(args); 66 | } 67 | } 68 | 69 | @RestController 70 | class Service2Controller { 71 | private static final Logger log = LoggerFactory.getLogger(Service2Controller.class); 72 | 73 | private final RestTemplate restTemplate; 74 | private final Tracer tracer; 75 | private final String serviceAddress3; 76 | private final String serviceAddress4; 77 | private final int port; 78 | 79 | Service2Controller(RestTemplate restTemplate, Tracer tracer, 80 | @Value("${service3.address:localhost:8083}") String serviceAddress3, 81 | @Value("${service4.address:localhost:8084}") String serviceAddress4, 82 | @Value("${server.port:8082}") int port) { 83 | this.restTemplate = restTemplate; 84 | this.tracer = tracer; 85 | this.serviceAddress3 = serviceAddress3; 86 | this.serviceAddress4 = serviceAddress4; 87 | this.port = port; 88 | } 89 | 90 | // for the tracing presentation 91 | @GetMapping("/memeoverflow") 92 | public String memeOverflow() throws InterruptedException { 93 | throw new IllegalStateException("Meme overflow occurred"); 94 | } 95 | 96 | @RequestMapping("/foo") 97 | public String service2MethodInController() throws InterruptedException { 98 | Thread.sleep(200); 99 | try (BaggageInScope baggage = this.tracer.getBaggage("key")) { 100 | log.info("Service2: Baggage for [key] is [" + (baggage == null ? null : baggage.get()) + "]"); 101 | log.info("Hello from service2. Calling service3 and then service4"); 102 | String service3 = restTemplate.getForObject("http://" + serviceAddress3 + "/bar", String.class); 103 | log.info("Got response from service3 [{}]", service3); 104 | String service4 = restTemplate.getForObject("http://" + serviceAddress4 + "/baz", String.class); 105 | log.info("Got response from service4 [{}]", service4); 106 | return String.format("Hello from service2, response from service3 [%s] and from service4 [%s]", service3, service4); 107 | } 108 | } 109 | 110 | @RequestMapping("/readtimeout") 111 | public String connectionTimeout() throws InterruptedException { 112 | Span span = this.tracer.nextSpan().name("second_span"); 113 | Thread.sleep(500); 114 | try (Tracer.SpanInScope ws = this.tracer.withSpan(span.start())) { 115 | log.info("Calling a missing service"); 116 | restTemplate.getForObject("http://localhost:" + port + "/blowup", String.class); 117 | return "Should blow up"; 118 | } 119 | catch (Exception e) { 120 | log.error("Exception occurred while trying to send a request to a missing service", e); 121 | throw e; 122 | } 123 | finally { 124 | span.end(); 125 | } 126 | } 127 | 128 | @RequestMapping("/blowup") 129 | public Callable blowUp() throws InterruptedException { 130 | return () -> { 131 | Thread.sleep(4000); 132 | throw new RuntimeException("Should blow up"); 133 | }; 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /service1/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /service2/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /service3/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /service4/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /acceptance-tests/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,city=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | set MAVEN_CMD_LINE_ARGS=%* 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | 121 | set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" 122 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 123 | 124 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% 125 | if ERRORLEVEL 1 goto error 126 | goto end 127 | 128 | :error 129 | set ERROR_CODE=1 130 | 131 | :end 132 | @endlocal & set ERROR_CODE=%ERROR_CODE% 133 | 134 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 135 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 136 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 137 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 138 | :skipRcPost 139 | 140 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 141 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 142 | 143 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 144 | 145 | exit /B %ERROR_CODE% -------------------------------------------------------------------------------- /service2/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.spring.cloud.sleuth.docs 6 | service2 7 | 1.0.0.SLEUTH_DOCS 8 | 9 | 10 | org.springframework.boot 11 | spring-boot-starter-parent 12 | 2.7.4 13 | 14 | 15 | 16 | 17 | 2021.0.2-SNAPSHOT 18 | UTF-8 19 | UTF-8 20 | 1.8 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | org.springframework.cloud 29 | spring-cloud-starter-sleuth 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-actuator 34 | 35 | 36 | net.logstash.logback 37 | logstash-logback-encoder 38 | 7.2 39 | runtime 40 | 41 | 42 | logback-core 43 | ch.qos.logback 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.springframework.cloud 52 | spring-cloud-dependencies 53 | ${spring-cloud.version} 54 | import 55 | pom 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | build-image 68 | package 69 | 70 | build-image 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | default 81 | 82 | true 83 | 84 | 85 | 86 | org.springframework.cloud 87 | spring-cloud-sleuth-zipkin 88 | 89 | 90 | 91 | 92 | wavefront 93 | 94 | 2.3.0 95 | 96 | 97 | 98 | 99 | com.wavefront 100 | wavefront-spring-boot-bom 101 | ${wavefront.version} 102 | pom 103 | import 104 | 105 | 106 | 107 | 108 | 109 | com.wavefront 110 | wavefront-spring-boot-starter 111 | 112 | 113 | 114 | 115 | logzio 116 | 117 | 118 | io.logz.logback 119 | logzio-logback-appender 120 | 1.0.28 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | spring-snapshots 129 | Spring Snapshots 130 | https://repo.spring.io/snapshot 131 | 132 | true 133 | 134 | 135 | 136 | spring-milestones 137 | Spring Milestones 138 | https://repo.spring.io/milestone 139 | 140 | false 141 | 142 | 143 | 144 | spring-releases 145 | Spring Releases 146 | https://repo.spring.io/release 147 | 148 | false 149 | 150 | 151 | 152 | 153 | 154 | spring-snapshots 155 | Spring Snapshots 156 | https://repo.spring.io/snapshot 157 | 158 | true 159 | 160 | 161 | 162 | spring-milestones 163 | Spring Milestones 164 | https://repo.spring.io/milestone 165 | 166 | false 167 | 168 | 169 | 170 | spring-plugin-snapshots 171 | Spring Snapshots 172 | https://repo.spring.io/snapshot 173 | 174 | true 175 | 176 | 177 | 178 | spring-plugin-milestones 179 | Spring Milestones 180 | https://repo.spring.io/release 181 | 182 | false 183 | 184 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /service3/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.spring.cloud.sleuth.docs 6 | service3 7 | 1.0.0.SLEUTH_DOCS 8 | 9 | 10 | org.springframework.boot 11 | spring-boot-starter-parent 12 | 2.7.4 13 | 14 | 15 | 16 | 17 | 2021.0.2-SNAPSHOT 18 | UTF-8 19 | UTF-8 20 | 1.8 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | org.springframework.cloud 29 | spring-cloud-starter-sleuth 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-actuator 34 | 35 | 36 | net.logstash.logback 37 | logstash-logback-encoder 38 | 7.2 39 | runtime 40 | 41 | 42 | logback-core 43 | ch.qos.logback 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | org.springframework.cloud 52 | spring-cloud-dependencies 53 | ${spring-cloud.version} 54 | import 55 | pom 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | build-image 68 | package 69 | 70 | build-image 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | default 81 | 82 | true 83 | 84 | 85 | 86 | org.springframework.cloud 87 | spring-cloud-sleuth-zipkin 88 | 89 | 90 | 91 | 92 | wavefront 93 | 94 | 2.3.0 95 | 96 | 97 | 98 | 99 | com.wavefront 100 | wavefront-spring-boot-bom 101 | ${wavefront.version} 102 | pom 103 | import 104 | 105 | 106 | 107 | 108 | 109 | com.wavefront 110 | wavefront-spring-boot-starter 111 | 112 | 113 | 114 | 115 | logzio 116 | 117 | 118 | io.logz.logback 119 | logzio-logback-appender 120 | 1.0.28 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | spring-snapshots 129 | Spring Snapshots 130 | https://repo.spring.io/snapshot 131 | 132 | true 133 | 134 | 135 | 136 | spring-milestones 137 | Spring Milestones 138 | https://repo.spring.io/milestone 139 | 140 | false 141 | 142 | 143 | 144 | spring-releases 145 | Spring Releases 146 | https://repo.spring.io/release 147 | 148 | false 149 | 150 | 151 | 152 | 153 | 154 | spring-snapshots 155 | Spring Snapshots 156 | https://repo.spring.io/snapshot 157 | 158 | true 159 | 160 | 161 | 162 | spring-milestones 163 | Spring Milestones 164 | https://repo.spring.io/milestone 165 | 166 | false 167 | 168 | 169 | 170 | spring-plugin-snapshots 171 | Spring Snapshots 172 | https://repo.spring.io/snapshot 173 | 174 | true 175 | 176 | 177 | 178 | spring-plugin-milestones 179 | Spring Milestones 180 | https://repo.spring.io/release 181 | 182 | false 183 | 184 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /acceptance-tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.spring.cloud.sleuth.docs 6 | acceptance-tests 7 | 1.0.0.SLEUTH_DOCS 8 | 9 | 10 | org.springframework.boot 11 | spring-boot-starter-parent 12 | 2.7.4 13 | 14 | 15 | 16 | 17 | 2021.0.2-SNAPSHOT 18 | UTF-8 19 | UTF-8 20 | 1.8 21 | 22 | 23 | 24 | org.aspectj 25 | aspectjrt 26 | compile 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | compile 32 | 33 | 34 | org.codehaus.groovy 35 | groovy 36 | 37 | 38 | org.codehaus.groovy 39 | groovy-json 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-actuator 44 | test 45 | 46 | 47 | org.awaitility 48 | awaitility 49 | 4.2.0 50 | test 51 | 52 | 53 | org.springframework.boot 54 | spring-boot-starter-test 55 | test 56 | 57 | 58 | org.springframework.cloud 59 | spring-cloud-starter-sleuth 60 | test 61 | 62 | 63 | io.zipkin.java 64 | zipkin 65 | 2.10.1 66 | test 67 | 68 | 69 | 70 | 71 | 72 | org.springframework.cloud 73 | spring-cloud-dependencies 74 | ${spring-cloud.version} 75 | import 76 | pom 77 | 78 | 79 | org.codehaus.groovy 80 | groovy-all 81 | 3.0.19 82 | pom 83 | 84 | 85 | 86 | 87 | 88 | 89 | org.apache.maven.plugins 90 | maven-surefire-plugin 91 | 92 | 93 | **/*Test.* 94 | **/*Tests.* 95 | 96 | true 97 | 98 | 99 | 100 | org.codehaus.gmavenplus 101 | gmavenplus-plugin 102 | 2.1.0 103 | 104 | 105 | 106 | compileTests 107 | addTestSources 108 | 109 | 110 | 111 | 112 | 113 | 114 | ${project.basedir}/src/test/groovy 115 | 116 | **/*.groovy 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | spring-snapshots 128 | Spring Snapshots 129 | https://repo.spring.io/snapshot 130 | 131 | true 132 | 133 | 134 | 135 | spring-milestones 136 | Spring Milestones 137 | https://repo.spring.io/milestone 138 | 139 | false 140 | 141 | 142 | 143 | spring-releases 144 | Spring Releases 145 | https://repo.spring.io/release 146 | 147 | false 148 | 149 | 150 | 151 | 152 | 153 | spring-snapshots 154 | Spring Snapshots 155 | https://repo.spring.io/snapshot 156 | 157 | true 158 | 159 | 160 | 161 | spring-milestones 162 | Spring Milestones 163 | https://repo.spring.io/milestone 164 | 165 | false 166 | 167 | 168 | 169 | spring-plugin-snapshots 170 | Spring Snapshots 171 | https://repo.spring.io/snapshot 172 | 173 | true 174 | 175 | 176 | 177 | spring-plugin-milestones 178 | Spring Milestones 179 | https://repo.spring.io/release 180 | 181 | false 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /service4/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.spring.cloud.sleuth.docs 6 | service4 7 | 1.0.0.SLEUTH_DOCS 8 | 9 | 10 | org.springframework.boot 11 | spring-boot-starter-parent 12 | 2.7.4 13 | 14 | 15 | 16 | 17 | 2021.0.2-SNAPSHOT 18 | 1.1.5-SNAPSHOT 19 | UTF-8 20 | UTF-8 21 | 1.8 22 | 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | org.springframework.cloud 30 | spring-cloud-starter-sleuth 31 | 32 | 33 | org.springframework.cloud 34 | spring-cloud-sleuth-brave 35 | 36 | 37 | 38 | 39 | org.springframework.cloud 40 | spring-cloud-sleuth-otel-autoconfigure 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-actuator 45 | 46 | 47 | net.logstash.logback 48 | logstash-logback-encoder 49 | 7.2 50 | runtime 51 | 52 | 53 | logback-core 54 | ch.qos.logback 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.springframework.cloud 63 | spring-cloud-dependencies 64 | ${spring-cloud.version} 65 | import 66 | pom 67 | 68 | 69 | org.springframework.cloud 70 | spring-cloud-sleuth-otel-dependencies 71 | ${spring-cloud-sleuth-otel.version} 72 | import 73 | pom 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | org.springframework.boot 82 | spring-boot-maven-plugin 83 | 84 | 85 | build-image 86 | package 87 | 88 | build-image 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | default 99 | 100 | true 101 | 102 | 103 | 104 | org.springframework.cloud 105 | spring-cloud-sleuth-zipkin 106 | 107 | 108 | io.opentelemetry 109 | opentelemetry-exporter-zipkin 110 | 111 | 112 | 113 | 114 | wavefront 115 | 116 | 2.3.0 117 | 118 | 119 | 120 | 121 | com.wavefront 122 | wavefront-spring-boot-bom 123 | ${wavefront.version} 124 | pom 125 | import 126 | 127 | 128 | 129 | 130 | 131 | com.wavefront 132 | wavefront-spring-boot-starter 133 | 134 | 135 | 136 | 137 | logzio 138 | 139 | 140 | io.logz.logback 141 | logzio-logback-appender 142 | 1.0.28 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | spring-snapshots 151 | Spring Snapshots 152 | https://repo.spring.io/snapshot 153 | 154 | true 155 | 156 | 157 | 158 | spring-milestones 159 | Spring Milestones 160 | https://repo.spring.io/milestone 161 | 162 | false 163 | 164 | 165 | 166 | spring-releases 167 | Spring Releases 168 | https://repo.spring.io/release 169 | 170 | false 171 | 172 | 173 | 174 | 175 | 176 | spring-snapshots 177 | Spring Snapshots 178 | https://repo.spring.io/snapshot 179 | 180 | true 181 | 182 | 183 | 184 | spring-milestones 185 | Spring Milestones 186 | https://repo.spring.io/milestone 187 | 188 | false 189 | 190 | 191 | 192 | spring-plugin-snapshots 193 | Spring Snapshots 194 | https://repo.spring.io/snapshot 195 | 196 | true 197 | 198 | 199 | 200 | spring-plugin-milestones 201 | Spring Milestones 202 | https://repo.spring.io/release 203 | 204 | false 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /service1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | io.spring.cloud.sleuth.docs 6 | service1 7 | 1.0.0.SLEUTH_DOCS 8 | 9 | 10 | org.springframework.boot 11 | spring-boot-starter-parent 12 | 2.7.4 13 | 14 | 15 | 16 | 17 | 2021.0.2-SNAPSHOT 18 | 1.1.5-SNAPSHOT 19 | UTF-8 20 | UTF-8 21 | 1.8 22 | 23 | 24 | 25 | org.springframework.cloud 26 | spring-cloud-starter-sleuth 27 | 28 | 29 | org.springframework.cloud 30 | spring-cloud-sleuth-brave 31 | 32 | 33 | 34 | 35 | org.springframework.cloud 36 | spring-cloud-sleuth-otel-autoconfigure 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-actuator 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-webflux 45 | 46 | 47 | net.logstash.logback 48 | logstash-logback-encoder 49 | 7.2 50 | runtime 51 | 52 | 53 | logback-core 54 | ch.qos.logback 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.springframework.cloud 63 | spring-cloud-dependencies 64 | ${spring-cloud.version} 65 | import 66 | pom 67 | 68 | 69 | org.springframework.cloud 70 | spring-cloud-sleuth-otel-dependencies 71 | ${spring-cloud-sleuth-otel.version} 72 | import 73 | pom 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | org.springframework.boot 82 | spring-boot-maven-plugin 83 | 84 | 85 | build-image 86 | package 87 | 88 | build-image 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | default 99 | 100 | true 101 | 102 | 103 | 104 | org.springframework.cloud 105 | spring-cloud-sleuth-zipkin 106 | compile 107 | 108 | 109 | io.opentelemetry 110 | opentelemetry-exporter-zipkin 111 | 112 | 113 | 114 | 115 | wavefront 116 | 117 | 2.3.0 118 | 119 | 120 | 121 | 122 | com.wavefront 123 | wavefront-spring-boot-bom 124 | ${wavefront.version} 125 | pom 126 | import 127 | 128 | 129 | 130 | 131 | 132 | com.wavefront 133 | wavefront-spring-boot-starter 134 | 135 | 136 | 137 | 138 | logzio 139 | 140 | 141 | io.logz.logback 142 | logzio-logback-appender 143 | 1.0.28 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | spring-snapshots 152 | Spring Snapshots 153 | https://repo.spring.io/snapshot 154 | 155 | true 156 | 157 | 158 | 159 | spring-milestones 160 | Spring Milestones 161 | https://repo.spring.io/milestone 162 | 163 | false 164 | 165 | 166 | 167 | spring-releases 168 | Spring Releases 169 | https://repo.spring.io/release 170 | 171 | false 172 | 173 | 174 | 175 | 176 | 177 | spring-snapshots 178 | Spring Snapshots 179 | https://repo.spring.io/snapshot 180 | 181 | true 182 | 183 | 184 | 185 | spring-milestones 186 | Spring Milestones 187 | https://repo.spring.io/milestone 188 | 189 | false 190 | 191 | 192 | 193 | spring-plugin-snapshots 194 | Spring Snapshots 195 | https://repo.spring.io/snapshot 196 | 197 | true 198 | 199 | 200 | 201 | spring-plugin-milestones 202 | Spring Milestones 203 | https://repo.spring.io/release 204 | 205 | false 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /presentation-service/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /service1/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /service2/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /service3/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /service4/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /acceptance-tests/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # 58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look 59 | # for the new JDKs provided by Oracle. 60 | # 61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then 62 | # 63 | # Apple JDKs 64 | # 65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home 66 | fi 67 | 68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then 69 | # 70 | # Apple JDKs 71 | # 72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 73 | fi 74 | 75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then 76 | # 77 | # Oracle JDKs 78 | # 79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home 80 | fi 81 | 82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then 83 | # 84 | # Apple JDKs 85 | # 86 | export JAVA_HOME=`/usr/libexec/java_home` 87 | fi 88 | ;; 89 | esac 90 | 91 | if [ -z "$JAVA_HOME" ] ; then 92 | if [ -r /etc/gentoo-release ] ; then 93 | JAVA_HOME=`java-config --jre-home` 94 | fi 95 | fi 96 | 97 | if [ -z "$M2_HOME" ] ; then 98 | ## resolve links - $0 may be a link to maven's home 99 | PRG="$0" 100 | 101 | # need this for relative symlinks 102 | while [ -h "$PRG" ] ; do 103 | ls=`ls -ld "$PRG"` 104 | link=`expr "$ls" : '.*-> \(.*\)$'` 105 | if expr "$link" : '/.*' > /dev/null; then 106 | PRG="$link" 107 | else 108 | PRG="`dirname "$PRG"`/$link" 109 | fi 110 | done 111 | 112 | saveddir=`pwd` 113 | 114 | M2_HOME=`dirname "$PRG"`/.. 115 | 116 | # make it fully qualified 117 | M2_HOME=`cd "$M2_HOME" && pwd` 118 | 119 | cd "$saveddir" 120 | # echo Using m2 at $M2_HOME 121 | fi 122 | 123 | # For Cygwin, ensure paths are in UNIX format before anything is touched 124 | if $cygwin ; then 125 | [ -n "$M2_HOME" ] && 126 | M2_HOME=`cygpath --unix "$M2_HOME"` 127 | [ -n "$JAVA_HOME" ] && 128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 129 | [ -n "$CLASSPATH" ] && 130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 131 | fi 132 | 133 | # For Migwn, ensure paths are in UNIX format before anything is touched 134 | if $mingw ; then 135 | [ -n "$M2_HOME" ] && 136 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 137 | [ -n "$JAVA_HOME" ] && 138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 139 | # TODO classpath? 140 | fi 141 | 142 | if [ -z "$JAVA_HOME" ]; then 143 | javaExecutable="`which javac`" 144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 145 | # readlink(1) is not available as standard on Solaris 10. 146 | readLink=`which readlink` 147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 148 | if $darwin ; then 149 | javaHome="`dirname \"$javaExecutable\"`" 150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 151 | else 152 | javaExecutable="`readlink -f \"$javaExecutable\"`" 153 | fi 154 | javaHome="`dirname \"$javaExecutable\"`" 155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 156 | JAVA_HOME="$javaHome" 157 | export JAVA_HOME 158 | fi 159 | fi 160 | fi 161 | 162 | if [ -z "$JAVACMD" ] ; then 163 | if [ -n "$JAVA_HOME" ] ; then 164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 165 | # IBM's JDK on AIX uses strange locations for the executables 166 | JAVACMD="$JAVA_HOME/jre/sh/java" 167 | else 168 | JAVACMD="$JAVA_HOME/bin/java" 169 | fi 170 | else 171 | JAVACMD="`which java`" 172 | fi 173 | fi 174 | 175 | if [ ! -x "$JAVACMD" ] ; then 176 | echo "Error: JAVA_HOME is not defined correctly." >&2 177 | echo " We cannot execute $JAVACMD" >&2 178 | exit 1 179 | fi 180 | 181 | if [ -z "$JAVA_HOME" ] ; then 182 | echo "Warning: JAVA_HOME environment variable is not set." 183 | fi 184 | 185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 186 | 187 | # For Cygwin, switch paths to Windows format before running java 188 | if $cygwin; then 189 | [ -n "$M2_HOME" ] && 190 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 191 | [ -n "$JAVA_HOME" ] && 192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 193 | [ -n "$CLASSPATH" ] && 194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 195 | fi 196 | 197 | # traverses directory structure from process work directory to filesystem root 198 | # first directory with .mvn subdirectory is considered project base directory 199 | find_maven_basedir() { 200 | local basedir=$(pwd) 201 | local wdir=$(pwd) 202 | while [ "$wdir" != '/' ] ; do 203 | if [ -d "$wdir"/.mvn ] ; then 204 | basedir=$wdir 205 | break 206 | fi 207 | wdir=$(cd "$wdir/.."; pwd) 208 | done 209 | echo "${basedir}" 210 | } 211 | 212 | # concatenates all lines of a file 213 | concat_lines() { 214 | if [ -f "$1" ]; then 215 | echo "$(tr -s '\n' ' ' < "$1")" 216 | fi 217 | } 218 | 219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} 220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 221 | 222 | # Provide a "standardized" way to retrieve the CLI args that will 223 | # work with both Windows and non-Windows executions. 224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 225 | export MAVEN_CMD_LINE_ARGS 226 | 227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 228 | 229 | exec "$JAVACMD" \ 230 | $MAVEN_OPTS \ 231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 233 | ${WRAPPER_LAUNCHER} "$@" 234 | -------------------------------------------------------------------------------- /acceptance-tests/src/test/groovy/io/spring/cloud/samples/docs/acceptance/MessageFlowTests.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2015 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.spring.cloud.samples.docs.acceptance 17 | 18 | import groovy.json.JsonSlurper 19 | import groovy.transform.CompileDynamic 20 | import groovy.transform.CompileStatic 21 | import groovy.util.logging.Slf4j 22 | import io.spring.cloud.samples.docs.acceptance.common.tech.ExceptionLoggingRestTemplate 23 | import io.spring.cloud.samples.docs.acceptance.common.tech.SpanUtil 24 | import io.spring.cloud.samples.docs.acceptance.common.tech.TestConfiguration 25 | import org.awaitility.core.ThrowingRunnable 26 | import org.junit.jupiter.api.Test 27 | import zipkin2.Span 28 | import zipkin2.codec.SpanBytesDecoder 29 | 30 | import org.springframework.beans.factory.annotation.Value 31 | import org.springframework.boot.test.context.SpringBootTest 32 | import org.springframework.http.HttpHeaders 33 | import org.springframework.http.HttpMethod 34 | import org.springframework.http.HttpStatus 35 | import org.springframework.http.RequestEntity 36 | import org.springframework.http.ResponseEntity 37 | import org.springframework.web.client.RestTemplate 38 | 39 | import static java.util.concurrent.TimeUnit.SECONDS 40 | import static org.awaitility.Awaitility.await 41 | 42 | @SpringBootTest(classes = TestConfiguration) 43 | @Slf4j 44 | @CompileStatic 45 | class MessageFlowTests { 46 | 47 | public static final String TRACE_ID_HEADER_NAME = "X-B3-TraceId" 48 | public static final String SPAN_ID_NAME = "X-B3-SpanId" 49 | private static final List APP_NAMES = ['service1', 'service2', 'service3', 'service4'] 50 | 51 | @Value('${service1.address:http://localhost:8081}') 52 | String service1Url 53 | @Value('${zipkin.query.port:9411}') 54 | Integer zipkinQueryPort 55 | @Value('${LOCAL_URL:http://localhost}') 56 | String zipkinQueryUrl 57 | 58 | @Test 59 | void 'should send message to service1 and receive combined response for traceId'() { 60 | String traceId = SpanUtil.idToHex(new Random().nextLong()) 61 | //given: "Request with a traceId" 62 | RequestEntity request = request_to_service1(traceId) 63 | //when: "Request is sent to the Service1" 64 | request_sent_for_service1_with_traceId(request) 65 | //then: "Entry in Zipkin is present for the traceId" 66 | entry_for_trace_id_is_present_in_Zipkin(traceId) 67 | //and: "The dependency graph looks like in the docs" 68 | dependency_graph_is_correct() 69 | } 70 | 71 | @Test 72 | void 'should send message to service1 and get read timeout'() { 73 | String traceId = SpanUtil.idToHex(new Random().nextLong()) 74 | //given: "Request with a traceId" 75 | RequestEntity request = request_to_service1_at_readtimeout(traceId) 76 | //when: "Failing request is sent to the Service1" 77 | failing_request_sent_for_service1_with_traceId(request) 78 | //then: "Entry in Zipkin is present for the traceId" 79 | failed_entry_for_trace_id_is_present_in_Zipkin(traceId) 80 | } 81 | 82 | @CompileStatic 83 | private void request_sent_for_service1_with_traceId(RequestEntity request) { 84 | await().pollInterval(1, SECONDS).atMost(60, SECONDS).untilAsserted(new ThrowingRunnable() { 85 | @Override 86 | void run() { 87 | ResponseEntity service1Response = restTemplate().exchange(request, String) 88 | log.info("Response from service1Response is [$service1Response]") 89 | assert service1Response != null 90 | assert service1Response.statusCode == HttpStatus.OK 91 | assert service1Response.body.contains('Hello from service2, response from service3 [Hello from service3] and from service4 [Hello from service4]') 92 | log.info("The Sleuth Docs apps are working! Let's be happy!") 93 | } 94 | }) 95 | } 96 | 97 | @CompileStatic 98 | private failing_request_sent_for_service1_with_traceId(RequestEntity request) { 99 | await().pollInterval(1, SECONDS).atMost(60, SECONDS).untilAsserted(new ThrowingRunnable() { 100 | @Override 101 | void run() { 102 | ResponseEntity service1Response = restTemplate().exchange(request, String) 103 | log.info("Response from service1Response is [$service1Response]") 104 | assert service1Response != null 105 | assert service1Response.statusCode == HttpStatus.INTERNAL_SERVER_ERROR || service1Response.body.contains('''"status":500,"error":"Internal Server Error"''') 106 | } 107 | }) 108 | } 109 | 110 | private RequestEntity request_to_service1(String traceId) { 111 | HttpHeaders headers = new HttpHeaders() 112 | headers.add(SPAN_ID_NAME, traceId) 113 | headers.add(TRACE_ID_HEADER_NAME, traceId) 114 | URI uri = URI.create(wrapWithProtocolIfPresent("$service1Url/start")) 115 | RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.POST, uri) 116 | log.info("Request with traceid [$traceId] to service1 [$requestEntity] is ready") 117 | return requestEntity 118 | } 119 | 120 | private RequestEntity request_to_service1_at_readtimeout(String traceId) { 121 | HttpHeaders headers = new HttpHeaders() 122 | headers.add(SPAN_ID_NAME, traceId) 123 | headers.add(TRACE_ID_HEADER_NAME, traceId) 124 | URI uri = URI.create(wrapWithProtocolIfPresent("$service1Url/readtimeout")) 125 | RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.POST, uri) 126 | log.info("Request with traceid [$traceId] to service1 [$requestEntity] is ready") 127 | return requestEntity 128 | } 129 | 130 | private void entry_for_trace_id_is_present_in_Zipkin(String traceId) { 131 | await().pollInterval(1, SECONDS).atMost(60, SECONDS).untilAsserted(new ThrowingRunnable() { 132 | @Override 133 | @CompileDynamic 134 | void run() { 135 | ResponseEntity response = checkStateOfTheTraceId(traceId) 136 | log.info("Response from the Zipkin query service about the trace id [$response] for trace with id [$traceId]") 137 | assert response.statusCode == HttpStatus.OK 138 | assert response.hasBody() 139 | log.info("Checking spans") 140 | List spans = SpanBytesDecoder.JSON_V2.decodeList(response.body.bytes) 141 | List serviceNamesNotFoundInZipkin = serviceNamesNotFoundInZipkin(spans) 142 | log.info("The following services were not found in Zipkin $serviceNamesNotFoundInZipkin") 143 | assert serviceNamesNotFoundInZipkin.empty 144 | log.info("Zipkin tracing is working! Sleuth is working! Let's be happy!") 145 | } 146 | 147 | @CompileDynamic 148 | private List serviceNamesNotFoundInZipkin(List spans) { 149 | List remoteServiceName = spans.collect { 150 | it.remoteServiceName() 151 | }.flatten().unique() 152 | List localServiceName = spans.collect { 153 | it.localServiceName() 154 | }.flatten().unique() 155 | return (APP_NAMES - remoteServiceName - localServiceName) 156 | } 157 | }) 158 | } 159 | 160 | private void failed_entry_for_trace_id_is_present_in_Zipkin(String traceId) { 161 | await().pollInterval(1, SECONDS).atMost(60, SECONDS).untilAsserted(new ThrowingRunnable() { 162 | @Override 163 | @CompileDynamic 164 | void run() { 165 | ResponseEntity response = checkStateOfTheTraceId(traceId) 166 | log.info("Response from the Zipkin query service about the trace id [$response] for trace with id [$traceId]") 167 | assert response.statusCode == HttpStatus.OK 168 | assert response.hasBody() 169 | List spans = SpanBytesDecoder.JSON_V2.decodeList(response.body.bytes) 170 | // we're checking if the latest annotation based functionality is working 171 | Span foundSpan = spans.find { 172 | it.name() == "first_span" && it.tags().find { it.key == "someTag" } && 173 | // Brave || Otel 174 | it.tags().find { it.key == "error" } || it.annotations().find { it.value() == "exception" } 175 | } 176 | log.info("The following spans <{}> were found in Zipkin for the traceid <{}>", spans, traceId) 177 | log.info("Span with name [first_span] found? [" + foundSpan + "]") 178 | assert foundSpan != null 179 | log.info("Zipkin tracing is working! Sleuth is working! Let's be happy!") 180 | } 181 | }) 182 | } 183 | 184 | private String parsedZipkinQuery() { 185 | return zipkinQueryUrl.split(" ")[0] 186 | } 187 | 188 | private ResponseEntity checkStateOfTheTraceId(String traceId) { 189 | URI uri = URI.create("${wrapQueryWithProtocolIfPresent() ?: parsedZipkinQuery()}:${zipkinQueryPort}/api/v2/trace/$traceId") 190 | HttpHeaders headers = new HttpHeaders() 191 | log.info("Sending request to the Zipkin query service [$uri]. Checking presence of trace id [$traceId]") 192 | return new ExceptionLoggingRestTemplate().exchange( 193 | new RequestEntity<>(headers, HttpMethod.GET, uri), String 194 | ) 195 | } 196 | 197 | @CompileDynamic 198 | private void dependency_graph_is_correct() { 199 | await().pollInterval(1, SECONDS).atMost(60, SECONDS).untilAsserted(new ThrowingRunnable() { 200 | @Override 201 | void run() { 202 | ResponseEntity response = checkDependencies() 203 | log.info("Response from the Zipkin query service about the dependencies [$response]") 204 | assert response.statusCode == HttpStatus.OK 205 | assert response.hasBody() 206 | Map> parentsAndChildren = [:] 207 | new JsonSlurper().parseText(response.body).inject(parentsAndChildren) { Map acc, def json -> 208 | def list = acc[json.parent] ?: [] 209 | list << json.child 210 | acc.put(json.parent, list) 211 | return acc 212 | } 213 | assert parentsAndChildren['service1'] == ['service2'] 214 | assert parentsAndChildren['service2'].containsAll(['service3', 'service4']) 215 | } 216 | }) 217 | } 218 | 219 | private ResponseEntity checkDependencies() { 220 | URI uri = URI.create(wrapWithProtocolIfPresent("${wrapQueryWithProtocolIfPresent() ?: parsedZipkinQuery()}:${zipkinQueryPort}/api/v2/dependencies?endTs=${System.currentTimeMillis()}")) 221 | HttpHeaders headers = new HttpHeaders() 222 | log.info("Sending request to the Zipkin query service [$uri]. Checking the dependency graph") 223 | return new ExceptionLoggingRestTemplate().exchange( 224 | new RequestEntity<>(headers, HttpMethod.GET, uri), String 225 | ) 226 | } 227 | 228 | private String wrapQueryWithProtocolIfPresent() { 229 | String zipkinUrlFromEnvs = System.getenv('spring.zipkin.query.url') 230 | if (zipkinUrlFromEnvs) { 231 | zipkinUrlFromEnvs = zipkinUrlFromEnvs.split(" ")[0] 232 | return "https://$zipkinUrlFromEnvs" 233 | } 234 | return zipkinUrlFromEnvs 235 | } 236 | 237 | private String wrapWithProtocolIfPresent(String url) { 238 | if (!url.startsWith("http")) { 239 | return "http://$url" 240 | } 241 | return url 242 | } 243 | 244 | private RestTemplate restTemplate() { 245 | return new ExceptionLoggingRestTemplate() 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /presentation-service/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | # Provide a "standardized" way to retrieve the CLI args that will 300 | # work with both Windows and non-Windows executions. 301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 302 | export MAVEN_CMD_LINE_ARGS 303 | 304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 305 | 306 | exec "$JAVACMD" \ 307 | $MAVEN_OPTS \ 308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 311 | --------------------------------------------------------------------------------