Skip to content
Draft
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions postgres/datadog_checks/postgres/statement_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ def _collect_plan_for_statement(self, row):
if explain_err_code:
collection_errors = [{'code': explain_err_code.value, 'message': err_msg if err_msg else None}]

plan_type = "explain"
if explain_err_code == DBExplainError.explained_with_prepared_statement:
plan_type = "explain_generic"

raw_plan, normalized_plan, obfuscated_plan, plan_signature, raw_plan_signature = None, None, None, None, None
if plan_dict:
raw_plan = json.dumps(plan_dict)
Expand Down Expand Up @@ -916,6 +920,8 @@ def _collect_plan_for_statement(self, row):
"definition": obfuscated_plan,
"signature": plan_signature,
"collection_errors": collection_errors,
"source": "datadog_agent",
"type": plan_type
},
"query_signature": row['query_signature'],
"resource_hash": row['query_signature'],
Expand Down
Loading