Skip to content

Commit

Permalink
Adds counter example test for parameter capture
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdesr committed Jun 25, 2020
1 parent b1523ac commit 29d1c3f
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,28 @@ async def _transaction_execute():
StatusCanonicalCode.OK, spans[2].status.canonical_code
)

@pytest.mark.asyncpg
def test_instrumented_method_doesnt_capture_parameters(self, *_, **__):
_await(self._connection.execute("SELECT $1;", "1"))
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 1)
self.assertEqual(
StatusCanonicalCode.OK, spans[0].status.canonical_code
)
self.assertEqual(
spans[0].attributes,
{
"db.type": "sql",
"db.user": POSTGRES_USER,
# This shouldn't be set because we don't capture parameters by
# default
#
# "db.statement.parameters": "('1',)",
"db.instance": POSTGRES_DB_NAME,
"db.statement": "SELECT $1;",
},
)




Expand Down

0 comments on commit 29d1c3f

Please sign in to comment.