From 969fe3bb0165a6f9e4684a0c69abb7d156fef230 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 23 Dec 2024 08:25:56 -0500 Subject: [PATCH 1/4] [email] rename emailservice to email (#1861) --- .env | 6 +++--- .github/workflows/component-build-images.yml | 4 ++-- CHANGELOG.md | 2 ++ docker-compose-tests.yml | 4 ++-- docker-compose.minimal.yml | 18 +++++++++--------- docker-compose.yml | 18 +++++++++--------- docker-gen-proto.sh | 2 +- ide-gen-proto.sh | 2 +- renovate.json5 | 4 ++-- src/checkoutservice/main.go | 6 +++--- src/{emailservice => email}/.dockerignore | 0 src/{emailservice => email}/.ruby-version | 0 src/{emailservice => email}/Dockerfile | 6 +++--- src/{emailservice => email}/Gemfile | 0 src/{emailservice => email}/Gemfile.lock | 0 src/{emailservice => email}/README.md | 2 +- src/{emailservice => email}/email_server.rb | 4 ++-- .../views/confirmation.erb | 0 .../{emailservice => email}/all.yaml | 6 +++--- .../{emailservice => email}/confirmation.yaml | 2 +- test/tracetesting/run.bash | 6 +++--- 21 files changed, 47 insertions(+), 45 deletions(-) rename src/{emailservice => email}/.dockerignore (100%) rename src/{emailservice => email}/.ruby-version (100%) rename src/{emailservice => email}/Dockerfile (79%) rename src/{emailservice => email}/Gemfile (100%) rename src/{emailservice => email}/Gemfile.lock (100%) rename src/{emailservice => email}/README.md (91%) rename src/{emailservice => email}/email_server.rb (93%) rename src/{emailservice => email}/views/confirmation.erb (100%) rename test/tracetesting/{emailservice => email}/all.yaml (54%) rename test/tracetesting/{emailservice => email}/confirmation.yaml (96%) diff --git a/.env b/.env index b011c764dc..a95b84de56 100644 --- a/.env +++ b/.env @@ -69,9 +69,9 @@ CURRENCY_ADDR=currency:${CURRENCY_PORT} CURRENCY_DOCKERFILE=./src/currency/Dockerfile # Email Service -EMAIL_SERVICE_PORT=6060 -EMAIL_SERVICE_ADDR=http://emailservice:${EMAIL_SERVICE_PORT} -EMAIL_SERVICE_DOCKERFILE=./src/emailservice/Dockerfile +EMAIL_PORT=6060 +EMAIL_ADDR=http://email:${EMAIL_PORT} +EMAIL_DOCKERFILE=./src/email/Dockerfile # Fraud Service FRAUD_SERVICE_DOCKERFILE=./src/frauddetectionservice/Dockerfile diff --git a/.github/workflows/component-build-images.yml b/.github/workflows/component-build-images.yml index 1ebd177346..1e159b54fc 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -71,8 +71,8 @@ jobs: tag_suffix: currency context: ./ setup-qemu: true - - file: ./src/emailservice/Dockerfile - tag_suffix: emailservice + - file: ./src/email/Dockerfile + tag_suffix: email context: ./ setup-qemu: true - file: ./src/frauddetectionservice/Dockerfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 886de03eea..9333ed153f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ the release. ([#1857](https://github.com/open-telemetry/opentelemetry-demo/pull/1857)) * [currency] rename currencyservice to currency ([#1858](https://github.com/open-telemetry/opentelemetry-demo/pull/1858)) +* [email] rename emailservice to email + ([#1861](https://github.com/open-telemetry/opentelemetry-demo/pull/1861)) ## 1.12.0 diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 31fd9a80ab..4e50b6aead 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -41,7 +41,7 @@ services: - CART_ADDR - CHECKOUT_SERVICE_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FRONTEND_ADDR - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR @@ -67,7 +67,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started frauddetectionservice: condition: service_started diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 0c0b868462..8fe5d0b3c3 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -100,7 +100,7 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FLAGD_HOST - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR @@ -114,7 +114,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started paymentservice: condition: service_started @@ -155,26 +155,26 @@ services: logging: *logging # Email service - emailservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice + email: + image: ${IMAGE_NAME}:${DEMO_VERSION}-email container_name: email-service build: - context: ./src/emailservice + context: ./src/email cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-email deploy: resources: limits: memory: 100M restart: unless-stopped ports: - - "${EMAIL_SERVICE_PORT}" + - "${EMAIL_PORT}" environment: - APP_ENV=production - - EMAIL_SERVICE_PORT + - EMAIL_PORT - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}/v1/traces - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=emailservice + - OTEL_SERVICE_NAME=email depends_on: otel-collector: condition: service_started diff --git a/docker-compose.yml b/docker-compose.yml index 722afe90dc..bac8491189 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,7 +134,7 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - PAYMENT_SERVICE_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR @@ -148,7 +148,7 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started paymentservice: condition: service_started @@ -193,27 +193,27 @@ services: logging: *logging # Email service - emailservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice + email: + image: ${IMAGE_NAME}:${DEMO_VERSION}-email container_name: email-service build: context: ./ - dockerfile: ${EMAIL_SERVICE_DOCKERFILE} + dockerfile: ${EMAIL_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-email deploy: resources: limits: memory: 100M restart: unless-stopped ports: - - "${EMAIL_SERVICE_PORT}" + - "${EMAIL_PORT}" environment: - APP_ENV=production - - EMAIL_SERVICE_PORT + - EMAIL_PORT - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}/v1/traces - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=emailservice + - OTEL_SERVICE_NAME=email depends_on: otel-collector: condition: service_started diff --git a/docker-gen-proto.sh b/docker-gen-proto.sh index 80fa1f8634..dfd16526e5 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -26,7 +26,7 @@ gen_proto_python() { #gen_proto_dotnet cart gen_proto_go checkoutservice #gen_proto_cpp currency -#gen_proto_ruby emailservice +#gen_proto_ruby email #gen_proto_ts frontend #gen_proto_js paymentservice gen_proto_go productcatalogservice diff --git a/ide-gen-proto.sh b/ide-gen-proto.sh index 14649b8517..76ad0f1980 100755 --- a/ide-gen-proto.sh +++ b/ide-gen-proto.sh @@ -70,7 +70,7 @@ gen_proto_dotnet accounting gen_proto_dotnet cart gen_proto_go checkoutservice # gen_proto_cpp currency -# gen_proto_ruby emailservice +# gen_proto_ruby email gen_proto_ts frontend gen_proto_ts react-native-app gen_proto_js paymentservice diff --git a/renovate.json5 b/renovate.json5 index de6ac5c52a..9524045bde 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -35,8 +35,8 @@ "groupName": "currency", }, { - "matchFileNames": ["src/emailservice/**"], - "groupName": "emailservice", + "matchFileNames": ["src/email/**"], + "groupName": "email", }, { "matchFileNames": ["src/featureflagservice/**"], diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index d4c7bfadc9..5ad3afa8ba 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -187,7 +187,7 @@ func main() { svc.currencySvcClient = pb.NewCurrencyServiceClient(c) defer c.Close() - mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR") + mustMapEnv(&svc.emailSvcAddr, "EMAIL_ADDR") c = mustCreateClient(svc.emailSvcAddr) svc.emailSvcClient = pb.NewEmailServiceClient(c) defer c.Close() @@ -458,7 +458,7 @@ func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, pay } func (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email string, order *pb.OrderResult) error { - emailServicePayload, err := json.Marshal(map[string]interface{}{ + emailPayload, err := json.Marshal(map[string]interface{}{ "email": email, "order": order, }) @@ -466,7 +466,7 @@ func (cs *checkoutService) sendOrderConfirmation(ctx context.Context, email stri return fmt.Errorf("failed to marshal order to JSON: %+v", err) } - resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailServicePayload)) + resp, err := otelhttp.Post(ctx, cs.emailSvcAddr+"/send_order_confirmation", "application/json", bytes.NewBuffer(emailPayload)) if err != nil { return fmt.Errorf("failed POST to email service: %+v", err) } diff --git a/src/emailservice/.dockerignore b/src/email/.dockerignore similarity index 100% rename from src/emailservice/.dockerignore rename to src/email/.dockerignore diff --git a/src/emailservice/.ruby-version b/src/email/.ruby-version similarity index 100% rename from src/emailservice/.ruby-version rename to src/email/.ruby-version diff --git a/src/emailservice/Dockerfile b/src/email/Dockerfile similarity index 79% rename from src/emailservice/Dockerfile rename to src/email/Dockerfile index d6090905e5..45da417d37 100644 --- a/src/emailservice/Dockerfile +++ b/src/email/Dockerfile @@ -8,7 +8,7 @@ FROM base AS builder WORKDIR /tmp -COPY ./src/emailservice/Gemfile ./src/emailservice/Gemfile.lock ./ +COPY ./src/email/Gemfile ./src/email/Gemfile.lock ./ #RUN apk update && apk add make gcc musl-dev gcompat && bundle install RUN apt-get update && apt-get install build-essential -y && bundle install @@ -16,12 +16,12 @@ FROM base AS release WORKDIR /email_server -COPY ./src/emailservice/ . +COPY ./src/email/ . RUN chmod 666 ./Gemfile.lock COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ -EXPOSE ${EMAIL_SERVICE_PORT} +EXPOSE ${EMAIL_PORT} ENTRYPOINT ["bundle", "exec", "ruby", "email_server.rb"] diff --git a/src/emailservice/Gemfile b/src/email/Gemfile similarity index 100% rename from src/emailservice/Gemfile rename to src/email/Gemfile diff --git a/src/emailservice/Gemfile.lock b/src/email/Gemfile.lock similarity index 100% rename from src/emailservice/Gemfile.lock rename to src/email/Gemfile.lock diff --git a/src/emailservice/README.md b/src/email/README.md similarity index 91% rename from src/emailservice/README.md rename to src/email/README.md index e46b89404a..13533d83ee 100644 --- a/src/emailservice/README.md +++ b/src/email/README.md @@ -20,4 +20,4 @@ You may run this service locally with `bundle exec ruby email_server.rb`. ## Docker Build -From `src/emailservice`, run `docker build .` +From `src/email`, run `docker build .` diff --git a/src/emailservice/email_server.rb b/src/email/email_server.rb similarity index 93% rename from src/emailservice/email_server.rb rename to src/email/email_server.rb index ae0291d466..fcd494a07d 100644 --- a/src/emailservice/email_server.rb +++ b/src/email/email_server.rb @@ -9,7 +9,7 @@ require "opentelemetry/exporter/otlp" require "opentelemetry/instrumentation/sinatra" -set :port, ENV["EMAIL_SERVICE_PORT"] +set :port, ENV["EMAIL_PORT"] OpenTelemetry::SDK.configure do |c| c.use "OpenTelemetry::Instrumentation::Sinatra" @@ -34,7 +34,7 @@ def send_email(data) # create and start a manual span - tracer = OpenTelemetry.tracer_provider.tracer('emailservice') + tracer = OpenTelemetry.tracer_provider.tracer('email') tracer.in_span("send_email") do |span| Pony.mail( to: data.email, diff --git a/src/emailservice/views/confirmation.erb b/src/email/views/confirmation.erb similarity index 100% rename from src/emailservice/views/confirmation.erb rename to src/email/views/confirmation.erb diff --git a/test/tracetesting/emailservice/all.yaml b/test/tracetesting/email/all.yaml similarity index 54% rename from test/tracetesting/emailservice/all.yaml rename to test/tracetesting/email/all.yaml index 0a2f79aaad..517ca65e69 100644 --- a/test/tracetesting/emailservice/all.yaml +++ b/test/tracetesting/email/all.yaml @@ -3,8 +3,8 @@ type: TestSuite spec: - id: email-service-all - name: 'Email Service' - description: Run all Email Service tests enabled in sequence + id: email-all + name: 'Email' + description: Run all Email tests enabled in sequence steps: - ./confirmation.yaml diff --git a/test/tracetesting/emailservice/confirmation.yaml b/test/tracetesting/email/confirmation.yaml similarity index 96% rename from test/tracetesting/emailservice/confirmation.yaml rename to test/tracetesting/email/confirmation.yaml index 6aff590e31..96c561efbc 100644 --- a/test/tracetesting/emailservice/confirmation.yaml +++ b/test/tracetesting/email/confirmation.yaml @@ -9,7 +9,7 @@ spec: trigger: type: http httpRequest: - url: ${var:EMAIL_SERVICE_ADDR}/send_order_confirmation + url: ${var:EMAIL_ADDR}/send_order_confirmation method: POST headers: - key: Content-Type diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index 865de274e0..aba367b86f 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -8,7 +8,7 @@ set -e # Availalble services to test -ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "emailservice" "paymentservice" "productcatalogservice" "recommendationservice" "shipping") +ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "paymentservice" "productcatalogservice" "recommendationservice" "shipping") ## Script variables # Will contain the list of services to test @@ -42,8 +42,8 @@ spec: value: $CHECKOUT_SERVICE_ADDR - key: CURRENCY_ADDR value: $CURRENCY_ADDR - - key: EMAIL_SERVICE_ADDR - value: $EMAIL_SERVICE_ADDR + - key: EMAIL_ADDR + value: $EMAIL_ADDR - key: FRONTEND_ADDR value: $FRONTEND_ADDR - key: PAYMENT_SERVICE_ADDR From 3868f0e4c212fbe3f215de020e79322f4d7b6867 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 23 Dec 2024 09:15:54 -0500 Subject: [PATCH 2/4] [fraud-detection] rename frauddetectionservice to fraud-detection (#1862) * rename frauddetectionservice to fraud-detection * rename frauddetectionservice to fraud-detection --------- Co-authored-by: Juliano Costa --- .env | 2 +- .github/workflows/component-build-images.yml | 4 ++-- .gitignore | 2 +- CHANGELOG.md | 2 ++ docker-compose-tests.yml | 2 +- docker-compose.yml | 12 ++++++------ renovate.json5 | 4 ++-- .../.dockerignore | 0 .../Dockerfile | 6 +++--- .../README.md | 2 +- .../build.gradle.kts | 4 ++-- .../gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 .../gradlew | 0 .../gradlew.bat | 0 src/fraud-detection/settings.gradle.kts | 3 +++ .../src/main/kotlin/frauddetection}/main.kt | 4 ++-- .../src/main/resources/log4j2.xml | 0 src/frauddetectionservice/settings.gradle.kts | 3 --- 20 files changed, 26 insertions(+), 24 deletions(-) rename src/{frauddetectionservice => fraud-detection}/.dockerignore (100%) rename src/{frauddetectionservice => fraud-detection}/Dockerfile (77%) rename src/{frauddetectionservice => fraud-detection}/README.md (85%) rename src/{frauddetectionservice => fraud-detection}/build.gradle.kts (95%) rename src/{frauddetectionservice => fraud-detection}/gradle.properties (100%) rename src/{frauddetectionservice => fraud-detection}/gradle/wrapper/gradle-wrapper.jar (100%) rename src/{frauddetectionservice => fraud-detection}/gradle/wrapper/gradle-wrapper.properties (100%) rename src/{frauddetectionservice => fraud-detection}/gradlew (100%) rename src/{frauddetectionservice => fraud-detection}/gradlew.bat (100%) create mode 100644 src/fraud-detection/settings.gradle.kts rename src/{frauddetectionservice/src/main/kotlin/frauddetectionservice => fraud-detection/src/main/kotlin/frauddetection}/main.kt (97%) rename src/{frauddetectionservice => fraud-detection}/src/main/resources/log4j2.xml (100%) delete mode 100644 src/frauddetectionservice/settings.gradle.kts diff --git a/.env b/.env index a95b84de56..b43ba66093 100644 --- a/.env +++ b/.env @@ -74,7 +74,7 @@ EMAIL_ADDR=http://email:${EMAIL_PORT} EMAIL_DOCKERFILE=./src/email/Dockerfile # Fraud Service -FRAUD_SERVICE_DOCKERFILE=./src/frauddetectionservice/Dockerfile +FRAUD_DOCKERFILE=./src/fraud-detection/Dockerfile # Frontend FRONTEND_PORT=8080 diff --git a/.github/workflows/component-build-images.yml b/.github/workflows/component-build-images.yml index 1e159b54fc..76b006908b 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -75,8 +75,8 @@ jobs: tag_suffix: email context: ./ setup-qemu: true - - file: ./src/frauddetectionservice/Dockerfile - tag_suffix: frauddetectionservice + - file: ./src/fraud-detection/Dockerfile + tag_suffix: fraud-detection context: ./ setup-qemu: true - file: ./src/frontend/Dockerfile diff --git a/.gitignore b/.gitignore index 0e791dd5dd..a7c2a831f9 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,7 @@ test/tracetesting/tracetesting-vars.yaml /src/featureflagservice/src/ffs_demo_pb.erl /src/featureflagservice/src/ffs_service_*.erl /src/featureflagservice/src/oteldemo_*.erl -/src/frauddetectionservice/src/main/proto +/src/fraud-detection/src/main/proto /src/frontend/pb/ /src/frontend/protos/ /src/paymentservice/demo.proto diff --git a/CHANGELOG.md b/CHANGELOG.md index 9333ed153f..627c3de848 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ the release. ([#1858](https://github.com/open-telemetry/opentelemetry-demo/pull/1858)) * [email] rename emailservice to email ([#1861](https://github.com/open-telemetry/opentelemetry-demo/pull/1861)) +* [fraud-detection] rename frauddetectionservice to fraud-detection + ([#1862](https://github.com/open-telemetry/opentelemetry-demo/pull/1862)) ## 1.12.0 diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 4e50b6aead..c2a8810adb 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -69,7 +69,7 @@ services: condition: service_started email: condition: service_started - frauddetectionservice: + fraud-detection: condition: service_started frontend: condition: service_started diff --git a/docker-compose.yml b/docker-compose.yml index bac8491189..9d392cc4a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -220,14 +220,14 @@ services: logging: *logging # Fraud Detection service - frauddetectionservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-frauddetectionservice - container_name: frauddetection-service + fraud-detection: + image: ${IMAGE_NAME}:${DEMO_VERSION}-fraud-detection + container_name: fraud-detection build: context: ./ - dockerfile: ${FRAUD_SERVICE_DOCKERFILE} + dockerfile: ${FRAUD_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-frauddetectionservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-fraud-detection args: OTEL_JAVA_AGENT_VERSION: ${OTEL_JAVA_AGENT_VERSION} deploy: @@ -244,7 +244,7 @@ services: - OTEL_INSTRUMENTATION_KAFKA_EXPERIMENTAL_SPAN_ATTRIBUTES=true - OTEL_INSTRUMENTATION_MESSAGING_EXPERIMENTAL_RECEIVE_TELEMETRY_ENABLED=true - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=frauddetectionservice + - OTEL_SERVICE_NAME=fraud-detection depends_on: otel-collector: condition: service_started diff --git a/renovate.json5 b/renovate.json5 index 9524045bde..38203138f1 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -43,8 +43,8 @@ "groupName": "featureflagservice", }, { - "matchFileNames": ["src/frauddetectionservice/**"], - "groupName": "frauddetectionservice", + "matchFileNames": ["src/fraud-detection/**"], + "groupName": "fraud-detection", }, { "matchFileNames": ["src/frontend/**"], diff --git a/src/frauddetectionservice/.dockerignore b/src/fraud-detection/.dockerignore similarity index 100% rename from src/frauddetectionservice/.dockerignore rename to src/fraud-detection/.dockerignore diff --git a/src/frauddetectionservice/Dockerfile b/src/fraud-detection/Dockerfile similarity index 77% rename from src/frauddetectionservice/Dockerfile rename to src/fraud-detection/Dockerfile index 1d2a9b58da..abf2029459 100644 --- a/src/frauddetectionservice/Dockerfile +++ b/src/fraud-detection/Dockerfile @@ -6,7 +6,7 @@ FROM --platform=${BUILDPLATFORM} gradle:8-jdk17 AS builder WORKDIR /usr/src/app/ -COPY ./src/frauddetectionservice/ ./ +COPY ./src/fraud-detection/ ./ COPY ./pb/ ./src/main/proto/ RUN gradle shadowJar @@ -17,8 +17,8 @@ FROM gcr.io/distroless/java17-debian11 ARG OTEL_JAVA_AGENT_VERSION WORKDIR /usr/src/app/ -COPY --from=builder /usr/src/app/build/libs/frauddetectionservice-1.0-all.jar ./ +COPY --from=builder /usr/src/app/build/libs/fraud-detection-1.0-all.jar ./ ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar ENV JAVA_TOOL_OPTIONS=-javaagent:/app/opentelemetry-javaagent.jar -ENTRYPOINT [ "java", "-jar", "frauddetectionservice-1.0-all.jar" ] +ENTRYPOINT [ "java", "-jar", "fraud-detection-1.0-all.jar" ] diff --git a/src/frauddetectionservice/README.md b/src/fraud-detection/README.md similarity index 85% rename from src/frauddetectionservice/README.md rename to src/fraud-detection/README.md index d618203669..c844776c2e 100644 --- a/src/frauddetectionservice/README.md +++ b/src/fraud-detection/README.md @@ -17,5 +17,5 @@ cp -r ../../pb/ src/main/proto/ To build using Docker run from the repo root: ```sh -docker build -f ./src/frauddetectionservice/Dockerfile . +docker build -f ./src/fraud-detection/Dockerfile . ``` diff --git a/src/frauddetectionservice/build.gradle.kts b/src/fraud-detection/build.gradle.kts similarity index 95% rename from src/frauddetectionservice/build.gradle.kts rename to src/fraud-detection/build.gradle.kts index a9495fbd7c..d1dcc07a6b 100644 --- a/src/frauddetectionservice/build.gradle.kts +++ b/src/fraud-detection/build.gradle.kts @@ -90,9 +90,9 @@ protobuf { } application { - mainClass.set("frauddetectionservice.MainKt") + mainClass.set("frauddetection.MainKt") } tasks.jar { - manifest.attributes["Main-Class"] = "frauddetectionservice.MainKt" + manifest.attributes["Main-Class"] = "frauddetection.MainKt" } diff --git a/src/frauddetectionservice/gradle.properties b/src/fraud-detection/gradle.properties similarity index 100% rename from src/frauddetectionservice/gradle.properties rename to src/fraud-detection/gradle.properties diff --git a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar b/src/fraud-detection/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from src/frauddetectionservice/gradle/wrapper/gradle-wrapper.jar rename to src/fraud-detection/gradle/wrapper/gradle-wrapper.jar diff --git a/src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties b/src/fraud-detection/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from src/frauddetectionservice/gradle/wrapper/gradle-wrapper.properties rename to src/fraud-detection/gradle/wrapper/gradle-wrapper.properties diff --git a/src/frauddetectionservice/gradlew b/src/fraud-detection/gradlew similarity index 100% rename from src/frauddetectionservice/gradlew rename to src/fraud-detection/gradlew diff --git a/src/frauddetectionservice/gradlew.bat b/src/fraud-detection/gradlew.bat similarity index 100% rename from src/frauddetectionservice/gradlew.bat rename to src/fraud-detection/gradlew.bat diff --git a/src/fraud-detection/settings.gradle.kts b/src/fraud-detection/settings.gradle.kts new file mode 100644 index 0000000000..d9c4193dd3 --- /dev/null +++ b/src/fraud-detection/settings.gradle.kts @@ -0,0 +1,3 @@ + +rootProject.name = "fraud-detection" + diff --git a/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt b/src/fraud-detection/src/main/kotlin/frauddetection/main.kt similarity index 97% rename from src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt rename to src/fraud-detection/src/main/kotlin/frauddetection/main.kt index 8f8223f518..ac36b66d44 100644 --- a/src/frauddetectionservice/src/main/kotlin/frauddetectionservice/main.kt +++ b/src/fraud-detection/src/main/kotlin/frauddetection/main.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package frauddetectionservice +package frauddetection import org.apache.kafka.clients.consumer.ConsumerConfig.* import org.apache.kafka.clients.consumer.KafkaConsumer @@ -24,7 +24,7 @@ import dev.openfeature.sdk.Value import dev.openfeature.sdk.OpenFeatureAPI const val topic = "orders" -const val groupID = "frauddetectionservice" +const val groupID = "fraud-detection" private val logger: Logger = LogManager.getLogger(groupID) diff --git a/src/frauddetectionservice/src/main/resources/log4j2.xml b/src/fraud-detection/src/main/resources/log4j2.xml similarity index 100% rename from src/frauddetectionservice/src/main/resources/log4j2.xml rename to src/fraud-detection/src/main/resources/log4j2.xml diff --git a/src/frauddetectionservice/settings.gradle.kts b/src/frauddetectionservice/settings.gradle.kts deleted file mode 100644 index 1c98d2e2cf..0000000000 --- a/src/frauddetectionservice/settings.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ - -rootProject.name = "frauddetectionservice" - From 4c8e43f219ae8d2c302fb9d6c78164017c3314bc Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 23 Dec 2024 13:01:46 -0500 Subject: [PATCH 3/4] [payment] rename paymentservice to payment (#1863) * rename paymentservice to payment * rename paymentservice to payment * rename paymentservice to payment --------- Co-authored-by: Juliano Costa --- .env | 6 +++--- .github/workflows/component-build-images.yml | 4 ++-- .gitignore | 2 +- CHANGELOG.md | 2 ++ docker-compose-tests.yml | 4 ++-- docker-compose.minimal.yml | 18 +++++++++--------- docker-compose.yml | 18 +++++++++--------- docker-gen-proto.sh | 2 +- ide-gen-proto.sh | 2 +- renovate.json5 | 4 ++-- src/checkoutservice/main.go | 4 ++-- src/flagd/demo.flagd.json | 4 ++-- src/{paymentservice => payment}/.dockerignore | 0 src/{paymentservice => payment}/Dockerfile | 6 +++--- src/{paymentservice => payment}/README.md | 2 +- src/{paymentservice => payment}/charge.js | 6 +++--- src/{paymentservice => payment}/index.js | 4 ++-- src/{paymentservice => payment}/logger.js | 0 .../opentelemetry.js | 0 .../package-lock.json | 4 ++-- src/{paymentservice => payment}/package.json | 2 +- .../{paymentservice => payment}/all.yaml | 6 +++--- .../amex-credit-card-not-allowed.yaml | 2 +- .../expired-credit-card.yaml | 2 +- .../invalid-credit-card.yaml | 2 +- .../valid-credit-card.yaml | 2 +- test/tracetesting/run.bash | 6 +++--- 27 files changed, 58 insertions(+), 56 deletions(-) rename src/{paymentservice => payment}/.dockerignore (100%) rename src/{paymentservice => payment}/Dockerfile (82%) rename src/{paymentservice => payment}/README.md (87%) rename src/{paymentservice => payment}/charge.js (95%) rename src/{paymentservice => payment}/index.js (88%) rename src/{paymentservice => payment}/logger.js (100%) rename src/{paymentservice => payment}/opentelemetry.js (100%) rename src/{paymentservice => payment}/package-lock.json (99%) rename src/{paymentservice => payment}/package.json (97%) rename test/tracetesting/{paymentservice => payment}/all.yaml (67%) rename test/tracetesting/{paymentservice => payment}/amex-credit-card-not-allowed.yaml (96%) rename test/tracetesting/{paymentservice => payment}/expired-credit-card.yaml (96%) rename test/tracetesting/{paymentservice => payment}/invalid-credit-card.yaml (96%) rename test/tracetesting/{paymentservice => payment}/valid-credit-card.yaml (96%) diff --git a/.env b/.env index b43ba66093..bca65c3578 100644 --- a/.env +++ b/.env @@ -102,9 +102,9 @@ LOCUST_HEADLESS=false LOAD_GENERATOR_DOCKERFILE=./src/load-generator/Dockerfile # Payment Service -PAYMENT_SERVICE_PORT=50051 -PAYMENT_SERVICE_ADDR=paymentservice:${PAYMENT_SERVICE_PORT} -PAYMENT_SERVICE_DOCKERFILE=./src/paymentservice/Dockerfile +PAYMENT_PORT=50051 +PAYMENT_ADDR=payment:${PAYMENT_PORT} +PAYMENT_DOCKERFILE=./src/payment/Dockerfile # Product Catalog Service PRODUCT_CATALOG_SERVICE_PORT=3550 diff --git a/.github/workflows/component-build-images.yml b/.github/workflows/component-build-images.yml index 76b006908b..599328f320 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -103,8 +103,8 @@ jobs: tag_suffix: load-generator context: ./ setup-qemu: true - - file: ./src/paymentservice/Dockerfile - tag_suffix: paymentservice + - file: ./src/payment/Dockerfile + tag_suffix: payment context: ./ setup-qemu: true - file: ./src/productcatalogservice/Dockerfile diff --git a/.gitignore b/.gitignore index a7c2a831f9..401292e0ef 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,7 @@ test/tracetesting/tracetesting-vars.yaml /src/fraud-detection/src/main/proto /src/frontend/pb/ /src/frontend/protos/ -/src/paymentservice/demo.proto +/src/payment/demo.proto /src/shipping/proto/ /src/currency/proto diff --git a/CHANGELOG.md b/CHANGELOG.md index 627c3de848..9cea672f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,8 @@ the release. ([#1861](https://github.com/open-telemetry/opentelemetry-demo/pull/1861)) * [fraud-detection] rename frauddetectionservice to fraud-detection ([#1862](https://github.com/open-telemetry/opentelemetry-demo/pull/1862)) +* [payment] rename paymentservice to payment + ([#1863](https://github.com/open-telemetry/opentelemetry-demo/pull/1863)) ## 1.12.0 diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index c2a8810adb..363bc2e37a 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -43,7 +43,7 @@ services: - CURRENCY_ADDR - EMAIL_ADDR - FRONTEND_ADDR - - PAYMENT_SERVICE_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - RECOMMENDATION_SERVICE_ADDR - SHIPPING_ADDR @@ -73,7 +73,7 @@ services: condition: service_started frontend: condition: service_started - paymentservice: + payment: condition: service_started productcatalogservice: condition: service_started diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 8fe5d0b3c3..8fe30aa9ab 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -102,7 +102,7 @@ services: - CURRENCY_ADDR - EMAIL_ADDR - FLAGD_HOST - - PAYMENT_SERVICE_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT @@ -116,7 +116,7 @@ services: condition: service_started email: condition: service_started - paymentservice: + payment: condition: service_started productcatalogservice: condition: service_started @@ -351,28 +351,28 @@ services: logging: *logging # Payment service - paymentservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-paymentservice + payment: + image: ${IMAGE_NAME}:${DEMO_VERSION}-payment container_name: payment-service build: context: ./ - dockerfile: ${PAYMENT_SERVICE_DOCKERFILE} + dockerfile: ${PAYMENT_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-payment deploy: resources: limits: memory: 120M restart: unless-stopped ports: - - "${PAYMENT_SERVICE_PORT}" + - "${PAYMENT_PORT}" environment: - FLAGD_HOST - - PAYMENT_SERVICE_PORT + - PAYMENT_PORT - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=paymentservice + - OTEL_SERVICE_NAME=payment depends_on: otel-collector: condition: service_started diff --git a/docker-compose.yml b/docker-compose.yml index 9d392cc4a8..0d2d80aeeb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -135,7 +135,7 @@ services: - CART_ADDR - CURRENCY_ADDR - EMAIL_ADDR - - PAYMENT_SERVICE_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR - KAFKA_SERVICE_ADDR @@ -150,7 +150,7 @@ services: condition: service_started email: condition: service_started - paymentservice: + payment: condition: service_started productcatalogservice: condition: service_started @@ -427,29 +427,29 @@ services: logging: *logging # Payment service - paymentservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-paymentservice + payment: + image: ${IMAGE_NAME}:${DEMO_VERSION}-payment container_name: payment-service build: context: ./ - dockerfile: ${PAYMENT_SERVICE_DOCKERFILE} + dockerfile: ${PAYMENT_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-payment deploy: resources: limits: memory: 120M restart: unless-stopped ports: - - "${PAYMENT_SERVICE_PORT}" + - "${PAYMENT_PORT}" environment: - - PAYMENT_SERVICE_PORT + - PAYMENT_PORT - FLAGD_HOST - FLAGD_PORT - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=paymentservice + - OTEL_SERVICE_NAME=payment depends_on: otel-collector: condition: service_started diff --git a/docker-gen-proto.sh b/docker-gen-proto.sh index dfd16526e5..cb18f893e8 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -28,7 +28,7 @@ gen_proto_go checkoutservice #gen_proto_cpp currency #gen_proto_ruby email #gen_proto_ts frontend -#gen_proto_js paymentservice +#gen_proto_js payment gen_proto_go productcatalogservice #gen_proto_php quote gen_proto_python recommendationservice diff --git a/ide-gen-proto.sh b/ide-gen-proto.sh index 76ad0f1980..6c7f23ea72 100755 --- a/ide-gen-proto.sh +++ b/ide-gen-proto.sh @@ -73,7 +73,7 @@ gen_proto_go checkoutservice # gen_proto_ruby email gen_proto_ts frontend gen_proto_ts react-native-app -gen_proto_js paymentservice +gen_proto_js payment gen_proto_go productcatalogservice # gen_proto_php quote gen_proto_python recommendationservice diff --git a/renovate.json5 b/renovate.json5 index 38203138f1..231e8c68c5 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -71,8 +71,8 @@ "groupName": "otel-collector", }, { - "matchFileNames": ["src/paymentservice/**"], - "groupName": "paymentservice", + "matchFileNames": ["src/payment/**"], + "groupName": "payment", }, { "matchFileNames": ["src/productcatalogservice/**"], diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 5ad3afa8ba..3f9c169199 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -192,7 +192,7 @@ func main() { svc.emailSvcClient = pb.NewEmailServiceClient(c) defer c.Close() - mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR") + mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_ADDR") c = mustCreateClient(svc.paymentSvcAddr) svc.paymentSvcClient = pb.NewPaymentServiceClient(c) defer c.Close() @@ -442,7 +442,7 @@ func (cs *checkoutService) convertCurrency(ctx context.Context, from *pb.Money, func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, paymentInfo *pb.CreditCardInfo) (string, error) { paymentService := cs.paymentSvcClient - if cs.isFeatureFlagEnabled(ctx, "paymentServiceUnreachable") { + if cs.isFeatureFlagEnabled(ctx, "paymentUnreachable") { badAddress := "badAddress:50051" c := mustCreateClient(badAddress) paymentService = pb.NewPaymentServiceClient(c) diff --git a/src/flagd/demo.flagd.json b/src/flagd/demo.flagd.json index 74fb5fcf1d..07439ebf89 100644 --- a/src/flagd/demo.flagd.json +++ b/src/flagd/demo.flagd.json @@ -64,7 +64,7 @@ }, "defaultVariant": "off" }, - "paymentServiceFailure": { + "paymentFailure": { "description": "Fail payment service charge requests n%", "state": "ENABLED", "variants": { @@ -78,7 +78,7 @@ }, "defaultVariant": "off" }, - "paymentServiceUnreachable": { + "paymentUnreachable": { "description": "Payment service is unavailable", "state": "ENABLED", "variants": { diff --git a/src/paymentservice/.dockerignore b/src/payment/.dockerignore similarity index 100% rename from src/paymentservice/.dockerignore rename to src/payment/.dockerignore diff --git a/src/paymentservice/Dockerfile b/src/payment/Dockerfile similarity index 82% rename from src/paymentservice/Dockerfile rename to src/payment/Dockerfile index fb78bc3b17..e1f5e03278 100644 --- a/src/paymentservice/Dockerfile +++ b/src/payment/Dockerfile @@ -6,7 +6,7 @@ FROM node:22-alpine AS build WORKDIR /usr/src/app/ -COPY ./src/paymentservice/package*.json ./ +COPY ./src/payment/package*.json ./ RUN apk add --no-cache python3 make g++ && npm ci --omit=dev @@ -19,8 +19,8 @@ WORKDIR /usr/src/app/ ENV NODE_ENV=production COPY --chown=node:node --from=build /usr/src/app/node_modules/ ./node_modules/ -COPY ./src/paymentservice/ ./ +COPY ./src/payment/ ./ COPY ./pb/demo.proto ./ -EXPOSE ${PAYMENT_SERVICE_PORT} +EXPOSE ${PAYMENT_PORT} ENTRYPOINT [ "npm", "run", "start" ] diff --git a/src/paymentservice/README.md b/src/payment/README.md similarity index 87% rename from src/paymentservice/README.md rename to src/payment/README.md index 1f73c2d954..62194705b4 100644 --- a/src/paymentservice/README.md +++ b/src/payment/README.md @@ -12,5 +12,5 @@ Copy the `demo.proto` file to this directory and run `npm ci` From the root directory, run: ```sh -docker compose build paymentservice +docker compose build payment ``` diff --git a/src/paymentservice/charge.js b/src/payment/charge.js similarity index 95% rename from src/paymentservice/charge.js rename to src/payment/charge.js index 4d02ba24e8..588cc0754e 100644 --- a/src/paymentservice/charge.js +++ b/src/payment/charge.js @@ -9,8 +9,8 @@ const { FlagdProvider } = require('@openfeature/flagd-provider'); const flagProvider = new FlagdProvider(); const logger = require('./logger'); -const tracer = trace.getTracer('paymentservice'); -const meter = metrics.getMeter('paymentservice'); +const tracer = trace.getTracer('payment'); +const meter = metrics.getMeter('payment'); const transactionsCounter = meter.createCounter('app.payment.transactions'); const LOYALTY_LEVEL = ['platinum', 'gold', 'silver', 'bronze']; @@ -26,7 +26,7 @@ module.exports.charge = async request => { await OpenFeature.setProviderAndWait(flagProvider); - const numberVariant = await OpenFeature.getClient().getNumberValue("paymentServiceFailure", 0); + const numberVariant = await OpenFeature.getClient().getNumberValue("paymentFailure", 0); if (numberVariant > 0) { // n% chance to fail with app.loyalty.level=gold diff --git a/src/paymentservice/index.js b/src/payment/index.js similarity index 88% rename from src/paymentservice/index.js rename to src/payment/index.js index c068c31082..362059e2a6 100644 --- a/src/paymentservice/index.js +++ b/src/payment/index.js @@ -45,12 +45,12 @@ server.addService(health.service, new health.Implementation({ server.addService(otelDemoPackage.oteldemo.PaymentService.service, { charge: chargeServiceHandler }) -server.bindAsync(`0.0.0.0:${process.env['PAYMENT_SERVICE_PORT']}`, grpc.ServerCredentials.createInsecure(), (err, port) => { +server.bindAsync(`0.0.0.0:${process.env['PAYMENT_PORT']}`, grpc.ServerCredentials.createInsecure(), (err, port) => { if (err) { return logger.error({ err }) } - logger.info(`PaymentService gRPC server started on port ${port}`) + logger.info(`payment gRPC server started on port ${port}`) }) process.once('SIGINT', closeGracefully) diff --git a/src/paymentservice/logger.js b/src/payment/logger.js similarity index 100% rename from src/paymentservice/logger.js rename to src/payment/logger.js diff --git a/src/paymentservice/opentelemetry.js b/src/payment/opentelemetry.js similarity index 100% rename from src/paymentservice/opentelemetry.js rename to src/payment/opentelemetry.js diff --git a/src/paymentservice/package-lock.json b/src/payment/package-lock.json similarity index 99% rename from src/paymentservice/package-lock.json rename to src/payment/package-lock.json index 881fb4216b..8128bed3ab 100644 --- a/src/paymentservice/package-lock.json +++ b/src/payment/package-lock.json @@ -1,11 +1,11 @@ { - "name": "paymentservice", + "name": "payment", "version": "1.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "paymentservice", + "name": "payment", "version": "1.12.0", "license": "ISC", "dependencies": { diff --git a/src/paymentservice/package.json b/src/payment/package.json similarity index 97% rename from src/paymentservice/package.json rename to src/payment/package.json index 2c0365b0c1..607dcf02c9 100644 --- a/src/paymentservice/package.json +++ b/src/payment/package.json @@ -1,5 +1,5 @@ { - "name": "paymentservice", + "name": "payment", "description": "Payment Service", "repository": "https://github.com/opentelemetry/opentelemetry-demo", "main": "index.js", diff --git a/test/tracetesting/paymentservice/all.yaml b/test/tracetesting/payment/all.yaml similarity index 67% rename from test/tracetesting/paymentservice/all.yaml rename to test/tracetesting/payment/all.yaml index e295034dce..c7d08d8944 100644 --- a/test/tracetesting/paymentservice/all.yaml +++ b/test/tracetesting/payment/all.yaml @@ -3,9 +3,9 @@ type: TestSuite spec: - id: payment-service-all - name: 'Payment Service' - description: Run all Payment Service tests enabled in sequence + id: payment-all + name: 'Payment' + description: Run all Payment tests enabled in sequence steps: - ./valid-credit-card.yaml - ./invalid-credit-card.yaml diff --git a/test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml b/test/tracetesting/payment/amex-credit-card-not-allowed.yaml similarity index 96% rename from test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml rename to test/tracetesting/payment/amex-credit-card-not-allowed.yaml index ab3629df30..6ad88e7885 100644 --- a/test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml +++ b/test/tracetesting/payment/amex-credit-card-not-allowed.yaml @@ -10,7 +10,7 @@ spec: type: grpc grpc: protobufFile: ../../../pb/demo.proto - address: ${var:PAYMENT_SERVICE_ADDR} + address: ${var:PAYMENT_ADDR} method: oteldemo.PaymentService.Charge request: |- { diff --git a/test/tracetesting/paymentservice/expired-credit-card.yaml b/test/tracetesting/payment/expired-credit-card.yaml similarity index 96% rename from test/tracetesting/paymentservice/expired-credit-card.yaml rename to test/tracetesting/payment/expired-credit-card.yaml index 27963f28d7..c2f9d5d020 100644 --- a/test/tracetesting/paymentservice/expired-credit-card.yaml +++ b/test/tracetesting/payment/expired-credit-card.yaml @@ -10,7 +10,7 @@ spec: type: grpc grpc: protobufFile: ../../../pb/demo.proto - address: ${var:PAYMENT_SERVICE_ADDR} + address: ${var:PAYMENT_ADDR} method: oteldemo.PaymentService.Charge request: |- { diff --git a/test/tracetesting/paymentservice/invalid-credit-card.yaml b/test/tracetesting/payment/invalid-credit-card.yaml similarity index 96% rename from test/tracetesting/paymentservice/invalid-credit-card.yaml rename to test/tracetesting/payment/invalid-credit-card.yaml index a6028f66a2..6ab64de72a 100644 --- a/test/tracetesting/paymentservice/invalid-credit-card.yaml +++ b/test/tracetesting/payment/invalid-credit-card.yaml @@ -10,7 +10,7 @@ spec: type: grpc grpc: protobufFile: ../../../pb/demo.proto - address: ${var:PAYMENT_SERVICE_ADDR} + address: ${var:PAYMENT_ADDR} method: oteldemo.PaymentService.Charge request: |- { diff --git a/test/tracetesting/paymentservice/valid-credit-card.yaml b/test/tracetesting/payment/valid-credit-card.yaml similarity index 96% rename from test/tracetesting/paymentservice/valid-credit-card.yaml rename to test/tracetesting/payment/valid-credit-card.yaml index 32c1001332..3bc7a657cd 100644 --- a/test/tracetesting/paymentservice/valid-credit-card.yaml +++ b/test/tracetesting/payment/valid-credit-card.yaml @@ -10,7 +10,7 @@ spec: type: grpc grpc: protobufFile: ../../../pb/demo.proto - address: ${var:PAYMENT_SERVICE_ADDR} + address: ${var:PAYMENT_ADDR} method: oteldemo.PaymentService.Charge request: |- { diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index aba367b86f..ac92e25dd9 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -8,7 +8,7 @@ set -e # Availalble services to test -ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "paymentservice" "productcatalogservice" "recommendationservice" "shipping") +ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "payment" "productcatalogservice" "recommendationservice" "shipping") ## Script variables # Will contain the list of services to test @@ -46,8 +46,8 @@ spec: value: $EMAIL_ADDR - key: FRONTEND_ADDR value: $FRONTEND_ADDR - - key: PAYMENT_SERVICE_ADDR - value: $PAYMENT_SERVICE_ADDR + - key: PAYMENT_ADDR + value: $PAYMENT_ADDR - key: PRODUCT_CATALOG_SERVICE_ADDR value: $PRODUCT_CATALOG_SERVICE_ADDR - key: RECOMMENDATION_SERVICE_ADDR From 2210b5bf48b18a7faf96599234b16027c5284a8a Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 23 Dec 2024 14:10:20 -0500 Subject: [PATCH 4/4] [recommendation] rename recommendationservice to recommendation (#1865) --- .env | 6 +++--- .github/workflows/component-build-images.yml | 4 ++-- .licenserc.json | 4 ++-- CHANGELOG.md | 2 ++ Makefile | 2 +- docker-compose-tests.yml | 4 ++-- docker-compose.minimal.yml | 18 +++++++++--------- docker-compose.yml | 18 +++++++++--------- docker-gen-proto.sh | 2 +- ide-gen-proto.sh | 2 +- renovate.json5 | 4 ++-- src/flagd/demo.flagd.json | 2 +- .../gateways/rpc/Recommendations.gateway.ts | 4 ++-- src/frontend/next.config.js | 4 ++-- .../Dockerfile | 6 +++--- .../README.md | 2 +- .../demo_pb2.py | 0 .../demo_pb2_grpc.py | 0 .../genproto/Dockerfile | 0 .../logger.py | 0 .../metrics.py | 0 .../recommendation_server.py | 6 +++--- .../requirements.txt | 0 .../all.yaml | 0 .../list.yaml | 2 +- test/tracetesting/run.bash | 6 +++--- 26 files changed, 50 insertions(+), 48 deletions(-) rename src/{recommendationservice => recommendation}/Dockerfile (82%) rename src/{recommendationservice => recommendation}/README.md (87%) rename src/{recommendationservice => recommendation}/demo_pb2.py (100%) rename src/{recommendationservice => recommendation}/demo_pb2_grpc.py (100%) rename src/{recommendationservice => recommendation}/genproto/Dockerfile (100%) rename src/{recommendationservice => recommendation}/logger.py (100%) rename src/{recommendationservice => recommendation}/metrics.py (100%) rename src/{recommendationservice => recommendation}/recommendation_server.py (96%) rename src/{recommendationservice => recommendation}/requirements.txt (100%) rename test/tracetesting/{recommendationservice => recommendation}/all.yaml (100%) rename test/tracetesting/{recommendationservice => recommendation}/list.yaml (94%) diff --git a/.env b/.env index bca65c3578..1779f87def 100644 --- a/.env +++ b/.env @@ -117,9 +117,9 @@ QUOTE_ADDR=http://quote:${QUOTE_PORT} QUOTE_DOCKERFILE=./src/quote/Dockerfile # Recommendation Service -RECOMMENDATION_SERVICE_PORT=9001 -RECOMMENDATION_SERVICE_ADDR=recommendationservice:${RECOMMENDATION_SERVICE_PORT} -RECOMMENDATION_SERVICE_DOCKERFILE=./src/recommendationservice/Dockerfile +RECOMMENDATION_PORT=9001 +RECOMMENDATION_ADDR=recommendation:${RECOMMENDATION_PORT} +RECOMMENDATION_DOCKERFILE=./src/recommendation/Dockerfile # Shipping Service SHIPPING_PORT=50050 diff --git a/.github/workflows/component-build-images.yml b/.github/workflows/component-build-images.yml index 599328f320..b1e5df9dc6 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -115,8 +115,8 @@ jobs: tag_suffix: quote context: ./ setup-qemu: true - - file: ./src/recommendationservice/Dockerfile - tag_suffix: recommendationservice + - file: ./src/recommendation/Dockerfile + tag_suffix: recommendation context: ./ setup-qemu: true - file: ./src/shipping/Dockerfile diff --git a/.licenserc.json b/.licenserc.json index 6c3d85a679..350f284092 100644 --- a/.licenserc.json +++ b/.licenserc.json @@ -51,8 +51,8 @@ "src/react-native-app/android/.gradle/", "src/react-native-app/.expo/", "src/react-native-app/expo-env.d.ts", - "src/recommendationservice/demo_pb2.py", - "src/recommendationservice/demo_pb2_grpc.py", + "src/recommendation/demo_pb2.py", + "src/recommendation/demo_pb2_grpc.py", "internal/tools/" ] } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cea672f7c..2861f1bcc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,8 @@ the release. ([#1862](https://github.com/open-telemetry/opentelemetry-demo/pull/1862)) * [payment] rename paymentservice to payment ([#1863](https://github.com/open-telemetry/opentelemetry-demo/pull/1863)) +* [recommendation] rename recommendationservice to recommendation + ([#1865](https://github.com/open-telemetry/opentelemetry-demo/pull/1865)) ## 1.12.0 diff --git a/Makefile b/Makefile index 7f6e6640b7..7bb2f27153 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ docker-generate-protobuf: .PHONY: clean clean: rm -rf ./src/{checkoutservice,productcatalogservice}/genproto/oteldemo/ - rm -rf ./src/recommendationservice/{demo_pb2,demo_pb2_grpc}.py + rm -rf ./src/recommendation/{demo_pb2,demo_pb2_grpc}.py .PHONY: check-clean-work-tree check-clean-work-tree: diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 363bc2e37a..dc2714c84a 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -45,7 +45,7 @@ services: - FRONTEND_ADDR - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - - RECOMMENDATION_SERVICE_ADDR + - RECOMMENDATION_ADDR - SHIPPING_ADDR - KAFKA_SERVICE_ADDR extra_hosts: @@ -79,7 +79,7 @@ services: condition: service_started quote: condition: service_started - recommendationservice: + recommendation: condition: service_started shipping: condition: service_started diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 8fe30aa9ab..2066c6b2ac 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -204,7 +204,7 @@ services: - CHECKOUT_SERVICE_ADDR - CURRENCY_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - - RECOMMENDATION_SERVICE_ADDR + - RECOMMENDATION_ADDR - SHIPPING_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES} @@ -229,7 +229,7 @@ services: condition: service_started quote: condition: service_started - recommendationservice: + recommendation: condition: service_started shipping: condition: service_started @@ -435,30 +435,30 @@ services: logging: *logging # Recommendation service - recommendationservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-recommendationservice + recommendation: + image: ${IMAGE_NAME}:${DEMO_VERSION}-recommendation container_name: recommendation-service build: context: ./ - dockerfile: ${RECOMMENDATION_SERVICE_DOCKERFILE} + dockerfile: ${RECOMMENDATION_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-recommendation deploy: resources: limits: memory: 50M restart: unless-stopped ports: - - "${RECOMMENDATION_SERVICE_PORT}" + - "${RECOMMENDATION_PORT}" environment: - FLAGD_HOST - - RECOMMENDATION_SERVICE_PORT + - RECOMMENDATION_PORT - PRODUCT_CATALOG_SERVICE_ADDR - OTEL_PYTHON_LOG_CORRELATION=true - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=recommendationservice + - OTEL_SERVICE_NAME=recommendation - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python depends_on: productcatalogservice: diff --git a/docker-compose.yml b/docker-compose.yml index 0d2d80aeeb..22ee8e86ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -276,7 +276,7 @@ services: - CHECKOUT_SERVICE_ADDR - CURRENCY_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - - RECOMMENDATION_SERVICE_ADDR + - RECOMMENDATION_ADDR - SHIPPING_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES} @@ -301,7 +301,7 @@ services: condition: service_started quote: condition: service_started - recommendationservice: + recommendation: condition: service_started shipping: condition: service_started @@ -517,23 +517,23 @@ services: logging: *logging # Recommendation service - recommendationservice: - image: ${IMAGE_NAME}:${DEMO_VERSION}-recommendationservice + recommendation: + image: ${IMAGE_NAME}:${DEMO_VERSION}-recommendation container_name: recommendation-service build: context: ./ - dockerfile: ${RECOMMENDATION_SERVICE_DOCKERFILE} + dockerfile: ${RECOMMENDATION_DOCKERFILE} cache_from: - - ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice + - ${IMAGE_NAME}:${IMAGE_VERSION}-recommendation deploy: resources: limits: memory: 500M # This is high to enable supporting the recommendationCache feature flag use case restart: unless-stopped ports: - - "${RECOMMENDATION_SERVICE_PORT}" + - "${RECOMMENDATION_PORT}" environment: - - RECOMMENDATION_SERVICE_PORT + - RECOMMENDATION_PORT - PRODUCT_CATALOG_SERVICE_ADDR - FLAGD_HOST - FLAGD_PORT @@ -541,7 +541,7 @@ services: - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - - OTEL_SERVICE_NAME=recommendationservice + - OTEL_SERVICE_NAME=recommendation - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python depends_on: productcatalogservice: diff --git a/docker-gen-proto.sh b/docker-gen-proto.sh index cb18f893e8..f29fdcfcdb 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -31,5 +31,5 @@ gen_proto_go checkoutservice #gen_proto_js payment gen_proto_go productcatalogservice #gen_proto_php quote -gen_proto_python recommendationservice +gen_proto_python recommendation #gen_proto_rust shipping diff --git a/ide-gen-proto.sh b/ide-gen-proto.sh index 6c7f23ea72..aabbdf5f38 100755 --- a/ide-gen-proto.sh +++ b/ide-gen-proto.sh @@ -76,5 +76,5 @@ gen_proto_ts react-native-app gen_proto_js payment gen_proto_go productcatalogservice # gen_proto_php quote -gen_proto_python recommendationservice +gen_proto_python recommendation gen_proto_rust shipping diff --git a/renovate.json5 b/renovate.json5 index 231e8c68c5..7155995f2a 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -87,8 +87,8 @@ "groupName": "quote", }, { - "matchFileNames": ["src/recommendationservice/**"], - "groupName": "recommendationservice", + "matchFileNames": ["src/recommendation/**"], + "groupName": "recommendation", }, { "matchFileNames": ["src/shipping/**"], diff --git a/src/flagd/demo.flagd.json b/src/flagd/demo.flagd.json index 07439ebf89..4425e72415 100644 --- a/src/flagd/demo.flagd.json +++ b/src/flagd/demo.flagd.json @@ -10,7 +10,7 @@ }, "defaultVariant": "off" }, - "recommendationServiceCacheFailure": { + "recommendationCacheFailure": { "description": "Fail recommendation service cache", "state": "ENABLED", "variants": { diff --git a/src/frontend/gateways/rpc/Recommendations.gateway.ts b/src/frontend/gateways/rpc/Recommendations.gateway.ts index 62fcd6dd5c..c58a47032b 100644 --- a/src/frontend/gateways/rpc/Recommendations.gateway.ts +++ b/src/frontend/gateways/rpc/Recommendations.gateway.ts @@ -4,9 +4,9 @@ import { ChannelCredentials } from '@grpc/grpc-js'; import { ListRecommendationsResponse, RecommendationServiceClient } from '../../protos/demo'; -const { RECOMMENDATION_SERVICE_ADDR = '' } = process.env; +const { RECOMMENDATION_ADDR = '' } = process.env; -const client = new RecommendationServiceClient(RECOMMENDATION_SERVICE_ADDR, ChannelCredentials.createInsecure()); +const client = new RecommendationServiceClient(RECOMMENDATION_ADDR, ChannelCredentials.createInsecure()); const RecommendationsGateway = () => ({ listRecommendations(userId: string, productIds: string[]) { diff --git a/src/frontend/next.config.js b/src/frontend/next.config.js index eac4615be9..98e3e53f48 100755 --- a/src/frontend/next.config.js +++ b/src/frontend/next.config.js @@ -18,7 +18,7 @@ const { CHECKOUT_SERVICE_ADDR = '', CURRENCY_ADDR = '', PRODUCT_CATALOG_SERVICE_ADDR = '', - RECOMMENDATION_SERVICE_ADDR = '', + RECOMMENDATION_ADDR = '', SHIPPING_ADDR = '', ENV_PLATFORM = '', OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = '', @@ -50,7 +50,7 @@ const nextConfig = { CHECKOUT_SERVICE_ADDR, CURRENCY_ADDR, PRODUCT_CATALOG_SERVICE_ADDR, - RECOMMENDATION_SERVICE_ADDR, + RECOMMENDATION_ADDR, SHIPPING_ADDR, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, NEXT_PUBLIC_PLATFORM: ENV_PLATFORM, diff --git a/src/recommendationservice/Dockerfile b/src/recommendation/Dockerfile similarity index 82% rename from src/recommendationservice/Dockerfile rename to src/recommendation/Dockerfile index 5a4ee45fc0..8e1d8168f5 100644 --- a/src/recommendationservice/Dockerfile +++ b/src/recommendation/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get -qq update \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app/ -COPY ./src/recommendationservice/requirements.txt ./ +COPY ./src/recommendation/requirements.txt ./ RUN pip install --upgrade pip RUN pip install --prefix="/reqs" -r requirements.txt @@ -24,9 +24,9 @@ RUN pip install --prefix="/reqs" -r requirements.txt FROM base AS runtime WORKDIR /usr/src/app/ COPY --from=builder /reqs /usr/local -COPY ./src/recommendationservice/ ./ +COPY ./src/recommendation/ ./ RUN opentelemetry-bootstrap -a install -EXPOSE ${RECOMMENDATION_SERVICE_PORT} +EXPOSE ${RECOMMENDATION_PORT} ENTRYPOINT [ "opentelemetry-instrument", "python", "recommendation_server.py" ] diff --git a/src/recommendationservice/README.md b/src/recommendation/README.md similarity index 87% rename from src/recommendationservice/README.md rename to src/recommendation/README.md index cf6e386aaa..ec0df489d6 100644 --- a/src/recommendationservice/README.md +++ b/src/recommendation/README.md @@ -16,5 +16,5 @@ make docker-generate-protobuf From the root directory, run: ```sh -docker compose build recommendationservice +docker compose build recommendation ``` diff --git a/src/recommendationservice/demo_pb2.py b/src/recommendation/demo_pb2.py similarity index 100% rename from src/recommendationservice/demo_pb2.py rename to src/recommendation/demo_pb2.py diff --git a/src/recommendationservice/demo_pb2_grpc.py b/src/recommendation/demo_pb2_grpc.py similarity index 100% rename from src/recommendationservice/demo_pb2_grpc.py rename to src/recommendation/demo_pb2_grpc.py diff --git a/src/recommendationservice/genproto/Dockerfile b/src/recommendation/genproto/Dockerfile similarity index 100% rename from src/recommendationservice/genproto/Dockerfile rename to src/recommendation/genproto/Dockerfile diff --git a/src/recommendationservice/logger.py b/src/recommendation/logger.py similarity index 100% rename from src/recommendationservice/logger.py rename to src/recommendation/logger.py diff --git a/src/recommendationservice/metrics.py b/src/recommendation/metrics.py similarity index 100% rename from src/recommendationservice/metrics.py rename to src/recommendation/metrics.py diff --git a/src/recommendationservice/recommendation_server.py b/src/recommendation/recommendation_server.py similarity index 96% rename from src/recommendationservice/recommendation_server.py rename to src/recommendation/recommendation_server.py index 1a6826d80d..fd25359ea9 100644 --- a/src/recommendationservice/recommendation_server.py +++ b/src/recommendation/recommendation_server.py @@ -75,7 +75,7 @@ def get_product_list(request_product_ids): request_product_ids = request_product_ids_str.split(',') # Feature flag scenario - Cache Leak - if check_feature_flag("recommendationServiceCacheFailure"): + if check_feature_flag("recommendationCacheFailure"): span.set_attribute("app.recommendation.cache_enabled", True) if random.random() < 0.5 or first_run: first_run = False @@ -123,7 +123,7 @@ def must_map_env(key: str): def check_feature_flag(flag_name: str): # Initialize OpenFeature client = api.get_client() - return client.get_boolean_value("recommendationServiceCacheFailure", False) + return client.get_boolean_value("recommendationCacheFailure", False) if __name__ == "__main__": @@ -166,7 +166,7 @@ def check_feature_flag(flag_name: str): health_pb2_grpc.add_HealthServicer_to_server(service, server) # Start server - port = must_map_env('RECOMMENDATION_SERVICE_PORT') + port = must_map_env('RECOMMENDATION_PORT') server.add_insecure_port(f'[::]:{port}') server.start() logger.info(f'Recommendation service started, listening on port {port}') diff --git a/src/recommendationservice/requirements.txt b/src/recommendation/requirements.txt similarity index 100% rename from src/recommendationservice/requirements.txt rename to src/recommendation/requirements.txt diff --git a/test/tracetesting/recommendationservice/all.yaml b/test/tracetesting/recommendation/all.yaml similarity index 100% rename from test/tracetesting/recommendationservice/all.yaml rename to test/tracetesting/recommendation/all.yaml diff --git a/test/tracetesting/recommendationservice/list.yaml b/test/tracetesting/recommendation/list.yaml similarity index 94% rename from test/tracetesting/recommendationservice/list.yaml rename to test/tracetesting/recommendation/list.yaml index 2478bd6dc0..177628ec7e 100644 --- a/test/tracetesting/recommendationservice/list.yaml +++ b/test/tracetesting/recommendation/list.yaml @@ -10,7 +10,7 @@ spec: type: grpc grpc: protobufFile: ../../../pb/demo.proto - address: ${var:RECOMMENDATION_SERVICE_ADDR} + address: ${var:RECOMMENDATION_ADDR} method: oteldemo.RecommendationService.ListRecommendations request: |- { diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index ac92e25dd9..15c15263c2 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -8,7 +8,7 @@ set -e # Availalble services to test -ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "payment" "productcatalogservice" "recommendationservice" "shipping") +ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "payment" "productcatalogservice" "recommendation" "shipping") ## Script variables # Will contain the list of services to test @@ -50,8 +50,8 @@ spec: value: $PAYMENT_ADDR - key: PRODUCT_CATALOG_SERVICE_ADDR value: $PRODUCT_CATALOG_SERVICE_ADDR - - key: RECOMMENDATION_SERVICE_ADDR - value: $RECOMMENDATION_SERVICE_ADDR + - key: RECOMMENDATION_ADDR + value: $RECOMMENDATION_ADDR - key: SHIPPING_ADDR value: $SHIPPING_ADDR - key: KAFKA_SERVICE_ADDR