diff --git a/.github/workflows/examples-trace-analytics.yml b/.github/workflows/examples-trace-analytics.yml new file mode 100644 index 0000000000..5b400c6b0f --- /dev/null +++ b/.github/workflows/examples-trace-analytics.yml @@ -0,0 +1,51 @@ +# +# Builds the Trace Analytics Docker image(s). +# This will build the full Docker image for the sample-app which includes +# Python applications and installing onto the base Docker image. +# It also build the Java sample app and corresponding Docker image to +# ensure those continue to build. +# + +name: Trace Analytics Sample App + +on: + push: + branches: [ main ] + paths: + - 'examples/trace-analytics-sample-app/**' + pull_request: + paths: + - 'examples/trace-analytics-sample-app/**' + workflow_dispatch: + +jobs: + docker-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Data Prepper + uses: actions/checkout@v2 + + - name: Build Sample App + working-directory: examples/trace-analytics-sample-app + run: docker build -t sample-app sample-app + + java-app-build: + runs-on: ubuntu-latest + + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Checkout Data Prepper + uses: actions/checkout@v2 + + - name: Build Analytics Service + working-directory: ./examples/trace-analytics-sample-app/sample-app/analytics-service + run: ./gradlew build + + - name: Build Analytics Service Docker image + working-directory: ./examples/trace-analytics-sample-app/sample-app/analytics-service + run: docker build -t analytics-service . diff --git a/examples/trace-analytics-sample-app/sample-app/Dockerfile b/examples/trace-analytics-sample-app/sample-app/Dockerfile index 9bf85e3e35..3c160cd98f 100644 --- a/examples/trace-analytics-sample-app/sample-app/Dockerfile +++ b/examples/trace-analytics-sample-app/sample-app/Dockerfile @@ -11,26 +11,26 @@ COPY analytics-service /home/gradle/src/ WORKDIR /home/gradle/src RUN gradle bootJar --daemon -RUN wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.0.1/opentelemetry-javaagent-all.jar +RUN wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.30.0/opentelemetry-javaagent.jar FROM eclipse-temurin:17-jre-jammy -RUN apk update \ -&& apk upgrade \ +RUN apt-get -y update \ +&& apt-get -y upgrade \ # add for grpcio -&& apk add --no-cache g++ \ +&& apt-get -y install g++ \ # add for grpcio -&& apk add --no-cache linux-headers \ -&& apk add --no-cache bash \ -&& apk add --no-cache --virtual=build-dependencies unzip \ -&& apk add --no-cache curl \ +&& apt-get -y install linux-generic \ +&& apt-get -y install bash \ +&& apt-get -y install unzip \ +&& apt-get -y install curl \ # add python3-dev for grpcio -&& apk add --no-cache python3 python3-dev +&& apt-get -y install python3 python3-pip python3-dev RUN mkdir /app COPY . /app/ COPY --from=build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar -COPY --from=build /home/gradle/src/opentelemetry-javaagent-all.jar /app/opentelemetry-javaagent-all.jar +COPY --from=build /home/gradle/src/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar RUN pip3 install --upgrade pip RUN pip3 install -r /app/requirements.txt diff --git a/examples/trace-analytics-sample-app/sample-app/analytics-service/Dockerfile b/examples/trace-analytics-sample-app/sample-app/analytics-service/Dockerfile index 315c8124ad..a8b6cd87a6 100644 --- a/examples/trace-analytics-sample-app/sample-app/analytics-service/Dockerfile +++ b/examples/trace-analytics-sample-app/sample-app/analytics-service/Dockerfile @@ -11,11 +11,11 @@ COPY . /home/gradle/src/ WORKDIR /home/gradle/src RUN gradle bootJar --daemon -RUN wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.0.1/opentelemetry-javaagent-all.jar +RUN wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.30.0/opentelemetry-javaagent.jar FROM eclipse-temurin:17-jre-jammy EXPOSE 8087 RUN mkdir /app COPY --from=build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar -COPY --from=build /home/gradle/src/opentelemetry-javaagent-all.jar /app/opentelemetry-javaagent-all.jar -ENTRYPOINT ["java","-javaagent:/app/opentelemetry-javaagent-all.jar","-jar","/app/spring-boot-application.jar"] +COPY --from=build /home/gradle/src/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar +ENTRYPOINT ["java","-javaagent:/app/opentelemetry-javaagent.jar","-jar","/app/spring-boot-application.jar"] diff --git a/examples/trace-analytics-sample-app/sample-app/authenticationService.py b/examples/trace-analytics-sample-app/sample-app/authenticationService.py index efc13371a9..88d1e48000 100644 --- a/examples/trace-analytics-sample-app/sample-app/authenticationService.py +++ b/examples/trace-analytics-sample-app/sample-app/authenticationService.py @@ -55,7 +55,7 @@ retry_strategy = Retry( total=2, status_forcelist=[401, 401.1, 429, 503], - method_whitelist=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] + allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] ) @app.errorhandler(Error) diff --git a/examples/trace-analytics-sample-app/sample-app/client.py b/examples/trace-analytics-sample-app/sample-app/client.py index de04b18ca0..7779b1c8f8 100755 --- a/examples/trace-analytics-sample-app/sample-app/client.py +++ b/examples/trace-analytics-sample-app/sample-app/client.py @@ -118,7 +118,7 @@ def displayClick(btn1, btn2, btn3, btn4, btn5, old_output): retry_strategy = Retry( total=2, status_forcelist=[401, 401.1, 429, 503], - method_whitelist=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] + allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] ) diff --git a/examples/trace-analytics-sample-app/sample-app/paymentService.py b/examples/trace-analytics-sample-app/sample-app/paymentService.py index 3de60afa8b..f6edd75357 100644 --- a/examples/trace-analytics-sample-app/sample-app/paymentService.py +++ b/examples/trace-analytics-sample-app/sample-app/paymentService.py @@ -55,7 +55,7 @@ retry_strategy = Retry( total=2, status_forcelist=[401, 401.1, 429, 503], - method_whitelist=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] + allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] ) @app.errorhandler(Error) diff --git a/examples/trace-analytics-sample-app/sample-app/recommendationService.py b/examples/trace-analytics-sample-app/sample-app/recommendationService.py index 0140fbe906..be9046aef5 100644 --- a/examples/trace-analytics-sample-app/sample-app/recommendationService.py +++ b/examples/trace-analytics-sample-app/sample-app/recommendationService.py @@ -55,7 +55,7 @@ retry_strategy = Retry( total=2, status_forcelist=[401, 401.1, 429, 503], - method_whitelist=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] + allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"] ) @app.errorhandler(Error) diff --git a/examples/trace-analytics-sample-app/sample-app/requirements.txt b/examples/trace-analytics-sample-app/sample-app/requirements.txt index 82aff3f944..aee4956fe9 100644 --- a/examples/trace-analytics-sample-app/sample-app/requirements.txt +++ b/examples/trace-analytics-sample-app/sample-app/requirements.txt @@ -1,8 +1,10 @@ -dash==1.17.0 +dash==2.13.0 mysql-connector==2.2.9 -opentelemetry-exporter-otlp==1.12.0 -opentelemetry-instrumentation-flask==0.33b0 -opentelemetry-instrumentation-mysql==0.33b0 -opentelemetry-instrumentation-requests==0.33b0 -opentelemetry-sdk==1.12.0 -protobuf==3.19.6 +opentelemetry-exporter-otlp==1.20.0 +opentelemetry-instrumentation-flask==0.41b0 +opentelemetry-instrumentation-mysql==0.41b0 +opentelemetry-instrumentation-requests==0.41b0 +opentelemetry-sdk==1.20.0 +protobuf==3.20.3 +urllib3==2.0.4 +werkzeug==2.2.3 \ No newline at end of file diff --git a/examples/trace-analytics-sample-app/sample-app/script.sh b/examples/trace-analytics-sample-app/sample-app/script.sh index 409a2b2592..4b374a8ccd 100644 --- a/examples/trace-analytics-sample-app/sample-app/script.sh +++ b/examples/trace-analytics-sample-app/sample-app/script.sh @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 # -java -javaagent:/app/opentelemetry-javaagent-all.jar -jar /app/spring-boot-application.jar & +java -javaagent:/app/opentelemetry-javaagent.jar -jar /app/spring-boot-application.jar & until [[ $(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:8087) != 000 ]]; do echo "Waiting for analytics-service to be ready"