Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .licenserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
]
}
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))
* [recommendation] rename recommendationservice to recommendation
([#1865](https://github.com/open-telemetry/opentelemetry-demo/pull/1865))

## 1.12.0

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ services:
- FRONTEND_ADDR
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- RECOMMENDATION_ADDR
- SHIPPING_ADDR
- KAFKA_SERVICE_ADDR
extra_hosts:
Expand Down Expand Up @@ -79,7 +79,7 @@ services:
condition: service_started
quote:
condition: service_started
recommendationservice:
recommendation:
condition: service_started
shipping:
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 @@ -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}
Expand All @@ -229,7 +229,7 @@ services:
condition: service_started
quote:
condition: service_started
recommendationservice:
recommendation:
condition: service_started
shipping:
condition: service_started
Expand Down Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -301,7 +301,7 @@ services:
condition: service_started
quote:
condition: service_started
recommendationservice:
recommendation:
condition: service_started
shipping:
condition: service_started
Expand Down Expand Up @@ -517,31 +517,31 @@ 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
- 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:
Expand Down
2 changes: 1 addition & 1 deletion docker-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ gen_proto_go checkoutservice
#gen_proto_js paymentservice
gen_proto_go productcatalogservice
#gen_proto_php quote
gen_proto_python recommendationservice
gen_proto_python recommendation
#gen_proto_rust shipping
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ gen_proto_ts react-native-app
gen_proto_js paymentservice
gen_proto_go productcatalogservice
# gen_proto_php quote
gen_proto_python recommendationservice
gen_proto_python recommendation
gen_proto_rust shipping
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
"groupName": "quote",
},
{
"matchFileNames": ["src/recommendationservice/**"],
"groupName": "recommendationservice",
"matchFileNames": ["src/recommendation/**"],
"groupName": "recommendation",
},
{
"matchFileNames": ["src/shipping/**"],
Expand Down
2 changes: 1 addition & 1 deletion src/flagd/demo.flagd.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"defaultVariant": "off"
},
"recommendationServiceCacheFailure": {
"recommendationCacheFailure": {
"description": "Fail recommendation service cache",
"state": "ENABLED",
"variants": {
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/gateways/rpc/Recommendations.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) {
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '',
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" ]
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ make docker-generate-protobuf
From the root directory, run:

```sh
docker compose build recommendationservice
docker compose build recommendation
```
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__":
Expand Down Expand Up @@ -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}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
{
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" "emailservice" "paymentservice" "productcatalogservice" "recommendation" "shipping")

## Script variables
# Will contain the list of services to test
Expand Down Expand Up @@ -50,8 +50,8 @@ spec:
value: $PAYMENT_SERVICE_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
Expand Down