Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e44ac88
add opentelemetry-instrumentation-asyncpg dependency repo-wide
bisgaard-itis Jul 7, 2025
934fdde
add asyncpg instrumention in aiohttp case
bisgaard-itis Jul 7, 2025
eeb2b6e
clean up tracing tests
bisgaard-itis Jul 7, 2025
84b26fa
minor cleanup
bisgaard-itis Jul 7, 2025
fe380c6
add decorator to generate pyinstrument profile span
bisgaard-itis Jul 7, 2025
388728d
ensure entire profile is shown
bisgaard-itis Jul 7, 2025
08dbf7b
minor simplification
bisgaard-itis Jul 7, 2025
a5dbadc
experiment a bit with new function decorator
bisgaard-itis Jul 8, 2025
a8931d2
add test for handler decorator
bisgaard-itis Jul 8, 2025
01920eb
parametrize test to cover more cases
bisgaard-itis Jul 8, 2025
acb7a99
cleanup
bisgaard-itis Jul 8, 2025
51f810a
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 8, 2025
36718e6
remove comment
bisgaard-itis Jul 8, 2025
31546e4
remove decorator again
bisgaard-itis Jul 8, 2025
0560b2d
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 8, 2025
c464840
enable tracing on local deployment
bisgaard-itis Jul 8, 2025
acd8c13
add profile spans for debugging together with @pcrespov
bisgaard-itis Jul 8, 2025
0df115d
fix types
bisgaard-itis Jul 8, 2025
f6f82d4
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 9, 2025
9b41e2f
remove profile spans to see if they are causing tests to fail
bisgaard-itis Jul 9, 2025
48ff90a
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 9, 2025
78f2200
add tracing when testing storage
bisgaard-itis Jul 9, 2025
b128fe2
improve fixtures to mock tracing
bisgaard-itis Jul 9, 2025
44e7632
readd profile spans
bisgaard-itis Jul 9, 2025
d0e5b63
Merge branch 'master' into 8065-instrument-asyncpg
mrnicegyu11 Jul 9, 2025
121313f
Revert "readd profile spans"
bisgaard-itis Jul 9, 2025
99da31d
Merge branch '8065-instrument-asyncpg' of github.com:bisgaard-itis/os…
bisgaard-itis Jul 9, 2025
a3b8d6b
add profile span for @matusdrobuliak66
bisgaard-itis Jul 9, 2025
4197d4c
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 9, 2025
5650206
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 9, 2025
fbc0aee
add profile span to permissions endpoint
bisgaard-itis Jul 10, 2025
c04e853
Merge branch 'master' into 8065-instrument-asyncpg
bisgaard-itis Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .env-devel
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ AGENT_VOLUMES_CLEANUP_S3_ENDPOINT=http://172.17.0.1:9001
AGENT_VOLUMES_CLEANUP_S3_PROVIDER=MINIO
AGENT_VOLUMES_CLEANUP_S3_REGION=us-east-1
AGENT_VOLUMES_CLEANUP_S3_SECRET_KEY=12345678
AGENT_TRACING=null
AGENT_TRACING={}

API_SERVER_DEV_FEATURES_ENABLED=0
API_SERVER_LOGLEVEL=INFO
API_SERVER_PROFILING=1
API_SERVER_TRACING=null
API_SERVER_TRACING={}
TRAEFIK_API_SERVER_INFLIGHTREQ_AMOUNT=25

AUTOSCALING_DASK=null
Expand All @@ -35,7 +35,7 @@ AUTOSCALING_LOGLEVEL=INFO
AUTOSCALING_NODES_MONITORING=null
AUTOSCALING_POLL_INTERVAL="00:00:10"
AUTOSCALING_SSM_ACCESS=null
AUTOSCALING_TRACING=null
AUTOSCALING_TRACING={}

AWS_S3_CLI_S3=null

