-
Notifications
You must be signed in to change notification settings - Fork 63
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
feature: Add .NET 8+ support for System.Data.Odbc #2948
base: main
Are you sure you want to change the base?
Conversation
* SqlWrapperHelper unit tests * Working integration tests for ODBC instrumentation * Remove commented-out copy-pasted code * PR feedback
Also fix bug where server/hostname string with port included (e.g. "myservername:1234") wasn't handled correctly
.../Agent/IntegrationTests/SharedApplications/Common/MFALatestPackages/MFALatestPackages.csproj
Show resolved
Hide resolved
if (host == null) return null; | ||
|
||
// Example of want we would need to process: win-database.pdx.vm.datanerd.us,1433\SQLEXPRESS | ||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This try/catch block seems unnecessary. Looks like the code is already handling all the edge cases that are possible.
portPathOrId = ConnectionStringParserHelper.GetKeyValuePair(_connectionStringBuilder, _hostKeys)?.Value; | ||
if (portPathOrId == null) return null; | ||
|
||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here. I'm not seeing any execution path where an exception could be thrown.
var endOfValue = portPathOrId.Contains(StringSeparators.BackslashChar) | ||
? portPathOrId.IndexOf(StringSeparators.BackslashChar) | ||
: portPathOrId.Length; | ||
return (startOfValue > 0) ? portPathOrId.Substring(startOfValue, endOfValue - startOfValue) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ternary here (and on line 74 above) isn't necessary -- startOfValue
will always be > 0.
var instanceName = ConnectionStringParserHelper.GetKeyValuePair(_connectionStringBuilder, _hostKeys)?.Value; | ||
if (instanceName == null) return null; | ||
|
||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary try/catch here also
{ | ||
var startOfValue = instanceName.IndexOf(StringSeparators.BackslashChar) + 1; | ||
var endOfValue = instanceName.Length; | ||
return (startOfValue > 0) ? instanceName.Substring(startOfValue, endOfValue - startOfValue) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ternary here is also unnecessary.
Description
This PR adds datastore instrumentation for
System.Data.Odbc
, which is Microsoft's implementation of ODBC access for modern .NET. This resolves #2922.Note that the instrumentation is less complete than for ODBC operations in .NET Framework applications. In particular, the following things that are instrumented in .NET Framework are not instrumented for .NET 8+:
Connect/ConnectAsync
callsAuthor Checklist
Performance testing completed with satisfactory results (if required)N/AReviewer Checklist