Skip to content
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

feat(oracledb): Add support for Oracle DB instrumentation #2612

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

sudarshan12s
Copy link

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..

Note:

  • As part of CI, i was getting regex ReDos for comment inside files. which can be ignored . I modified to make it safe..

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

linux-foundation-easycla bot commented Dec 20, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@raphael-theriault-swi raphael-theriault-swi left a comment

Choose a reason for hiding this comment

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

Could you rename the new types to TitleCase to follow the rest of the code ?

@sudarshan12s
Copy link
Author

Could you rename the new types to TitleCase to follow the rest of the code ?

Yes renamed to TitleCase for types and internal-types exported.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 98.81657% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.95%. Comparing base (21e1331) to head (c299caa).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...pentelemetry-instrumentation-oracledb/src/utils.ts 98.31% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2612      +/-   ##
==========================================
+ Coverage   90.78%   90.95%   +0.16%     
==========================================
  Files         169      172       +3     
  Lines        8055     8224     +169     
  Branches     1643     1693      +50     
==========================================
+ Hits         7313     7480     +167     
- Misses        742      744       +2     
Files with missing lines Coverage Δ
...tapackages/auto-instrumentations-node/src/utils.ts 98.24% <100.00%> (+0.01%) ⬆️
...elemetry-instrumentation-oracledb/src/constants.ts 100.00% <100.00%> (ø)
...ry-instrumentation-oracledb/src/instrumentation.ts 100.00% <100.00%> (ø)
...pentelemetry-instrumentation-oracledb/src/utils.ts 98.31% <98.31%> (ø)

@sudarshan12s
Copy link
Author

The earlier triggered CI failure seems to be this. It looks related to some package version dependency , package-lock.json updates and not the changes in PR. Please suggest if there are some changes needed from my side.


 Exception during run: /home/runner/work/opentelemetry-js-contrib/opentelemetry-js-contrib/node_modules/@aws-sdk/client-sqs/dist-cjs/index.js:185
  static {
         ^

SyntaxError: Unexpected token '{'

@sudarshan12s
Copy link
Author

Please help me with steps for updating package-lock.json . This PR lock file package-lock.json differs from main and i am not able to keep it in sync easily..

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