Skip to content

Conversation

@XSAM
Copy link
Member

@XSAM XSAM commented Aug 27, 2025

Description

Calling ObfuscateSQLStringWithOptions method with an empty optsStr is not the ideal way to use this obfuscate library.

See, https://github.com/DataDog/datadog-agent/blob/928f3f3972c57296ca37e65e344489e2dd407dee/pkg/obfuscate/sql.go#L315-L323

// Ideally we should never fallback to this because it's expensive
log.Warn("falling back to JSON marshalling of SQLConfig options, this should be avoided if possible")

And, this also triggers a memory leak issue in log.Warn from https://pkg.go.dev/github.com/DataDog/datadog-agent/pkg/util/log

Changes

This PR uses the correct and efficient way to call the obfuscate package, and it also resolves the memory leak issue from #42302

Link to tracking issue

Fixes #42302

@XSAM XSAM requested review from a team and crobert-1 as code owners August 27, 2025 21:22
@github-actions github-actions bot added receiver/sqlserver Run Windows Enable running windows test on a PR labels Aug 27, 2025
@github-actions github-actions bot requested a review from sincejune August 27, 2025 21:22
@atoulme atoulme merged commit ad0dd1b into open-telemetry:main Aug 27, 2025
217 of 221 checks passed
@github-actions github-actions bot added this to the next release milestone Aug 27, 2025
@XSAM XSAM deleted the fix-sqlserver-memory-leaking-based-on-0.132.0 branch August 28, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

receiver/sqlserver Run Windows Enable running windows test on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[receiver/sqlserver] Memory leak when using top queries

4 participants