Skip to content

Commit

Permalink
[LoadGenerator & RecommendatationService] update dependencies (open-t…
Browse files Browse the repository at this point in the history
…elemetry#988)

* Update loadgen and add metrics

* Update RecommendationService

* changelog

---------

Co-authored-by: Austin Parker <[email protected]>
  • Loading branch information
2 people authored and AlexanderWert committed Jul 24, 2023
1 parent 80902bc commit 0be402a
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 38 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion src/loadgenerator/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
40 changes: 21 additions & 19 deletions src/loadgenerator/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/recommendationservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

#
Expand Down
3 changes: 1 addition & 2 deletions src/recommendationservice/logger.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/python

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/python
#

import logging
import sys
Expand Down
4 changes: 1 addition & 3 deletions src/recommendationservice/metrics.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/python

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/python
#


def init_metrics(meter):

Expand Down
5 changes: 3 additions & 2 deletions src/recommendationservice/recommendation_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/python

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/python
#


# Python
import os
Expand Down
14 changes: 7 additions & 7 deletions src/recommendationservice/requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0be402a

Please sign in to comment.