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: added support for couchbase v4.4.4 #1466

Merged
merged 15 commits into from
Dec 11, 2024
Merged

Conversation

abhilash-sivan
Copy link
Contributor

@abhilash-sivan abhilash-sivan commented Nov 29, 2024

refs INSTA-20554

couchnode changelog: couchbase/couchnode@v4.4.3...v4.4.4

In this update, there is code changes that affects our instrumentation.

We have instrumented cluster.analyticsQuery for analyticsServices,

await this._cluster.analyticsQuery :
https://github.com/couchbase/couchnode/blob/e855b094cd1b0140ffefc40f32a828b9134d181c/lib/analyticsindexmanager.ts#L1039

now the core implementation changed and we have to instrument all functions separately like
conn.managementAnalyticsDataverseDrop :
https://github.com/couchbase/couchnode/blob/9e3e1f1174d5e3aa29f6499c08fafd2ccbf8dbdf/lib/analyticsindexmanager.ts#L1202C21-L1202C58

@abhilash-sivan abhilash-sivan changed the title build: bumped couchbase from 4.4.3 to 4.4.4 feat: added support for couchbase 4.4.4 Dec 6, 2024
@abhilash-sivan abhilash-sivan changed the title feat: added support for couchbase 4.4.4 feat: added support for couchbase v4.4.4 Dec 6, 2024
@abhilash-sivan abhilash-sivan marked this pull request as ready for review December 6, 2024 21:21
@abhilash-sivan abhilash-sivan requested a review from a team as a code owner December 6, 2024 21:21
Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

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

Added some first comments.

packages/collector/test/tracing/database/couchbase/app.mjs Outdated Show resolved Hide resolved
packages/collector/test/tracing/database/couchbase/app.js Outdated Show resolved Hide resolved
);

// It is difficult to get exact query from couchbase after v4.4.4 release
// as they are not generating queries from JS anymore
Copy link
Contributor

Choose a reason for hiding this comment

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

qs: What will we loose if we only use the new instrumentation code?

We would loose two select statements for..?

This select statement looks a bit poor:

sql: 'SELECT'

In general: Please add comments before requesting review for changes like that to give attention to a critical change. I almost have overseen the change. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

qs: What will we loose if we only use the new instrumentation code?

If we use only the latest instrumentation code, we will lose the ability to get SQL statements.
In the new implementation, we won't get the queries explicitly.

This select statement looks a bit poor

In the old instrumentation, some queries are available in the spans. And trimming it for verifying in the test.

In the new instrumentation, we use the function name to verify the spans

Copy link
Contributor

Choose a reason for hiding this comment

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

What are the SQL statements? The test only displays sql: 'SELECT'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eg:

{
  couchbase: {
    hostname: 'couchbase://127.0.0.1:11210',
    sql: 'CREATE INDEX `i_f72ea422-b62c-11ef-9ebd-f3edefeaf7fc` ON `d_f72ea420-b62c-11ef-9ebd-f3edefeaf7fc`.`d_f72ea421-b62c-11ef-9ebd-f3edefeaf7fc` (`name`: string)'
  }
}
{
  couchbase: {
    hostname: 'couchbase://127.0.0.1:11210',
    bucket: 'projects',
    type: 'membase',
    sql: 'SELECT d.* FROM `Metadata`.`Dataset` d WHERE d.DataverseName <> "Metadata"'
  }
}

this is the actual span data being created using the old instrumentation logic.

Also in test,
span => expect(span.data.couchbase.sql).to.contain(options.sql || 'GET'),

we are checking the strings presence in the SQL statement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay. Please add a TODO for v5 to drop the instrumentation code for v443. Please add a TODO in the codebase for v5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to support both versions of v4 upon the release of v5, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes exactly 👍 We can drop the logic for 4.4.3 in v5

);

// It is difficult to get exact query from couchbase after v4.4.4 release
// as they are not generating queries from JS anymore
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay. Please add a TODO for v5 to drop the instrumentation code for v443. Please add a TODO in the codebase for v5.

@abhilash-sivan abhilash-sivan force-pushed the couchbase-update branch 2 times, most recently from 91ff5e8 to 2ed7583 Compare December 10, 2024 06:18
Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@aryamohanan aryamohanan left a comment

Choose a reason for hiding this comment

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

added minor comment, LGTM

packages/collector/test/tracing/database/couchbase/app.mjs Outdated Show resolved Hide resolved
@abhilash-sivan abhilash-sivan force-pushed the couchbase-update branch 2 times, most recently from bcf417a to cef5b54 Compare December 10, 2024 20:31
@abhilash-sivan abhilash-sivan merged commit fb06bdc into main Dec 11, 2024
@abhilash-sivan abhilash-sivan deleted the couchbase-update branch December 11, 2024 05:04
@abhilash-sivan abhilash-sivan restored the couchbase-update branch December 11, 2024 05:04
@kirrg001 kirrg001 deleted the couchbase-update branch January 15, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants