Skip to content

Conversation

@sudarshan12s
Copy link
Contributor

@sudarshan12s sudarshan12s commented Dec 20, 2024

Add Oracledb instrumentation

Which problem is this PR solving?

Adding instrumentation support for node-oracledb applications connecting to Oracle database.

Short description of the changes

From node-oracledb version 6.7 onwards, oracledb module exports a class,
TraceHandlerBase which simulates interface kind of functionality with abstract methods to be overwritten by the derived class.

The current OT module derives this class TraceHandlerBase and implements abstract methods; It uses setTraceInstance method of oracledb module to register this new derived class OracleTelemetryTraceHandler
These methods are invoked by oracledb module providing the traceContext which is used to dump the data in to the span after converting to standard span attributes.

Following are the abstract methods implemented:

  • onEnterFn -> It gets invoked by oracledb module when application invokes getConnection to create a connection to
    database or execute method to run a sql. It is invoked before invoking the public API calls made by application.
  • onExitFn -> It gets invoked after the public API call is completed with success/failure.
  • onBeginRoundTrip -> It gets invoked before round trip to database which was triggered as part of public API.
  • onEndRoundTrip -> It gets invoked after round trip to database completes which was triggered as part of public API..

Add Oracledb instrumentation
@sudarshan12s sudarshan12s requested a review from a team as a code owner December 20, 2024 17:52
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 20, 2024

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing all comments. It's almost there :)
I added a few more comments, all easy to fix!


import {
ATTR_SERVER_ADDRESS,
SEMATTRS_NET_TRANSPORT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing a lot of SEMATTRS_ here

@sudarshan12s sudarshan12s requested a review from maryliag April 23, 2025 03:34
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this!

@sharadraju
Copy link

Thanks @maryliag and @blumamir for your review and thanks @marcalff for the sponsor support!
@sudarshan12s Nice work!

@sudarshan12s
Copy link
Contributor Author

Great work on this!

Thank you so much...

@sudarshan12s
Copy link
Contributor Author

sudarshan12s commented Apr 29, 2025

It looks like the failed test may be flaky (intermittently asserting different connection counts). Would it be possible to either ignore this failure for this PR, or re-run the CI?


MongoDBInstrumentation-Metrics
       Should add connection usage metrics:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

2 !== 1

      + expected - actual

      -2
      +1
      
      at Context.<anonymous> (test/mongodb-v4-v5-v6.metrics.test.ts:127:12)


Thanks for your time!

@sudarshan12s
Copy link
Contributor Author

It looks like the failed test may be flaky (intermittently asserting different connection counts). Would it be possible to either ignore this failure for this PR, or re-run the CI?


MongoDBInstrumentation-Metrics
       Should add connection usage metrics:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

2 !== 1

      + expected - actual

      -2
      +1
      
      at Context.<anonymous> (test/mongodb-v4-v5-v6.metrics.test.ts:127:12)

Thanks for your time!

@onurtemizkan, I believe this is a flaky error and can be safely ignored.

@blumamir blumamir merged commit e8e3cbd into open-telemetry:main May 7, 2025
29 of 30 checks passed
@dyladan dyladan mentioned this pull request May 7, 2025
@sharadraju
Copy link

Thanks @blumamir for merging this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment