Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.4] Updates Trace Analytics sample appliction to run again #3353

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/examples-trace-analytics.yml
Original file line number Diff line number Diff line change
@@ -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 .
20 changes: 10 additions & 10 deletions examples/trace-analytics-sample-app/sample-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/trace-analytics-sample-app/sample-app/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion examples/trace-analytics-sample-app/sample-app/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading