-
Notifications
You must be signed in to change notification settings - Fork 100
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
Adds enhanced metadata parsing for Oracle DBs #270
Conversation
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(sanitizedUrl); |
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.
Is this sufficient to only hash the sanitized URL? Originally I hashed all 4 fields, but checkStyle called me out for using hash
instead of hashCode
.
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.
Did you use Objects.hash(sanitizedUrl, user, host, dbName)
(varargs)? That's pretty weird. Maybe you can use IntelliJ to generate equals / hashcode so it just uses multiply / add directly
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.
Yeah, Objects.hash()
is actually what IntelliJ generate used by default.
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.
I think you can use "IntelliJ default" to get the multiply version
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.
Ohhh I had never seen that before, thanks for the tip!
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(sanitizedUrl); |
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.
Did you use Objects.hash(sanitizedUrl, user, host, dbName)
(varargs)? That's pretty weird. Maybe you can use IntelliJ to generate equals / hashcode so it just uses multiply / add directly
|
||
/** | ||
* Class for parsing Oracle database connection URLs and extracting useful metadata. | ||
* Adapted from the OpenTelemetry JdbcConnectionUrlParser class under the Apache 2.0 license. |
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.
For all the classes adapted, can you add a second copyright header with the copy from OTel?
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.
Sure, good callout.
Codecov Report
@@ Coverage Diff @@
## master #270 +/- ##
============================================
+ Coverage 58.83% 59.40% +0.56%
- Complexity 1169 1207 +38
============================================
Files 129 131 +2
Lines 4910 5040 +130
Branches 552 585 +33
============================================
+ Hits 2889 2994 +105
- Misses 1761 1773 +12
- Partials 260 273 +13
Continue to review full report at Codecov.
|
Description of changes:
This change enables users of the X-Ray SDK and agent who query Oracle DBs to have more accurate metadata by directly parsing the DB connection URL. Much of the parsing logic is adapted from OpenTelemetry, and attributed as such.
Since we are likely not going to add this advanced support for other DB providers, I mostly special-cased the Oracle logic as opposed to the more generic approach that OTel takes for simplicity. I always preferred the info from parsing over the info from
DatabaseMetaData
where applicable.This also fixes a more general issue with DB subsegment naming where we didn't do sufficient null-checking.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.