From b3560c34b456f96d0b8cb029f8d22f93805275ff Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Tue, 13 Feb 2024 19:42:40 -0500 Subject: [PATCH] Add otel to local dev --- tasks.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 64eb82a..56b42a8 100644 --- a/tasks.py +++ b/tasks.py @@ -53,5 +53,12 @@ def build_image(c, dev=True, registry_user=None, registry_token=None, push=False @task -def serve_dev(c): - c.run("FLASK_APP=./learn_otel/app.py flask run -p 8888") +def serve_dev(c, otel=False): + if otel: + c.run( + "FLASK_APP=./learn_otel/app.py OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true " + "opentelemetry-instrument --traces_exporter console --metrics_exporter console --logs_exporter console " + "--service_name dice-server flask run -p 8888" + ) + else: + c.run("FLASK_APP=./learn_otel/app.py flask run -p 8888")