Skip to content

Commit

Permalink
Adding OpenTelemetry collector/exporter for dev-env
Browse files Browse the repository at this point in the history
- update of docker-compose.yml and podman-compose.yml
- added Jaeger to collect traces

[CLOUDDST-20308]
  • Loading branch information
lipoja committed Sep 26, 2023
1 parent 1362a34 commit 2109e88
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,13 @@ environment variables.
This defaults to `False`. If this is set to `True`, `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_SERVICE_NAME`
must be set.
* `OTEL_EXPORTER_OTLP_ENDPOINT` - The endpoint for the OpenTelemetry exporter.
* `OTEL_SERVICE_NAME` - "iib-api"
* `OTEL_SERVICE_NAME` - "iib-api" / "iib-worker"

For more info on these environment variables, please refer to [Opentelemetry Guide](https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/)

Dev-env supports Opentelemetry tracing by default. It uses Jaeger for collecting and exporting traces.
WEB UI is accessible on port 16686 - `http://localhost:16686/`

## Configuring the Worker(s)

To configure an IIB Celery worker, create a Python file at `/etc/iib/celery.py`. The location
Expand Down
23 changes: 22 additions & 1 deletion compose-files/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ services:
# The RabbitMQ management console
- 8081:15672

jaeger:
image: jaegertracing/all-in-one
container_name: jaeger
ports:
- 4318:4318
- 16686:16686 # web
environment:
- COLLECTOR_OTLP_ENABLED=true

iib-api:
build:
context: ..
Expand All @@ -84,6 +93,11 @@ services:
FLASK_ENV: development
FLASK_APP: iib/web/wsgi.py
IIB_DEV: 'true'
# enable OpenTelemetry for dev-env
IIB_OTEL_TRACING: 'true'
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
OTEL_EXPORTER_OTLP_TRACES_INSECURE: 'true'
OTEL_SERVICE_NAME: "iib-api"
volumes:
- ../:/src:z
- ../docker/message_broker/certs:/broker-certs:ro,z
Expand All @@ -95,6 +109,7 @@ services:
depends_on:
- db
- message-broker
- jaeger

iib-worker:
build:
Expand All @@ -118,7 +133,12 @@ services:
IIB_DEV: 'true'
REGISTRY_AUTH_FILE: '/root/.docker/config.json'
REQUESTS_CA_BUNDLE: /etc/pki/tls/certs/ca-bundle.crt
# Make this privileged to be able to build container images
# Make this privileged to be able to build container images
# enable OpenTelemetry for dev-env
IIB_OTEL_TRACING: 'true'
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
OTEL_EXPORTER_OTLP_TRACES_INSECURE: 'true'
OTEL_SERVICE_NAME: "iib-worker"
privileged: true
volumes:
- ../:/src:z
Expand All @@ -133,6 +153,7 @@ services:
- registry
- minica
- memcached
- jaeger

# This is an external message broker used to publish messages about state changes
message-broker:
Expand Down
22 changes: 21 additions & 1 deletion compose-files/podman-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ services:
# The RabbitMQ management console
- 8081:15672

jaeger:
image: jaegertracing/all-in-one
container_name: jaeger
ports:
- 4318:4318
- 16686:16686 # web
environment:
- COLLECTOR_OTLP_ENABLED=true

iib-api:
build:
context: ..
Expand All @@ -83,6 +92,10 @@ services:
FLASK_ENV: development
FLASK_APP: iib/web/wsgi.py
IIB_DEV: 'true'
IIB_OTEL_TRACING: 'true'
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
OTEL_EXPORTER_OTLP_TRACES_INSECURE: 'true'
OTEL_SERVICE_NAME: "iib-api"
volumes:
- ../:/src
- ../docker/message_broker/certs:/broker-certs
Expand All @@ -94,6 +107,7 @@ services:
depends_on:
- db
- message-broker
- jaeger

iib-worker:
build:
Expand All @@ -117,7 +131,12 @@ services:
IIB_DEV: 'true'
REGISTRY_AUTH_FILE: '/root/.docker/config.json'
REQUESTS_CA_BUNDLE: /etc/pki/tls/certs/ca-bundle.crt
# Make this privileged to be able to build container images
# Make this privileged to be able to build container images
# enable OpenTelemetry for dev-env
IIB_OTEL_TRACING: 'true'
OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
OTEL_EXPORTER_OTLP_TRACES_INSECURE: 'true'
OTEL_SERVICE_NAME: "iib-worker"
privileged: true
volumes:
- ../:/src
Expand All @@ -133,6 +152,7 @@ services:
- registry
- minica
- memcached
- jaeger

# This is an external message broker used to publish messages about state changes
message-broker:
Expand Down

0 comments on commit 2109e88

Please sign in to comment.