-
Notifications
You must be signed in to change notification settings - Fork 16
Fallback to db.connection_string for sql backend url #84
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
Conversation
| if (DbSemanticConventionUtils.isSqlTypeBackendForOtelFormat(attributeFieldMap)) { | ||
| Optional<String> sqlUrl = DbSemanticConventionUtils.getBackendURIForOtelFormat(attributeFieldMap); | ||
| sqlUrl.ifPresent(s -> eventBuilder.getSqlBuilder().setUrl(s)); | ||
| if (sqlUrl.isPresent()) { |
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.
Can't we use getSqlURI form DbSemanticsConvention?
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.
That accepts Event object, we have an attribute map here. I can create one more method there. Should I?
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.
Yes, it's a common code, and it's difficult to maintain.
|
Some unit tests? |
Codecov Report
@@ Coverage Diff @@
## main #84 +/- ##
============================================
+ Coverage 68.68% 68.99% +0.31%
Complexity 814 814
============================================
Files 83 83
Lines 3442 3441 -1
Branches 367 367
============================================
+ Hits 2364 2374 +10
+ Misses 933 922 -11
Partials 145 145
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@rish691 snyk scan is failing. |
| } | ||
| if (SpanAttributeUtils.containsAttributeKey( | ||
| event, OTelDbSemanticConventions.DB_CONNECTION_STRING.getValue())) { | ||
| String url = SpanAttributeUtils.getStringAttribute( |
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.
Don't we have to convert this String to URI object?
try {
new URI(URL)
} catch (Mulformed) {
}
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.
done
I guess Buchi fixed it here: #87 (comment) |
| event, OTelDbSemanticConventions.DB_CONNECTION_STRING.getValue())) { | ||
| String url = SpanAttributeUtils.getStringAttribute( | ||
| event, OTelDbSemanticConventions.DB_CONNECTION_STRING.getValue()); | ||
| if (!isValidURI(url)) { |
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.
nit, if you do isValirURI(url) { return Optional.of(url); } I think you can just keep the last return Optional.empty().
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, I will do it in a subsequent pr.
| } | ||
|
|
||
| @Test | ||
| public void testGetSqlUrlForOtelFormat() { |
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 wonder if we need some test where the user/password are included in the URL. Not sure tif that is a thing among jdbc.
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.
You mean if username/pwd is present we should drop the url?
|
Late to the party @rish691 but left you a couple of comments. |
No description provided.