Skip to content

Commit

Permalink
Merge branch 'main' into sozhan/rename.ad
Browse files Browse the repository at this point in the history
  • Loading branch information
puckpuck authored Dec 19, 2024
2 parents 2c5397a + 5dbe836 commit e1706f7
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:${PRODUCT_CATALOG_SERVICE_POR
PRODUCT_CATALOG_DOCKERFILE=./src/productcatalogservice/Dockerfile

# Quote Service
QUOTE_SERVICE_PORT=8090
QUOTE_SERVICE_ADDR=http://quoteservice:${QUOTE_SERVICE_PORT}
QUOTE_SERVICE_DOCKERFILE=./src/quoteservice/Dockerfile
QUOTE_PORT=8090
QUOTE_ADDR=http://quote:${QUOTE_PORT}
QUOTE_DOCKERFILE=./src/quote/Dockerfile

# Recommendation Service
RECOMMENDATION_SERVICE_PORT=9001
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 @@ -111,8 +111,8 @@ jobs:
tag_suffix: productcatalogservice
context: ./
setup-qemu: true
- file: ./src/quoteservice/Dockerfile
tag_suffix: quoteservice
- file: ./src/quote/Dockerfile
tag_suffix: quote
context: ./
setup-qemu: true
- file: ./src/recommendationservice/Dockerfile
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ the release.
([#1830](https://github.com/open-telemetry/opentelemetry-demo/pull/1830))
* [grafana] Add Exemplars Dashboard
([#1836](https://github.com/open-telemetry/opentelemetry-demo/pull/1836))
* [quote] rename quoteservice to quote
([#1838](https://github.com/open-telemetry/opentelemetry-demo/pull/1838))
* [otel-collector] rename otelcol to otel-collector
([#1841](https://github.com/open-telemetry/opentelemetry-demo/pull/1841))
* [ad] rename adservice to ad
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ services:
condition: service_started
productcatalogservice:
condition: service_started
quoteservice:
quote:
condition: service_started
recommendationservice:
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 @@ -227,7 +227,7 @@ services:
condition: service_started
productcatalogservice:
condition: service_started
quoteservice:
quote:
condition: service_started
recommendationservice:
condition: service_started
Expand Down Expand Up @@ -407,27 +407,27 @@ services:
logging: *logging

# Quote service
quoteservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-quoteservice
quote:
image: ${IMAGE_NAME}:${DEMO_VERSION}-quote
container_name: quote-service
build:
context: ./
dockerfile: ${QUOTE_SERVICE_DOCKERFILE}
dockerfile: ${QUOTE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-quoteservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-quote
deploy:
resources:
limits:
memory: 40M
restart: unless-stopped
ports:
- "${QUOTE_SERVICE_PORT}"
- "${QUOTE_PORT}"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_PHP_AUTOLOAD_ENABLED=true
- QUOTE_SERVICE_PORT
- QUOTE_PORT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=quoteservice
- OTEL_SERVICE_NAME=quote
- OTEL_PHP_INTERNAL_METRICS_ENABLED=true
depends_on:
otel-collector:
Expand Down Expand Up @@ -485,7 +485,7 @@ services:
- "${SHIPPING_SERVICE_PORT}"
environment:
- SHIPPING_SERVICE_PORT
- QUOTE_SERVICE_ADDR
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ services:
condition: service_started
productcatalogservice:
condition: service_started
quoteservice:
quote:
condition: service_started
recommendationservice:
condition: service_started
Expand Down Expand Up @@ -489,27 +489,27 @@ services:
logging: *logging

# Quote service
quoteservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-quoteservice
quote:
image: ${IMAGE_NAME}:${DEMO_VERSION}-quote
container_name: quote-service
build:
context: ./
dockerfile: ${QUOTE_SERVICE_DOCKERFILE}
dockerfile: ${QUOTE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-quoteservice
- ${IMAGE_NAME}:${IMAGE_VERSION}-quote
deploy:
resources:
limits:
memory: 40M
restart: unless-stopped
ports:
- "${QUOTE_SERVICE_PORT}"
- "${QUOTE_PORT}"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_PHP_AUTOLOAD_ENABLED=true
- QUOTE_SERVICE_PORT
- QUOTE_PORT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=quoteservice
- OTEL_SERVICE_NAME=quote
- OTEL_PHP_INTERNAL_METRICS_ENABLED=true
depends_on:
otel-collector:
Expand Down Expand Up @@ -570,7 +570,7 @@ services:
- "${SHIPPING_SERVICE_PORT}"
environment:
- SHIPPING_SERVICE_PORT
- QUOTE_SERVICE_ADDR
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shippingservice
Expand Down
2 changes: 1 addition & 1 deletion docker-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ gen_proto_go checkoutservice
#gen_proto_ts frontend
#gen_proto_js paymentservice
gen_proto_go productcatalogservice
#gen_proto_php quoteservice
#gen_proto_php quote
gen_proto_python recommendationservice
#gen_proto_rust shippingservice
2 changes: 1 addition & 1 deletion ide-gen-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ gen_proto_go checkoutservice
gen_proto_ts frontend
gen_proto_js paymentservice
gen_proto_go productcatalogservice
# gen_proto_php quoteservice
# gen_proto_php quote
gen_proto_python recommendationservice
gen_proto_rust shippingservice
4 changes: 2 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
"groupName": "prometheus",
},
{
"matchFileNames": ["src/quoteservice/**"],
"groupName": "quoteservice",
"matchFileNames": ["src/quote/**"],
"groupName": "quote",
},
{
"matchFileNames": ["src/recommendationservice/**"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@
"uid": "webstore-metrics"
},
"editorMode": "code",
"expr": "rate(otel_trace_span_processor_spans{job=\"opentelemetry-demo/quoteservice\"}[2m])*120",
"expr": "rate(otel_trace_span_processor_spans{job=\"opentelemetry-demo/quote\"}[2m])*120",
"interval": "2m",
"legendFormat": "{{state}}",
"range": true,
Expand Down
8 changes: 4 additions & 4 deletions src/quoteservice/.dockerignore → src/quote/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.dockerignore
.idea
Dockerfile
vendor
.dockerignore
.idea
Dockerfile
vendor
File renamed without changes.
6 changes: 3 additions & 3 deletions src/quoteservice/Dockerfile → src/quote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ RUN chmod +x /usr/local/bin/install-php-extensions \
WORKDIR /var/www
CMD ["php", "public/index.php"]
USER www-data
EXPOSE ${QUOTE_SERVICE_PORT}
EXPOSE ${QUOTE_PORT}

FROM composer:2.7 AS vendor

WORKDIR /tmp/
COPY ./src/quoteservice/composer.json .
COPY ./src/quote/composer.json .

RUN composer install \
--ignore-platform-reqs \
Expand All @@ -32,4 +32,4 @@ RUN composer install \

FROM base AS final
COPY --from=vendor /tmp/vendor/ ./vendor/
COPY ./src/quoteservice/ /var/www
COPY ./src/quote/ /var/www
10 changes: 5 additions & 5 deletions src/quoteservice/README.md → src/quote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ To build the quote service, run the following from root directory
of opentelemetry-demo

```sh
docker compose build quoteservice
docker compose build quote
```

## Run the service

Execute the below command to run the service.

```sh
docker compose up quoteservice
docker compose up quote
```

In order to get traffic into the service you have to deploy
Expand All @@ -32,9 +32,9 @@ Please follow the root README to do so.
To build and run the quote service locally:

```sh
docker build src/quoteservice --target base -t quoteservice
cd src/quoteservice
docker run --rm -it -v $(pwd):/var/www -e QUOTE_SERVICE_PORT=8999 -p "8999:8999" quoteservice
docker build src/quote --target base -t quote
cd src/quote
docker run --rm -it -v $(pwd):/var/www -e QUOTE_PORT=8999 -p "8999:8999" quote
```

Then, send some curl requests:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/quoteservice/composer.json → src/quote/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "openteletry-demo/quoteservice",
"name": "openteletry-demo/quote",
"description": "Quote Service part of OpenTelemetry Demo",
"license": "Apache-2.0",
"require": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

return $response;
});
$address = '0.0.0.0:' . getenv('QUOTE_SERVICE_PORT');
$address = '0.0.0.0:' . getenv('QUOTE_PORT');
$socket = new SocketServer($address);
$server->listen($socket);

Expand Down
2 changes: 1 addition & 1 deletion src/shippingservice/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shipping Service

The Shipping service queries `quoteservice` for price quote, provides tracking IDs,
The Shipping service queries `quote` for price quote, provides tracking IDs,
and the impression of order fulfillment & shipping processes.

## Local
Expand Down
4 changes: 2 additions & 2 deletions src/shippingservice/src/shipping_service/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ pub async fn create_quote_from_count(count: u32) -> Result<Quote, tonic::Status>
async fn request_quote(count: u32) -> Result<f64, Box<dyn std::error::Error>> {
let quote_service_addr: String = format!(
"{}{}",
env::var("QUOTE_SERVICE_ADDR")
.unwrap_or_else(|_| "http://quoteservice:8090".to_string())
env::var("QUOTE_ADDR")
.unwrap_or_else(|_| "http://quote:8090".to_string())
.parse::<String>()
.expect("Invalid quote service address"),
"/getquote"
Expand Down

0 comments on commit e1706f7

Please sign in to comment.