Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[recommendationservice] - base image, licensing and diagram update #700

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.github
docs
internal
src/*/README.md
src/*/Dockerfile
src/*/*/Dockerfile

###################################
# currencyservice
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,7 @@ significant modifications will be credited to OpenTelemetry Authors.
([#691](https://github.com/open-telemetry/opentelemetry-demo/pull/691))
* Fix payment service version to support temporality environment variable
([#693](https://github.com/open-telemetry/opentelemetry-demo/pull/693))
* Update recommendationservice python base image and dependencies
([#700](https://github.com/open-telemetry/opentelemetry-demo/pull/700))
* Reduce spans generated from quote service
([#702](https://github.com/open-telemetry/opentelemetry-demo/pull/702))
4 changes: 3 additions & 1 deletion docs/current_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ checkoutservice --->|gRPC| currencyservice
checkoutservice --->|HTTP| emailservice
checkoutservice --->|gRPC| paymentservice
checkoutservice -->|gRPC| shippingservice
checkoutservice -->|TCP| queue
checkoutservice ---->|TCP| queue

frontend -->|gRPC| adservice
frontend -->|gRPC| cartservice
Expand All @@ -54,6 +54,8 @@ frauddetectionservice -->|TCP| queue

productcatalogservice -->|gRPC| featureflagservice

recommendationservice -->|gRPC| featureflagservice

shippingservice -->|gRPC| featureflagservice

featureflagservice --> featureflagstore
Expand Down
37 changes: 29 additions & 8 deletions src/recommendationservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Google LLC
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,21 +12,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM python:3.10
FROM python:3.10-slim-bullseye as base

WORKDIR /usr/src/app/
#
# Fetch requirements
#
FROM base as builder
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends g++ \
&& rm -rf /var/lib/apt/lists/*

COPY ./src/recommendationservice/ ./
COPY ./pb/ ./proto/
WORKDIR /usr/src/app/
COPY ./src/recommendationservice/requirements.txt ./

RUN pip install --upgrade pip
RUN pip install -r ./requirements.txt
RUN pip install --prefix="/reqs" -r requirements.txt

RUN opentelemetry-bootstrap -a install
#
# Build gRPC files
#
FROM base as grpc-builder
WORKDIR /usr/src/app/
COPY ./pb/ ./proto/

# add files into working directory
RUN python -m pip install grpcio-tools==1.48.2
RUN python -m grpc_tools.protoc -I=./proto/ --python_out=./ --grpc_python_out=./ ./proto/demo.proto

#
# Runtime
#
FROM base as runtime
WORKDIR /usr/src/app/
COPY --from=builder /reqs /usr/local
COPY --from=grpc-builder /usr/src/app/ .
COPY ./src/recommendationservice/ ./

RUN opentelemetry-bootstrap -a install

EXPOSE ${RECOMMENDATION_SERVICE_PORT}
ENTRYPOINT [ "opentelemetry-instrument", "python", "recommendation_server.py" ]
2 changes: 1 addition & 1 deletion src/recommendationservice/logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright 2018 Google LLC
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/recommendationservice/recommendation_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright 2018 Google LLC
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
7 changes: 3 additions & 4 deletions src/recommendationservice/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
google-api-core==2.4.0
grpcio-health-checking==1.43.0
grpcio==1.43.0
opentelemetry-distro==0.34b0
opentelemetry-exporter-otlp-proto-grpc==1.13.0
opentelemetry-distro==0.36b0
opentelemetry-exporter-otlp-proto-grpc==1.15.0
python-dotenv==0.21.0
python-json-logger==2.0.4
psutil==5.9.2 # Importing this will also import opentelemetry-instrumentation-system-metrics when running opentelemetry-bootstrap
psutil==5.9.2 # Importing this will also import opentelemetry-instrumentation-system-metrics when running opentelemetry-bootstrap