Skip to content

Commit 5a7615b

Browse files
Update instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py
Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell <[email protected]>
1 parent c1452b7 commit 5a7615b

File tree

1 file changed

+2
-8
lines changed
  • instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg

1 file changed

+2
-8
lines changed

instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,8 @@ async def _do_execute(self, func, instance, args, kwargs):
118118
tracer = getattr(asyncpg, _APPLIED)
119119

120120
exception = None
121-
params = getattr(instance, "_params", None)
122-
name = ""
123-
if args[0]:
124-
name = args[0]
125-
elif params and params.get("database"):
126-
name = params.get("database")
127-
else:
128-
name = "postgresql" # Does it ever happen?
121+
params = getattr(instance, "_params", {})
122+
name = args[0] if args[0] else params.get("database", "postgresql")
129123

130124
with tracer.start_as_current_span(name, kind=SpanKind.CLIENT) as span:
131125
if span.is_recording():

0 commit comments

Comments
 (0)