From 57fdce52d282198b3e36d59be2de9ecd89e0f51a Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Wed, 18 Nov 2020 01:33:01 +0530 Subject: [PATCH] Fix span name for aiopg --- .../instrumentation/aiopg/aiopg_integration.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/aiopg_integration.py b/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/aiopg_integration.py index 14f986da0..982423756 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/aiopg_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/aiopg_integration.py @@ -101,9 +101,16 @@ class AsyncTracedCursor(TracedCursor): *args: typing.Tuple[typing.Any, typing.Any], **kwargs: typing.Dict[typing.Any, typing.Any] ): + name = "" + if len(args) > 0 and args[0]: + name = args[0] + elif self._db_api_integration.database: + name = self._db_api_integration.database + else: + name = self._db_api_integration.name with self._db_api_integration.get_tracer().start_as_current_span( - self._db_api_integration.name, kind=SpanKind.CLIENT + name, kind=SpanKind.CLIENT ) as span: self._populate_span(span, *args) try: