-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from newrelic/feature/external-conn/jtds
[NR-288603] Report external connections for JDBC, JTDS based Databases
- Loading branch information
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
instrumentation-security/jdbc-generic/src/main/java/java/sql/Driver_Instrumentation.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package java.sql; | ||
|
||
import com.newrelic.api.agent.security.NewRelicSecurity; | ||
import com.newrelic.api.agent.security.instrumentation.helpers.JdbcHelper; | ||
import com.newrelic.api.agent.security.schema.ExternalConnectionType; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
|
||
import java.util.Properties; | ||
|
||
@Weave(originalName = "java.sql.Driver", type = MatchType.Interface) | ||
public class Driver_Instrumentation { | ||
|
||
public Connection connect(String url, Properties info) throws SQLException { | ||
Connection connection = Weaver.callOriginal(); | ||
if (connection != null && connection.getMetaData() != null) { | ||
NewRelicSecurity.getAgent().recordExternalConnection(null, -1, connection.getMetaData().getURL(), null, ExternalConnectionType.DATABASE_CONNECTION.name(), JdbcHelper.JDBC_GENERIC); | ||
} | ||
return connection; | ||
} | ||
} |
This file contains 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 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 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