From 8a889b2a2964877d9248c667bea51bf1876c45ce Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Fri, 17 May 2024 13:21:44 -0500 Subject: [PATCH 1/5] Prevent ddtrace from patching all. Do not patch all. Prevent graphql from being patched. When grapqhl is patched and indexd as dev dependency is used by gdcapi, gdcapi tests fail because gdcapi's graphql gets patched. --- indexd/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexd/app.py b/indexd/app.py index 60833387..10d9d963 100644 --- a/indexd/app.py +++ b/indexd/app.py @@ -15,7 +15,7 @@ def app_init(app, settings=None): app.logger.addHandler(cdislogging.get_stream_handler()) - ddtrace.patch_all() + ddtrace.patch(graphql=False) if not settings: from .default_settings import settings app.config.update(settings["config"]) From 8d1917acff4e3e183f03c843f8bd5761ead96eca Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Fri, 17 May 2024 13:24:28 -0500 Subject: [PATCH 2/5] Neither elasticsearch nor graphql are used so they are not patched by default. --- indexd/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexd/app.py b/indexd/app.py index 10d9d963..4569352c 100644 --- a/indexd/app.py +++ b/indexd/app.py @@ -15,7 +15,7 @@ def app_init(app, settings=None): app.logger.addHandler(cdislogging.get_stream_handler()) - ddtrace.patch(graphql=False) + ddtrace.patch(flask=True, psycopg=True, sqlalchemy=True) if not settings: from .default_settings import settings app.config.update(settings["config"]) From e19e31a9a2f7aab4110e7baa77a1de186b133715 Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Fri, 17 May 2024 13:48:40 -0500 Subject: [PATCH 3/5] Patch all can take module=False to disable. Disable graphql only. --- indexd/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexd/app.py b/indexd/app.py index 4569352c..39888f1e 100644 --- a/indexd/app.py +++ b/indexd/app.py @@ -15,7 +15,7 @@ def app_init(app, settings=None): app.logger.addHandler(cdislogging.get_stream_handler()) - ddtrace.patch(flask=True, psycopg=True, sqlalchemy=True) + ddtrace.patch_all(grapqh=False) if not settings: from .default_settings import settings app.config.update(settings["config"]) From 92ce48faf8eec3cbb7801d5396ff88afa9be654e Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Fri, 17 May 2024 14:02:01 -0500 Subject: [PATCH 4/5] Typo. --- indexd/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexd/app.py b/indexd/app.py index 39888f1e..166fd286 100644 --- a/indexd/app.py +++ b/indexd/app.py @@ -15,7 +15,7 @@ def app_init(app, settings=None): app.logger.addHandler(cdislogging.get_stream_handler()) - ddtrace.patch_all(grapqh=False) + ddtrace.patch_all(graphql=False) if not settings: from .default_settings import settings app.config.update(settings["config"]) From 547d5f73302f80e47ef6e2128600a55e1f1446c3 Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Fri, 17 May 2024 14:09:13 -0500 Subject: [PATCH 5/5] Add comments. --- indexd/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indexd/app.py b/indexd/app.py index 166fd286..becf31ae 100644 --- a/indexd/app.py +++ b/indexd/app.py @@ -15,6 +15,10 @@ def app_init(app, settings=None): app.logger.addHandler(cdislogging.get_stream_handler()) + # TODO: When indexd is used by gdcapi (as dev dep during tests), + # ddtrace patches graphql because of patch_all(). To prevent that + # we explicitly excluded. At any rate, graphql is NOT used by + # indexd so it's safe to disable it. ddtrace.patch_all(graphql=False) if not settings: from .default_settings import settings