Skip to content

Fix object name field in rpc query_completion events and activity_id fields for error events #20302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 16, 2025

Conversation

azhou-datadog
Copy link
Contributor

@azhou-datadog azhou-datadog commented May 15, 2025

What does this PR do?

Fix object name field in rpc query_completion events. I was incorrectly using the field name of "procedure_name" when it is actually "object_name". Line number, object_id, and spills was also added from module_end but is not exposed in rpc events, so removed that field.

Also added activity_id_xfer field for all event types, which I discovered shows up in error events. Haven't seen it appear in query completion events, but adding it defensively.

"query_details": {
        "xe_type": "rpc_completed",
        "event_fire_timestamp": "2025-05-15T16:24:31.745Z",
        "query_start": "2025-05-15T16:24:28.435Z",
        "duration_ms": 3309.829,
        "session_id": 53,
        "request_id": 0,
        "cpu_time": 1671000,
        "page_server_reads": 0,
        "physical_reads": 0,
        "logical_reads": 5159,
        "writes": 229,
        "row_count": 1,
        "database_name": "master",
        "client_hostname": "ip-172-29-202-71",
        "client_app_name": "agent",
        "username": "datadog",
        "activity_id": "190B14E0-40D2-4617-9DC7-0A5B0B8BD6E1-3",
        "result": "OK",
        "object_name": "sp_prepexec",
        "data_stream": "",
        "connection_reset_option": "0",
        "statement": "declare @p1 int set @p1 = ? exec sp_prepexec @p1 output, N ?, N ? ? ? ? ?, N ? select @p1",
        "sql_text": ") SELECT CAST ( t.target_data AS XML ) AS target_xml FROM sys.dm_xe_sessions s JOIN sys.dm_xe_session_targets t ON s.address = t.event_session_address WHERE s.name = @P1 AND t.target_name = ?",
        "query_signature": "e0aece8e6d583f83",
        "raw_query_signature": "96c35cf452b7c2b3"
      }

Motivation

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

lu-zhengda
lu-zhengda previously approved these changes May 15, 2025
Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.47%. Comparing base (a90006e) to head (564701f).
Report is 16 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
confluent_platform ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
presto ?
solr ?
sqlserver 91.17% <94.11%> (+4.69%) ⬆️
tomcat ?
weblogic ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@azhou-datadog
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented May 15, 2025

View all feedbacks in Devflow UI.

2025-05-15 19:09:37 UTC ℹ️ Start processing command /merge


2025-05-15 19:09:45 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-05-15 23:10:04 UTC ⚠️ MergeQueue: This merge request was unqueued

devflow unqueued this merge request: It did not become mergeable within the expected time

@temporal-github-worker-1 temporal-github-worker-1 bot dismissed lu-zhengda’s stale review May 16, 2025 02:31

Review from lu-zhengda is dismissed. Related teams and files:

  • database-monitoring-agent
    • sqlserver/changelog.d/20302.fixed
    • sqlserver/datadog_checks/sqlserver/xe_collection/base.py
    • sqlserver/datadog_checks/sqlserver/xe_collection/error_events.py
    • sqlserver/datadog_checks/sqlserver/xe_collection/query_completion_events.py
    • sqlserver/tests/test_xe_collection.py
    • sqlserver/tests/xml_xe_events/attention.xml
    • sqlserver/tests/xml_xe_events/error_reported.xml
@azhou-datadog azhou-datadog changed the title Fix object name field in rpc query_completion events Fix object name field in rpc query_completion events and activity_id fields for error events May 16, 2025
@azhou-datadog azhou-datadog added this pull request to the merge queue May 16, 2025
Merged via the queue into master with commit 1b01be5 May 16, 2025
23 checks passed
@azhou-datadog azhou-datadog deleted the allen.zhou/rpc-completed-object-name branch May 16, 2025 20:28
datadog-agent-integrations-bot bot pushed a commit that referenced this pull request May 16, 2025
…fields for error events (#20302)

* include object_name, not procedure name for rpc events

* add changelog

* fix changelog

* object id and spills also not real fields

* Include duration and query start for attention events

* activity id and activity id xfer

* add activity_id_xfer to base string fields

* changelogs

* Update 20302.fixed

(cherry picked from commit 1b01be5)
github-actions bot pushed a commit to IanBrison/integrations-core that referenced this pull request May 18, 2025
…fields for error events (DataDog#20302)

* include object_name, not procedure name for rpc events

* add changelog

* fix changelog

* object id and spills also not real fields

* Include duration and query start for attention events

* activity id and activity id xfer

* add activity_id_xfer to base string fields

* changelogs

* Update 20302.fixed 1b01be5
sarah-witt pushed a commit that referenced this pull request May 19, 2025
…fields for error events (#20302) (#20317)

* include object_name, not procedure name for rpc events

* add changelog

* fix changelog

* object id and spills also not real fields

* Include duration and query start for attention events

* activity id and activity id xfer

* add activity_id_xfer to base string fields

* changelogs

* Update 20302.fixed

(cherry picked from commit 1b01be5)

Co-authored-by: Allen Zhou <allen.zhou@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants