Skip to content

Update ODBC Support to include .NET Core+ and capturing ODBC connection details. #2922

Closed
@jaffinito

Description

Describe the story, please be clear on scope of the story.

Background:

This story is a part of the work to support AWS Redshift which uses ODBC as a primary command type.

  • Redshift can also be used via ODBC with an AWS provided ODBC driver.
    • This uses the OdbcConnection/Command types with the AWS driver.
    • We instrument this (Framework), but not in the same way as SQL (ADO.NET).
    • We do not capture the connection string, meaning we don’t have the hostname.
    • That requires adding a new parser and vendor to enable fetching that data.
    • This is nearly identical to the existing SQL parser, except with additional logic for capturing the Port.
  • We do not instrument ODBC for .NET Core+
    • There is a library for it now and it supports .NET Framework 4.5.1+, netstandard2.0, and net5+
    • The only difference from the existing .NET Framework is the assembly name going from System.Data to System.Data.Odbc
    • The method signatures are identical.

Work:

Examine https://github.com/newrelic/newrelic-dotnet-agent/compare/poc/redshift-relationship for examples of the work being described. Most of the changes are complete.

  1. Update NewRelic.Agent.Extensions and the SQL instrumentation to add a dependency on System.Data.Odbc.
    a. Version can be 6.0.0 or an older one.
    b. Needs to be limited to netstandard2.0
  2. Add ODBC to DatastoreVendor in Constants.cs. This name is up for debate, but we need a new entry in order to select the correct Parser later on.
  3. Update SQLWrapperHelper.cs to relocate the IFDEF, and add support for ODBC.
  4. Add ODBC to IConnectionStringParser.cs.
  5. Implement OdbcConnectionStringParser.cs.
  6. Update the SQL Instrumentation.xml to support the new ODBC library.
  7. Update the OdbcCommandWrapper to remove the IFDEF and add connection string parsing.
  8. Add unit and integration tests. Integration tests will need to check basic ODBC connection to SQL and connection to Redshift!

Acceptance Criteria

  • ODBC wrapper works for Framework and Core+
  • ODBC connection data is parsed and reports like other SQL
  • Redshift tests updated to use ODBC driver in addition to Npgsql.

Additional context

See comments.

Estimates

M

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions