-
Notifications
You must be signed in to change notification settings - Fork 314
fix generic url parsing in jdbc instrumentation #9777
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
beb5d2b
fix generic url parsing in jdbc instrumentation
vandonr f992419
add test
vandonr b776e20
extract DBM specific test to a different class
vandonr de2a6c3
fix existing test that was not asserting the correct thing
vandonr 0d5b2e4
just realized there was already a test on this that I could reuse
vandonr dbc4226
Revert "extract DBM specific test to a different class"
vandonr 807915d
Revert "add test"
vandonr 8a4ac88
fix other test
vandonr 45b635c
fix lasts tests
vandonr 2465781
Merge branch 'master' into vandonr/fix
vandonr fc22174
Merge branch 'master' into vandonr/fix
vandonr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import static datadog.trace.agent.test.utils.TraceUtils.basicSpan | ||
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace | ||
import static datadog.trace.api.config.TraceInstrumentationConfig.DB_CLIENT_HOST_SPLIT_BY_INSTANCE | ||
import static datadog.trace.api.config.TraceInstrumentationConfig.JDBC_POOL_WAITING_ENABLED | ||
|
||
import com.mchange.v2.c3p0.ComboPooledDataSource | ||
import com.zaxxer.hikari.HikariConfig | ||
import com.zaxxer.hikari.HikariDataSource | ||
|
@@ -6,18 +11,6 @@ import datadog.trace.api.Config | |
import datadog.trace.api.DDSpanTypes | ||
import datadog.trace.bootstrap.instrumentation.api.InstrumentationTags | ||
import datadog.trace.bootstrap.instrumentation.api.Tags | ||
import org.apache.commons.dbcp2.BasicDataSource | ||
import org.apache.commons.pool2.PooledObject | ||
import org.apache.commons.pool2.PooledObjectFactory | ||
import org.apache.commons.pool2.impl.DefaultPooledObject | ||
import org.apache.commons.pool2.impl.GenericObjectPool | ||
import org.apache.derby.jdbc.EmbeddedDataSource | ||
import org.h2.jdbcx.JdbcDataSource | ||
import spock.lang.Shared | ||
import test.TestConnection | ||
import test.WrappedConnection | ||
|
||
import javax.sql.DataSource | ||
import java.sql.CallableStatement | ||
import java.sql.Connection | ||
import java.sql.Driver | ||
|
@@ -28,11 +21,17 @@ import java.sql.SQLTimeoutException | |
import java.sql.SQLTransientConnectionException | ||
import java.sql.Statement | ||
import java.time.Duration | ||
|
||
import static datadog.trace.agent.test.utils.TraceUtils.basicSpan | ||
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace | ||
import static datadog.trace.api.config.TraceInstrumentationConfig.DB_CLIENT_HOST_SPLIT_BY_INSTANCE | ||
import static datadog.trace.api.config.TraceInstrumentationConfig.JDBC_POOL_WAITING_ENABLED | ||
import javax.sql.DataSource | ||
import org.apache.commons.dbcp2.BasicDataSource | ||
import org.apache.commons.pool2.PooledObject | ||
import org.apache.commons.pool2.PooledObjectFactory | ||
import org.apache.commons.pool2.impl.DefaultPooledObject | ||
import org.apache.commons.pool2.impl.GenericObjectPool | ||
import org.apache.derby.jdbc.EmbeddedDataSource | ||
import org.h2.jdbcx.JdbcDataSource | ||
import spock.lang.Shared | ||
import test.TestConnection | ||
import test.WrappedConnection | ||
|
||
abstract class JDBCInstrumentationTest extends VersionedNamingTestBase { | ||
|
||
|
@@ -724,14 +723,15 @@ abstract class JDBCInstrumentationTest extends VersionedNamingTestBase { | |
errored false | ||
measured true | ||
tags { | ||
"$Tags.PEER_HOSTNAME" "localhost" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because of the fix, the url that is "testdb://localhost" now gets correctly parsed, which is used to fill the |
||
"$Tags.COMPONENT" "java-jdbc-statement" | ||
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT | ||
"$Tags.DB_TYPE" database | ||
"$Tags.DB_OPERATION" CharSequence | ||
if (addDbmTag) { | ||
"$InstrumentationTags.DBM_TRACE_INJECTED" true | ||
} | ||
defaultTagsNoPeerService() | ||
defaultTags() | ||
} | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
here we are using the correct variable