diff --git a/.env b/.env index d6a7a94a72..1779f87def 100644 --- a/.env +++ b/.env @@ -69,12 +69,12 @@ 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 +FRAUD_DOCKERFILE=./src/fraud-detection/Dockerfile # Frontend FRONTEND_PORT=8080 @@ -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 635651ed3b..b1e5df9dc6 100644 --- a/.github/workflows/component-build-images.yml +++ b/.github/workflows/component-build-images.yml @@ -71,12 +71,12 @@ 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 - tag_suffix: frauddetectionservice + - file: ./src/fraud-detection/Dockerfile + tag_suffix: fraud-detection context: ./ setup-qemu: true - file: ./src/frontend/Dockerfile @@ -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 0e791dd5dd..401292e0ef 100644 --- a/.gitignore +++ b/.gitignore @@ -49,10 +49,10 @@ 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 +/src/payment/demo.proto /src/shipping/proto/ /src/currency/proto diff --git a/CHANGELOG.md b/CHANGELOG.md index 4333a4bdef..2861f1bcc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,12 @@ 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)) +* [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)) * [recommendation] rename recommendationservice to recommendation ([#1865](https://github.com/open-telemetry/opentelemetry-demo/pull/1865)) diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index d6e398129b..dc2714c84a 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -41,9 +41,9 @@ services: - CART_ADDR - CHECKOUT_SERVICE_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FRONTEND_ADDR - - PAYMENT_SERVICE_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - RECOMMENDATION_ADDR - SHIPPING_ADDR @@ -67,13 +67,13 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started - frauddetectionservice: + fraud-detection: 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 5057104431..2066c6b2ac 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -100,9 +100,9 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR + - EMAIL_ADDR - FLAGD_HOST - - PAYMENT_SERVICE_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR - OTEL_EXPORTER_OTLP_ENDPOINT @@ -114,9 +114,9 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started - paymentservice: + payment: condition: service_started productcatalogservice: 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 @@ -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 0f62fe247e..22ee8e86ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,8 +134,8 @@ services: - CHECKOUT_SERVICE_PORT - CART_ADDR - CURRENCY_ADDR - - EMAIL_SERVICE_ADDR - - PAYMENT_SERVICE_ADDR + - EMAIL_ADDR + - PAYMENT_ADDR - PRODUCT_CATALOG_SERVICE_ADDR - SHIPPING_ADDR - KAFKA_SERVICE_ADDR @@ -148,9 +148,9 @@ services: condition: service_started currency: condition: service_started - emailservice: + email: condition: service_started - paymentservice: + payment: condition: service_started productcatalogservice: condition: service_started @@ -193,41 +193,41 @@ 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 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 @@ -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 7b8874e0d9..f29fdcfcdb 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -26,9 +26,9 @@ 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_js payment gen_proto_go productcatalogservice #gen_proto_php quote gen_proto_python recommendation diff --git a/ide-gen-proto.sh b/ide-gen-proto.sh index 7813f7a848..aabbdf5f38 100755 --- a/ide-gen-proto.sh +++ b/ide-gen-proto.sh @@ -70,10 +70,10 @@ 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 +gen_proto_js payment gen_proto_go productcatalogservice # gen_proto_php quote gen_proto_python recommendation diff --git a/renovate.json5 b/renovate.json5 index d8a51f1288..7155995f2a 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -35,16 +35,16 @@ "groupName": "currency", }, { - "matchFileNames": ["src/emailservice/**"], - "groupName": "emailservice", + "matchFileNames": ["src/email/**"], + "groupName": "email", }, { "matchFileNames": ["src/featureflagservice/**"], "groupName": "featureflagservice", }, { - "matchFileNames": ["src/frauddetectionservice/**"], - "groupName": "frauddetectionservice", + "matchFileNames": ["src/fraud-detection/**"], + "groupName": "fraud-detection", }, { "matchFileNames": ["src/frontend/**"], @@ -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 d4c7bfadc9..3f9c169199 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -187,12 +187,12 @@ 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() - 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) @@ -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/src/flagd/demo.flagd.json b/src/flagd/demo.flagd.json index 68d0a4834f..4425e72415 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/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" - 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/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/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 42ca66e9da..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" "emailservice" "paymentservice" "productcatalogservice" "recommendation" "shipping") +ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "payment" "productcatalogservice" "recommendation" "shipping") ## Script variables # Will contain the list of services to test @@ -42,12 +42,12 @@ 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 - value: $PAYMENT_SERVICE_ADDR + - key: PAYMENT_ADDR + value: $PAYMENT_ADDR - key: PRODUCT_CATALOG_SERVICE_ADDR value: $PRODUCT_CATALOG_SERVICE_ADDR - key: RECOMMENDATION_ADDR