Skip to content

Emit session_id in XE events as an integer, remove unnecessary event_source field #20559

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 6 commits into from
Jun 23, 2025

Conversation

azhou-datadog
Copy link
Contributor

@azhou-datadog azhou-datadog commented Jun 20, 2025

What does this PR do?

Always emit session_id as an integer, and remove unnecessary event_source field. The event_source field may be added back, but in the "sqlserver" block in the future, if we decide to make session_name's configurable. The backend is written such that it can handle session_id as an integer or as a string, to maintain backwards compatibility, see https://github.com/DataDog/dd-go/pull/188825

Tested in local dev env.
Session ID now emits as integer:

{
...
  "sqlserver": {
    "session_id": 60,
    "xe_type": "error_reported",
    "event_fire_timestamp": "2025-06-20T18:28:52.222Z",
    "primary_sql_field": "sql_text",
    "error_number": 195,
    "message": "'REPEAT' is not a recognized built-in function name."
  }
}


Motivation

Noticed mismatch of session_id types, and noticed that event_source field was in the wrong layer of the json, and I didn't need it anyhow.

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

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 89.69%. Comparing base (5eafaa7) to head (45a528a).
Report is 4 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.36% <88.00%> (+4.63%) ⬆️
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 azhou-datadog changed the title Small XE event bug fixes Emit session_id in XE events as an integer, remove unnecessary event_source field Jun 20, 2025
@azhou-datadog azhou-datadog added this pull request to the merge queue Jun 23, 2025
Merged via the queue into master with commit ad219cd Jun 23, 2025
24 checks passed
@azhou-datadog azhou-datadog deleted the allen.zhou/session_id_fix branch June 23, 2025 18:20
Kyle-Neale pushed a commit that referenced this pull request Jun 24, 2025
…source field (#20559)

* always emit session_id as integer

* remove event source field

* linter

* fix unit tests

* linter again

* add changelog
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