diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bcbfd131..69341f3bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,8 @@ release. ([#972](https://github.com/open-telemetry/opentelemetry-demo/pull/972)) * Update frontendproxy's env for minimal ([#983](https://github.com/open-telemetry/opentelemetry-demo/pull/983)) +* [LoadGenerator & RecommendatationService] update dependencies + ([#988](https://github.com/open-telemetry/opentelemetry-demo/pull/988)) * [FraudDetectionService] Updated Kotlin version and OTel dependencies ([#987](https://github.com/open-telemetry/opentelemetry-demo/pull/987)) diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index cc9a04e4c9..4b143e9508 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -289,7 +289,8 @@ services: - LOCUST_HOST - LOCUST_HEADLESS - LOCUST_AUTOSTART - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT + - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=loadgenerator - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python diff --git a/docker-compose.yml b/docker-compose.yml index a5cfee0c9e..4c7468c3eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -379,7 +379,8 @@ services: - LOCUST_HOST - LOCUST_HEADLESS - LOCUST_AUTOSTART - - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:4318/v1/traces + - OTEL_EXPORTER_OTLP_ENDPOINT + - OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=loadgenerator - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index 20264bd788..ea40f0614d 100644 --- a/src/loadgenerator/locustfile.py +++ b/src/loadgenerator/locustfile.py @@ -10,18 +10,29 @@ from locust import HttpUser, task, between from opentelemetry import context, baggage, trace +from opentelemetry.metrics import set_meter_provider +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import MetricExporter, PeriodicExportingMetricReader from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor -from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter +from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter +from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter +from opentelemetry.instrumentation.jinja2 import Jinja2Instrumentor from opentelemetry.instrumentation.requests import RequestsInstrumentor +from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor from opentelemetry.instrumentation.urllib3 import URLLib3Instrumentor +exporter = OTLPMetricExporter(insecure=True) +set_meter_provider(MeterProvider([PeriodicExportingMetricReader(exporter)])) + tracer_provider = TracerProvider() trace.set_tracer_provider(tracer_provider) tracer_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter())) # Instrumenting manually to avoid error with locust gevent monkey +Jinja2Instrumentor().instrument() RequestsInstrumentor().instrument() +SystemMetricsInstrumentor().instrument() URLLib3Instrumentor().instrument() categories = [ diff --git a/src/loadgenerator/requirements.txt b/src/loadgenerator/requirements.txt index 5009db4ef5..4d2a3ced42 100644 --- a/src/loadgenerator/requirements.txt +++ b/src/loadgenerator/requirements.txt @@ -7,35 +7,37 @@ configargparse==1.5.3 deprecated==1.2.13 flask==2.3.2 flask-basicauth==0.2.0 -flask-cors==3.0.10 -gevent==22.10.2 +flask-cors==4.0.0 +gevent==23.7.0 geventhttpclient==2.0.9 -googleapis-common-protos==1.59.0 +googleapis-common-protos==1.59.1 greenlet==2.0.2 idna==3.4 itsdangerous==2.1.2 jinja2==3.1.2 locust==2.15.1 -markupsafe==2.1.2 +markupsafe==2.1.3 msgpack==1.0.5 -opentelemetry-api==1.17.0 -opentelemetry-exporter-otlp-proto-http==1.17.0 -opentelemetry-instrumentation==0.38b0 -opentelemetry-instrumentation-requests==0.38b0 -opentelemetry-instrumentation-urllib3==0.38b0 -opentelemetry-proto==1.17.0 -opentelemetry-sdk==1.17.0 -opentelemetry-semantic-conventions==0.38b0 -opentelemetry-util-http==0.38b0 -protobuf==4.22.3 +opentelemetry-api==1.19.0 +opentelemetry-exporter-otlp-proto-grpc==1.19.0 +opentelemetry-instrumentation==0.40b0 +opentelemetry-instrumentation-jinja2==0.40b0 +opentelemetry-instrumentation-requests==0.40b0 +opentelemetry-instrumentation-system-metrics==0.40b0 +opentelemetry-instrumentation-urllib3==0.40b0 +opentelemetry-proto==1.19.0 +opentelemetry-sdk==1.19.0 +opentelemetry-semantic-conventions==0.40b0 +opentelemetry-util-http==0.40b0 +protobuf==4.23.4 psutil==5.9.5 -pyzmq==25.0.2 +pyzmq==25.1.0 requests==2.31.0 roundrobin==0.0.4 six==1.16.0 -typing-extensions==4.5.0 -urllib3==1.26.15 -werkzeug==2.3.3 +typing-extensions==4.7.1 +urllib3==2.0.4 +werkzeug==2.3.6 wrapt==1.15.0 -zope-event==4.6 +zope-event==5.0 zope-interface==6.0 diff --git a/src/recommendationservice/Dockerfile b/src/recommendationservice/Dockerfile index 99d2d5e565..d4dc275269 100644 --- a/src/recommendationservice/Dockerfile +++ b/src/recommendationservice/Dockerfile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 -FROM python:3.10-slim-bullseye as base +FROM python:3.11-slim-bullseye as base # # Fetch requirements @@ -25,7 +25,7 @@ FROM base as grpc-builder WORKDIR /usr/src/app/ COPY ./pb/ ./proto/ -RUN python -m pip install grpcio-tools==1.48.2 +RUN python -m pip install grpcio-tools==1.56.2 RUN python -m grpc_tools.protoc -I=./proto/ --python_out=./ --grpc_python_out=./ ./proto/demo.proto # diff --git a/src/recommendationservice/logger.py b/src/recommendationservice/logger.py index f22ed32172..0569665539 100644 --- a/src/recommendationservice/logger.py +++ b/src/recommendationservice/logger.py @@ -1,8 +1,7 @@ #!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# import logging import sys diff --git a/src/recommendationservice/metrics.py b/src/recommendationservice/metrics.py index 656433929b..51b79968ec 100644 --- a/src/recommendationservice/metrics.py +++ b/src/recommendationservice/metrics.py @@ -1,9 +1,7 @@ #!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# - def init_metrics(meter): diff --git a/src/recommendationservice/recommendation_server.py b/src/recommendationservice/recommendation_server.py index 88f03f368c..d8b3a0f036 100644 --- a/src/recommendationservice/recommendation_server.py +++ b/src/recommendationservice/recommendation_server.py @@ -1,7 +1,8 @@ +#!/usr/bin/python + # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -#!/usr/bin/python -# + # Python import os diff --git a/src/recommendationservice/requirements.txt b/src/recommendationservice/requirements.txt index 85d0901cde..ecdc4621e8 100644 --- a/src/recommendationservice/requirements.txt +++ b/src/recommendationservice/requirements.txt @@ -1,7 +1,7 @@ -grpcio-health-checking==1.43.0 -grpcio==1.51.3 -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 +grpcio-health-checking==1.56.2 +grpcio==1.56.2 +opentelemetry-distro==0.40b0 +opentelemetry-exporter-otlp-proto-grpc==1.19.0 +python-dotenv==1.0.0 +python-json-logger==2.0.7 +psutil==5.9.5 # Importing this will also import opentelemetry-instrumentation-system-metrics when running opentelemetry-bootstrap