Skip to content

Commit 4c8e43f

Browse files
[payment] rename paymentservice to payment (#1863)
* rename paymentservice to payment * rename paymentservice to payment * rename paymentservice to payment --------- Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
1 parent 3868f0e commit 4c8e43f

27 files changed

+58
-56
lines changed

.env

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ LOCUST_HEADLESS=false
102102
LOAD_GENERATOR_DOCKERFILE=./src/load-generator/Dockerfile
103103

104104
# Payment Service
105-
PAYMENT_SERVICE_PORT=50051
106-
PAYMENT_SERVICE_ADDR=paymentservice:${PAYMENT_SERVICE_PORT}
107-
PAYMENT_SERVICE_DOCKERFILE=./src/paymentservice/Dockerfile
105+
PAYMENT_PORT=50051
106+
PAYMENT_ADDR=payment:${PAYMENT_PORT}
107+
PAYMENT_DOCKERFILE=./src/payment/Dockerfile
108108

109109
# Product Catalog Service
110110
PRODUCT_CATALOG_SERVICE_PORT=3550

.github/workflows/component-build-images.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ jobs:
103103
tag_suffix: load-generator
104104
context: ./
105105
setup-qemu: true
106-
- file: ./src/paymentservice/Dockerfile
107-
tag_suffix: paymentservice
106+
- file: ./src/payment/Dockerfile
107+
tag_suffix: payment
108108
context: ./
109109
setup-qemu: true
110110
- file: ./src/productcatalogservice/Dockerfile

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test/tracetesting/tracetesting-vars.yaml
5252
/src/fraud-detection/src/main/proto
5353
/src/frontend/pb/
5454
/src/frontend/protos/
55-
/src/paymentservice/demo.proto
55+
/src/payment/demo.proto
5656
/src/shipping/proto/
5757
/src/currency/proto
5858

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ the release.
6060
([#1861](https://github.com/open-telemetry/opentelemetry-demo/pull/1861))
6161
* [fraud-detection] rename frauddetectionservice to fraud-detection
6262
([#1862](https://github.com/open-telemetry/opentelemetry-demo/pull/1862))
63+
* [payment] rename paymentservice to payment
64+
([#1863](https://github.com/open-telemetry/opentelemetry-demo/pull/1863))
6365

6466
## 1.12.0
6567

docker-compose-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ services:
4343
- CURRENCY_ADDR
4444
- EMAIL_ADDR
4545
- FRONTEND_ADDR
46-
- PAYMENT_SERVICE_ADDR
46+
- PAYMENT_ADDR
4747
- PRODUCT_CATALOG_SERVICE_ADDR
4848
- RECOMMENDATION_SERVICE_ADDR
4949
- SHIPPING_ADDR
@@ -73,7 +73,7 @@ services:
7373
condition: service_started
7474
frontend:
7575
condition: service_started
76-
paymentservice:
76+
payment:
7777
condition: service_started
7878
productcatalogservice:
7979
condition: service_started

docker-compose.minimal.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ services:
102102
- CURRENCY_ADDR
103103
- EMAIL_ADDR
104104
- FLAGD_HOST
105-
- PAYMENT_SERVICE_ADDR
105+
- PAYMENT_ADDR
106106
- PRODUCT_CATALOG_SERVICE_ADDR
107107
- SHIPPING_ADDR
108108
- OTEL_EXPORTER_OTLP_ENDPOINT
@@ -116,7 +116,7 @@ services:
116116
condition: service_started
117117
email:
118118
condition: service_started
119-
paymentservice:
119+
payment:
120120
condition: service_started
121121
productcatalogservice:
122122
condition: service_started
@@ -351,28 +351,28 @@ services:
351351
logging: *logging
352352

353353
# Payment service
354-
paymentservice:
355-
image: ${IMAGE_NAME}:${DEMO_VERSION}-paymentservice
354+
payment:
355+
image: ${IMAGE_NAME}:${DEMO_VERSION}-payment
356356
container_name: payment-service
357357
build:
358358
context: ./
359-
dockerfile: ${PAYMENT_SERVICE_DOCKERFILE}
359+
dockerfile: ${PAYMENT_DOCKERFILE}
360360
cache_from:
361-
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
361+
- ${IMAGE_NAME}:${IMAGE_VERSION}-payment
362362
deploy:
363363
resources:
364364
limits:
365365
memory: 120M
366366
restart: unless-stopped
367367
ports:
368-
- "${PAYMENT_SERVICE_PORT}"
368+
- "${PAYMENT_PORT}"
369369
environment:
370370
- FLAGD_HOST
371-
- PAYMENT_SERVICE_PORT
371+
- PAYMENT_PORT
372372
- OTEL_EXPORTER_OTLP_ENDPOINT
373373
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
374374
- OTEL_RESOURCE_ATTRIBUTES
375-
- OTEL_SERVICE_NAME=paymentservice
375+
- OTEL_SERVICE_NAME=payment
376376
depends_on:
377377
otel-collector:
378378
condition: service_started

docker-compose.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ services:
135135
- CART_ADDR
136136
- CURRENCY_ADDR
137137
- EMAIL_ADDR
138-
- PAYMENT_SERVICE_ADDR
138+
- PAYMENT_ADDR
139139
- PRODUCT_CATALOG_SERVICE_ADDR
140140
- SHIPPING_ADDR
141141
- KAFKA_SERVICE_ADDR
@@ -150,7 +150,7 @@ services:
150150
condition: service_started
151151
email:
152152
condition: service_started
153-
paymentservice:
153+
payment:
154154
condition: service_started
155155
productcatalogservice:
156156
condition: service_started
@@ -427,29 +427,29 @@ services:
427427
logging: *logging
428428

429429
# Payment service
430-
paymentservice:
431-
image: ${IMAGE_NAME}:${DEMO_VERSION}-paymentservice
430+
payment:
431+
image: ${IMAGE_NAME}:${DEMO_VERSION}-payment
432432
container_name: payment-service
433433
build:
434434
context: ./
435-
dockerfile: ${PAYMENT_SERVICE_DOCKERFILE}
435+
dockerfile: ${PAYMENT_DOCKERFILE}
436436
cache_from:
437-
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
437+
- ${IMAGE_NAME}:${IMAGE_VERSION}-payment
438438
deploy:
439439
resources:
440440
limits:
441441
memory: 120M
442442
restart: unless-stopped
443443
ports:
444-
- "${PAYMENT_SERVICE_PORT}"
444+
- "${PAYMENT_PORT}"
445445
environment:
446-
- PAYMENT_SERVICE_PORT
446+
- PAYMENT_PORT
447447
- FLAGD_HOST
448448
- FLAGD_PORT
449449
- OTEL_EXPORTER_OTLP_ENDPOINT
450450
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
451451
- OTEL_RESOURCE_ATTRIBUTES
452-
- OTEL_SERVICE_NAME=paymentservice
452+
- OTEL_SERVICE_NAME=payment
453453
depends_on:
454454
otel-collector:
455455
condition: service_started

docker-gen-proto.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ gen_proto_go checkoutservice
2828
#gen_proto_cpp currency
2929
#gen_proto_ruby email
3030
#gen_proto_ts frontend
31-
#gen_proto_js paymentservice
31+
#gen_proto_js payment
3232
gen_proto_go productcatalogservice
3333
#gen_proto_php quote
3434
gen_proto_python recommendationservice

ide-gen-proto.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ gen_proto_go checkoutservice
7373
# gen_proto_ruby email
7474
gen_proto_ts frontend
7575
gen_proto_ts react-native-app
76-
gen_proto_js paymentservice
76+
gen_proto_js payment
7777
gen_proto_go productcatalogservice
7878
# gen_proto_php quote
7979
gen_proto_python recommendationservice

renovate.json5

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
"groupName": "otel-collector",
7272
},
7373
{
74-
"matchFileNames": ["src/paymentservice/**"],
75-
"groupName": "paymentservice",
74+
"matchFileNames": ["src/payment/**"],
75+
"groupName": "payment",
7676
},
7777
{
7878
"matchFileNames": ["src/productcatalogservice/**"],

src/checkoutservice/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func main() {
192192
svc.emailSvcClient = pb.NewEmailServiceClient(c)
193193
defer c.Close()
194194

195-
mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR")
195+
mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_ADDR")
196196
c = mustCreateClient(svc.paymentSvcAddr)
197197
svc.paymentSvcClient = pb.NewPaymentServiceClient(c)
198198
defer c.Close()
@@ -442,7 +442,7 @@ func (cs *checkoutService) convertCurrency(ctx context.Context, from *pb.Money,
442442

443443
func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, paymentInfo *pb.CreditCardInfo) (string, error) {
444444
paymentService := cs.paymentSvcClient
445-
if cs.isFeatureFlagEnabled(ctx, "paymentServiceUnreachable") {
445+
if cs.isFeatureFlagEnabled(ctx, "paymentUnreachable") {
446446
badAddress := "badAddress:50051"
447447
c := mustCreateClient(badAddress)
448448
paymentService = pb.NewPaymentServiceClient(c)

src/flagd/demo.flagd.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"defaultVariant": "off"
6666
},
67-
"paymentServiceFailure": {
67+
"paymentFailure": {
6868
"description": "Fail payment service charge requests n%",
6969
"state": "ENABLED",
7070
"variants": {
@@ -78,7 +78,7 @@
7878
},
7979
"defaultVariant": "off"
8080
},
81-
"paymentServiceUnreachable": {
81+
"paymentUnreachable": {
8282
"description": "Payment service is unavailable",
8383
"state": "ENABLED",
8484
"variants": {
File renamed without changes.

src/paymentservice/Dockerfile src/payment/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FROM node:22-alpine AS build
66

77
WORKDIR /usr/src/app/
88

9-
COPY ./src/paymentservice/package*.json ./
9+
COPY ./src/payment/package*.json ./
1010

1111
RUN apk add --no-cache python3 make g++ && npm ci --omit=dev
1212

@@ -19,8 +19,8 @@ WORKDIR /usr/src/app/
1919
ENV NODE_ENV=production
2020

2121
COPY --chown=node:node --from=build /usr/src/app/node_modules/ ./node_modules/
22-
COPY ./src/paymentservice/ ./
22+
COPY ./src/payment/ ./
2323
COPY ./pb/demo.proto ./
2424

25-
EXPOSE ${PAYMENT_SERVICE_PORT}
25+
EXPOSE ${PAYMENT_PORT}
2626
ENTRYPOINT [ "npm", "run", "start" ]

src/paymentservice/README.md src/payment/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Copy the `demo.proto` file to this directory and run `npm ci`
1212
From the root directory, run:
1313

1414
```sh
15-
docker compose build paymentservice
15+
docker compose build payment
1616
```

src/paymentservice/charge.js src/payment/charge.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const { FlagdProvider } = require('@openfeature/flagd-provider');
99
const flagProvider = new FlagdProvider();
1010

1111
const logger = require('./logger');
12-
const tracer = trace.getTracer('paymentservice');
13-
const meter = metrics.getMeter('paymentservice');
12+
const tracer = trace.getTracer('payment');
13+
const meter = metrics.getMeter('payment');
1414
const transactionsCounter = meter.createCounter('app.payment.transactions');
1515

1616
const LOYALTY_LEVEL = ['platinum', 'gold', 'silver', 'bronze'];
@@ -26,7 +26,7 @@ module.exports.charge = async request => {
2626

2727
await OpenFeature.setProviderAndWait(flagProvider);
2828

29-
const numberVariant = await OpenFeature.getClient().getNumberValue("paymentServiceFailure", 0);
29+
const numberVariant = await OpenFeature.getClient().getNumberValue("paymentFailure", 0);
3030

3131
if (numberVariant > 0) {
3232
// n% chance to fail with app.loyalty.level=gold

src/paymentservice/index.js src/payment/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ server.addService(health.service, new health.Implementation({
4545

4646
server.addService(otelDemoPackage.oteldemo.PaymentService.service, { charge: chargeServiceHandler })
4747

48-
server.bindAsync(`0.0.0.0:${process.env['PAYMENT_SERVICE_PORT']}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
48+
server.bindAsync(`0.0.0.0:${process.env['PAYMENT_PORT']}`, grpc.ServerCredentials.createInsecure(), (err, port) => {
4949
if (err) {
5050
return logger.error({ err })
5151
}
5252

53-
logger.info(`PaymentService gRPC server started on port ${port}`)
53+
logger.info(`payment gRPC server started on port ${port}`)
5454
})
5555

5656
process.once('SIGINT', closeGracefully)
File renamed without changes.
File renamed without changes.

src/paymentservice/package-lock.json src/payment/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/paymentservice/package.json src/payment/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "paymentservice",
2+
"name": "payment",
33
"description": "Payment Service",
44
"repository": "https://github.com/opentelemetry/opentelemetry-demo",
55
"main": "index.js",

test/tracetesting/paymentservice/all.yaml test/tracetesting/payment/all.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
type: TestSuite
55
spec:
6-
id: payment-service-all
7-
name: 'Payment Service'
8-
description: Run all Payment Service tests enabled in sequence
6+
id: payment-all
7+
name: 'Payment'
8+
description: Run all Payment tests enabled in sequence
99
steps:
1010
- ./valid-credit-card.yaml
1111
- ./invalid-credit-card.yaml

test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml test/tracetesting/payment/amex-credit-card-not-allowed.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
type: grpc
1111
grpc:
1212
protobufFile: ../../../pb/demo.proto
13-
address: ${var:PAYMENT_SERVICE_ADDR}
13+
address: ${var:PAYMENT_ADDR}
1414
method: oteldemo.PaymentService.Charge
1515
request: |-
1616
{

test/tracetesting/paymentservice/expired-credit-card.yaml test/tracetesting/payment/expired-credit-card.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
type: grpc
1111
grpc:
1212
protobufFile: ../../../pb/demo.proto
13-
address: ${var:PAYMENT_SERVICE_ADDR}
13+
address: ${var:PAYMENT_ADDR}
1414
method: oteldemo.PaymentService.Charge
1515
request: |-
1616
{

test/tracetesting/paymentservice/invalid-credit-card.yaml test/tracetesting/payment/invalid-credit-card.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
type: grpc
1111
grpc:
1212
protobufFile: ../../../pb/demo.proto
13-
address: ${var:PAYMENT_SERVICE_ADDR}
13+
address: ${var:PAYMENT_ADDR}
1414
method: oteldemo.PaymentService.Charge
1515
request: |-
1616
{

test/tracetesting/paymentservice/valid-credit-card.yaml test/tracetesting/payment/valid-credit-card.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
type: grpc
1111
grpc:
1212
protobufFile: ../../../pb/demo.proto
13-
address: ${var:PAYMENT_SERVICE_ADDR}
13+
address: ${var:PAYMENT_ADDR}
1414
method: oteldemo.PaymentService.Charge
1515
request: |-
1616
{

test/tracetesting/run.bash

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
set -e
99

1010
# Availalble services to test
11-
ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "paymentservice" "productcatalogservice" "recommendationservice" "shipping")
11+
ALL_SERVICES=("ad" "cart" "currency" "checkoutservice" "frontend" "email" "payment" "productcatalogservice" "recommendationservice" "shipping")
1212

1313
## Script variables
1414
# Will contain the list of services to test
@@ -46,8 +46,8 @@ spec:
4646
value: $EMAIL_ADDR
4747
- key: FRONTEND_ADDR
4848
value: $FRONTEND_ADDR
49-
- key: PAYMENT_SERVICE_ADDR
50-
value: $PAYMENT_SERVICE_ADDR
49+
- key: PAYMENT_ADDR
50+
value: $PAYMENT_ADDR
5151
- key: PRODUCT_CATALOG_SERVICE_ADDR
5252
value: $PRODUCT_CATALOG_SERVICE_ADDR
5353
- key: RECOMMENDATION_SERVICE_ADDR

0 commit comments

Comments
 (0)