Expand All @@ -47,7 +47,7 @@ CATALOG_PORT=8000
CATALOG_PROFILING=1
CATALOG_SERVICES_DEFAULT_RESOURCES='{"CPU": {"limit": 0.1, "reservation": 0.1}, "RAM": {"limit": 2147483648, "reservation": 2147483648}}'
CATALOG_SERVICES_DEFAULT_SPECIFICATIONS='{}'
CATALOG_TRACING=null
CATALOG_TRACING={}

CELERY_RESULT_EXPIRES=P7D

Expand All @@ -63,7 +63,7 @@ CLUSTERS_KEEPER_MAX_MISSED_HEARTBEATS_BEFORE_CLUSTER_TERMINATION=5
CLUSTERS_KEEPER_PRIMARY_EC2_INSTANCES=null
CLUSTERS_KEEPER_TASK_INTERVAL=00:00:30
CLUSTERS_KEEPER_WORKERS_EC2_INSTANCES=null
CLUSTERS_KEEPER_TRACING=null
CLUSTERS_KEEPER_TRACING={}

DASK_SCHEDULER_HOST=dask-scheduler
DASK_SCHEDULER_PORT=8786
Expand All @@ -83,7 +83,7 @@ DIRECTOR_PUBLISHED_HOST_NAME="127.0.0.1:9081"
DIRECTOR_REGISTRY_CACHING_TTL=00:15:00
DIRECTOR_REGISTRY_CACHING=True
DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=null
DIRECTOR_TRACING=null
DIRECTOR_TRACING={}

DOCKER_API_PROXY_HOST=docker-api-proxy
DOCKER_API_PROXY_PASSWORD=admin
Expand All @@ -98,11 +98,11 @@ EFS_GROUP_NAME=efs-group
EFS_DNS_NAME=fs-xxx.efs.us-east-1.amazonaws.com
EFS_MOUNTED_PATH=/tmp/efs
EFS_PROJECT_SPECIFIC_DATA_DIRECTORY=project-specific-data
EFS_GUARDIAN_TRACING=null
EFS_GUARDIAN_TRACING={}
EFS_DEFAULT_USER_SERVICE_SIZE_BYTES=10000

# DATCORE_ADAPTER
DATCORE_ADAPTER_TRACING=null
DATCORE_ADAPTER_TRACING={}

# DIRECTOR_V2 ----
COMPUTATIONAL_BACKEND_DEFAULT_CLUSTER_AUTH='{"type":"tls","tls_ca_file":"/home/scu/.dask/dask-crt.pem","tls_client_cert":"/home/scu/.dask/dask-crt.pem","tls_client_key":"/home/scu/.dask/dask-key.pem"}'
Expand All @@ -128,14 +128,14 @@ DYNAMIC_SIDECAR_LOG_LEVEL=DEBUG
DYNAMIC_SIDECAR_PROMETHEUS_MONITORING_NETWORKS=[]
DYNAMIC_SIDECAR_PROMETHEUS_SERVICE_LABELS={}
DYNAMIC_SIDECAR_API_SAVE_RESTORE_STATE_TIMEOUT=01:00:00
DIRECTOR_V2_TRACING=null
DIRECTOR_V2_TRACING={}

# DYNAMIC_SCHEDULER ----
DYNAMIC_SCHEDULER_LOGLEVEL=INFO
DYNAMIC_SCHEDULER_PROFILING=1
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER=0
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=01:00:00
DYNAMIC_SCHEDULER_TRACING=null
DYNAMIC_SCHEDULER_TRACING={}
DYNAMIC_SCHEDULER_UI_STORAGE_SECRET=adminadmin

FUNCTION_SERVICES_AUTHORS='{"UN": {"name": "Unknown", "email": "[email protected]", "affiliation": "unknown"}}'
Expand All @@ -158,13 +158,13 @@ INVITATIONS_PORT=8000
INVITATIONS_SECRET_KEY='REPLACE_ME_with_result__Fernet_generate_key='
INVITATIONS_SWAGGER_API_DOC_ENABLED=1
INVITATIONS_USERNAME=admin
INVITATIONS_TRACING=null
INVITATIONS_TRACING={}

