Skip to content

Commit

Permalink
Merge branch 'main' into rename.frauddetectionservice
Browse files Browse the repository at this point in the history
  • Loading branch information
julianocosta89 authored Dec 23, 2024
2 parents 9fd9a6e + 969fe3b commit ef59042
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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_DOCKERFILE=./src/fraud-detection/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/component-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/fraud-detection/Dockerfile
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
* [fraud-detection] rename frauddetectionservice to fraud-detection
([#1862](https://github.com/open-telemetry/opentelemetry-demo/pull/1862))

Expand Down
4 changes: 2 additions & 2 deletions docker-compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,7 +67,7 @@ services:
condition: service_started
currency:
condition: service_started
emailservice:
email:
condition: service_started
fraud-detection:
condition: service_started
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -114,7 +114,7 @@ services:
condition: service_started
currency:
condition: service_started
emailservice:
email:
condition: service_started
paymentservice:
condition: service_started
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -148,7 +148,7 @@ services:
condition: service_started
currency:
condition: service_started
emailservice:
email:
condition: service_started
paymentservice:
condition: service_started
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"groupName": "currency",
},
{
"matchFileNames": ["src/emailservice/**"],
"groupName": "emailservice",
"matchFileNames": ["src/email/**"],
"groupName": "email",
},
{
"matchFileNames": ["src/featureflagservice/**"],
Expand Down
6 changes: 3 additions & 3 deletions src/checkoutservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -458,15 +458,15 @@ 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,
})
if err != nil {
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)
}
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/emailservice/Dockerfile → src/email/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ 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
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"]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/emailservice/README.md → src/email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .`
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/tracetesting/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ef59042

Please sign in to comment.