LOG_FORMAT_LOCAL_DEV_ENABLED=1
LOG_FILTER_MAPPING='{"gunicorn.access":[" /v0/ ", " /v0/health "], "uvicorn.access":[" / "]}'

NOTIFICATIONS_LOGLEVEL=INFO
NOTIFICATIONS_TRACING=null
NOTIFICATIONS_TRACING={}

PAYMENTS_ACCESS_TOKEN_EXPIRE_MINUTES=30
PAYMENTS_ACCESS_TOKEN_SECRET_KEY=2c0411810565e063309be1457009fb39ce023946f6a354e6935107b57676
Expand All @@ -186,7 +186,7 @@ PAYMENTS_STRIPE_API_SECRET='REPLACE_ME_with_api_secret'
PAYMENTS_STRIPE_URL=https://api.stripe.com
PAYMENTS_SWAGGER_API_DOC_ENABLED=1
PAYMENTS_USERNAME=admin
PAYMENTS_TRACING=null
PAYMENTS_TRACING={}

POSTGRES_DB=simcoredb
POSTGRES_ENDPOINT=postgres:5432
Expand Down Expand Up @@ -227,7 +227,7 @@ RESOURCE_USAGE_TRACKER_MISSED_HEARTBEAT_CHECK_ENABLED=1
RESOURCE_USAGE_TRACKER_MISSED_HEARTBEAT_COUNTER_FAIL=6
RESOURCE_USAGE_TRACKER_MISSED_HEARTBEAT_INTERVAL_SEC=300
RESOURCE_USAGE_TRACKER_S3=null
RESOURCE_USAGE_TRACKER_TRACING=null
RESOURCE_USAGE_TRACKER_TRACING={}

# NOTE: 172.17.0.1 is the docker0 interface, which redirect from inside a container onto the host network interface.
R_CLONE_OPTION_BUFFER_SIZE=16M
Expand Down Expand Up @@ -259,7 +259,7 @@ STORAGE_HOST=storage
STORAGE_LOGLEVEL=INFO
STORAGE_PORT=8080
STORAGE_PROFILING=1
STORAGE_TRACING=null
STORAGE_TRACING={}
# STORAGE ----

SWARM_STACK_NAME=master-simcore
Expand Down Expand Up @@ -300,7 +300,7 @@ WB_GC_SOCKETIO=1
WB_GC_STATICWEB=null
WB_GC_STUDIES_DISPATCHER=null
WB_GC_TAGS=0
WB_GC_TRACING=null
WB_GC_TRACING={}
WB_GC_USERS={}
WB_GC_WALLETS=0

Expand Down Expand Up @@ -330,7 +330,7 @@ WB_DB_EL_STATICWEB=null
WB_DB_EL_STORAGE=null
WB_DB_EL_STUDIES_DISPATCHER=null
WB_DB_EL_TAGS=0
WB_DB_EL_TRACING=null
WB_DB_EL_TRACING={}
WB_DB_EL_USERS={}
WB_DB_EL_WALLETS=0

Expand Down Expand Up @@ -401,5 +401,5 @@ WEBSERVER_SOCKETIO=1
WEBSERVER_STATICWEB={}
WEBSERVER_STUDIES_DISPATCHER={}
WEBSERVER_TAGS=1
WEBSERVER_TRACING=null
WEBSERVER_TRACING={}
WEBSERVER_USERS={}
5 changes: 5 additions & 0 deletions packages/aws-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ opentelemetry-api==1.34.1
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-instrumentation
# opentelemetry-instrumentation-aio-pika
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-redis
Expand All @@ -160,12 +161,15 @@ opentelemetry-exporter-otlp-proto-http==1.34.1
opentelemetry-instrumentation==0.55b1
# via
# opentelemetry-instrumentation-aio-pika
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
opentelemetry-instrumentation-aio-pika==0.55b1
# via -r requirements/../../../packages/service-library/requirements/_base.in
opentelemetry-instrumentation-asyncpg==0.55b1
# via -r requirements/../../../packages/service-library/requirements/_base.in
opentelemetry-instrumentation-botocore==0.55b1
# via -r requirements/_base.in
opentelemetry-instrumentation-logging==0.55b1
Expand All @@ -189,6 +193,7 @@ opentelemetry-sdk==1.34.1
opentelemetry-semantic-conventions==0.55b1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-botocore
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
Expand Down
5 changes: 5 additions & 0 deletions packages/celery-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ opentelemetry-api==1.34.1
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-instrumentation
# opentelemetry-instrumentation-aio-pika
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
Expand All @@ -150,11 +151,14 @@ opentelemetry-exporter-otlp-proto-http==1.34.1
opentelemetry-instrumentation==0.55b1
# via
# opentelemetry-instrumentation-aio-pika
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-logging
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
opentelemetry-instrumentation-aio-pika==0.55b1
# via -r requirements/../../../packages/service-library/requirements/_base.in
opentelemetry-instrumentation-asyncpg==0.55b1
# via -r requirements/../../../packages/service-library/requirements/_base.in
opentelemetry-instrumentation-logging==0.55b1
# via -r requirements/../../../packages/service-library/requirements/_base.in
opentelemetry-instrumentation-redis==0.55b1
Expand All @@ -174,6 +178,7 @@ opentelemetry-sdk==1.34.1
opentelemetry-semantic-conventions==0.55b1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
# opentelemetry-instrumentation-redis
# opentelemetry-instrumentation-requests
# opentelemetry-sdk
Expand Down
23 changes: 0 additions & 23 deletions packages/notifications-library/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ idna==3.10
# via
# email-validator
# yarl
importlib-metadata==8.5.0
# via opentelemetry-api
jinja2==3.1.5
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
Expand Down Expand Up @@ -64,19 +62,6 @@ mdurl==0.1.2
# via markdown-it-py
multidict==6.1.0
# via yarl
opentelemetry-api==1.34.1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
# opentelemetry-semantic-conventions
opentelemetry-instrumentation==0.55b1
# via opentelemetry-instrumentation-asyncpg
opentelemetry-instrumentation-asyncpg==0.55b1
# via -r requirements/../../../packages/postgres-database/requirements/_base.in
opentelemetry-semantic-conventions==0.55b1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
orjson==3.10.15
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
Expand All @@ -92,8 +77,6 @@ orjson==3.10.15
# -r requirements/../../../packages/models-library/requirements/_base.in
# -r requirements/../../../packages/postgres-database/requirements/../../../packages/common-library/requirements/_base.in
# -r requirements/../../../packages/settings-library/requirements/../../../packages/common-library/requirements/_base.in
packaging==24.2
# via opentelemetry-instrumentation
propcache==0.3.0
# via yarl
psycopg2-binary==2.9.10
Expand Down Expand Up @@ -187,15 +170,9 @@ types-python-dateutil==2.9.0.20241206
typing-extensions==4.14.1
# via
# alembic
# opentelemetry-api
# opentelemetry-semantic-conventions
# pydantic
# pydantic-core
# pydantic-extra-types
# typer
wrapt==1.17.2
# via opentelemetry-instrumentation
yarl==1.18.3
# via -r requirements/../../../packages/postgres-database/requirements/_base.in
zipp==3.21.0
# via importlib-metadata
1 change: 0 additions & 1 deletion packages/notifications-library/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ mypy-extensions==1.1.0
# via mypy
packaging==24.2
# via
# -c requirements/_base.txt
# pytest
# pytest-sugar
pathspec==0.12.1
Expand Down
1 change: 0 additions & 1 deletion packages/notifications-library/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ nodeenv==1.9.1
# via pre-commit
packaging==24.2
# via
# -c requirements/_base.txt
# -c requirements/_test.txt
# black
# build
Expand Down
1 change: 0 additions & 1 deletion packages/postgres-database/requirements/_base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
--requirement ../../../packages/common-library/requirements/_base.in

alembic
opentelemetry-instrumentation-asyncpg
pydantic
sqlalchemy[postgresql_psycopg2binary,postgresql_asyncpg] # SEE extras in https://github.com/sqlalchemy/sqlalchemy/blob/main/setup.cfg#L43
yarl
23 changes: 0 additions & 23 deletions packages/postgres-database/requirements/_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ greenlet==3.1.1
# via sqlalchemy
idna==3.10
# via yarl
importlib-metadata==8.5.0
# via opentelemetry-api
mako==1.3.10
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
Expand All @@ -19,26 +17,11 @@ markupsafe==3.0.2
# via mako
multidict==6.1.0
# via yarl
opentelemetry-api==1.34.1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
# opentelemetry-semantic-conventions
opentelemetry-instrumentation==0.55b1
# via opentelemetry-instrumentation-asyncpg
opentelemetry-instrumentation-asyncpg==0.55b1
# via -r requirements/_base.in
opentelemetry-semantic-conventions==0.55b1
# via
# opentelemetry-instrumentation
# opentelemetry-instrumentation-asyncpg
orjson==3.10.15
# via
# -c requirements/../../../packages/common-library/requirements/../../../requirements/constraints.txt
# -c requirements/../../../requirements/constraints.txt
# -r requirements/../../../packages/common-library/requirements/_base.in
packaging==24.2
# via opentelemetry-instrumentation
propcache==0.3.0
# via yarl
psycopg2-binary==2.9.10
Expand All @@ -63,14 +46,8 @@ sqlalchemy==1.4.54
typing-extensions==4.14.1
# via
# alembic
# opentelemetry-api
# opentelemetry-semantic-conventions
# pydantic
# pydantic-core
# pydantic-extra-types
wrapt==1.17.2
# via opentelemetry-instrumentation
yarl==1.18.3
# via -r requirements/_base.in
zipp==3.21.0
# via importlib-metadata
4 changes: 1 addition & 3 deletions packages/postgres-database/requirements/_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ mypy==1.16.1
mypy-extensions==1.1.0
# via mypy
packaging==24.2
# via
# -c requirements/_base.txt
# pytest
# via pytest
pathspec==0.12.1
# via mypy
pluggy==1.5.0
Expand Down
1 change: 0 additions & 1 deletion packages/postgres-database/requirements/_tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ nodeenv==1.9.1
# via pre-commit
packaging==24.2
# via
# -c requirements/_base.txt
# -c requirements/_test.txt
# black
# build
Expand Down
38 changes: 38 additions & 0 deletions packages/pytest-simcore/src/pytest_simcore/tracing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pytest
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
from pytest_mock import MockerFixture


@pytest.fixture
async def setup_tracing_fastapi(
mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch
) -> InMemorySpanExporter:
memory_exporter = InMemorySpanExporter()
span_processor = SimpleSpanProcessor(memory_exporter)
mocker.patch(
"servicelib.fastapi.tracing._create_span_processor", return_value=span_processor
)

monkeypatch.setenv(
"TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT", "http://opentelemetry-collector"
)
monkeypatch.setenv("TRACING_OPENTELEMETRY_COLLECTOR_PORT", "4318")
return memory_exporter


@pytest.fixture
async def setup_tracing_aiohttp(
mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch
) -> InMemorySpanExporter:
memory_exporter = InMemorySpanExporter()
span_processor = SimpleSpanProcessor(memory_exporter)
mocker.patch(
"servicelib.aiohttp.tracing._create_span_processor", return_value=span_processor
)

monkeypatch.setenv(
"TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT", "http://opentelemetry-collector"
)
monkeypatch.setenv("TRACING_OPENTELEMETRY_COLLECTOR_PORT", "4318")
return memory_exporter
Loading
Loading