Skip to content

Commit 015b56f

Browse files
committed
Add user-contributed New Relic instrumentation XML.
1 parent 7d9a1de commit 015b56f

File tree

2 files changed

+24
-32
lines changed

2 files changed

+24
-32
lines changed

contrib/NewRelic/MySqlConnector.xml

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,42 @@
55
--><extension xmlns="urn:newrelic-extension">
66
<instrumentation>
77

8-
<!-- ************************** DATABASE INSTRUMENTATION ***************************** -->
9-
108
<!-- command methods -->
11-
<tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.Sql.DbCommandExecuteReaderTracerFactory">
12-
9+
<tracerFactory name="SqlCommandTracerAsync">
1310
<!-- MySqlConnector -->
1411
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlCommand">
15-
<exactMethodMatcher methodName="ExecuteReader" parameters="System.Data.CommandBehavior" />
16-
<exactMethodMatcher methodName="ExecuteNonQuery" />
17-
<exactMethodMatcher methodName="ExecuteScalar" />
12+
<exactMethodMatcher methodName="ExecuteReaderAsync" parameters="System.Data.CommandBehavior,System.Threading.CancellationToken" />
13+
<exactMethodMatcher methodName="ExecuteNonQueryAsync" parameters="System.Threading.CancellationToken" />
14+
<exactMethodMatcher methodName="ExecuteScalarAsync" parameters="System.Threading.CancellationToken" />
15+
<exactMethodMatcher methodName="ExecuteReaderAsync" parameters="System.Data.CommandBehavior,MySqlConnector.Protocol.Serialization.IOBehavior,System.Threading.CancellationToken" />
16+
<exactMethodMatcher methodName="ExecuteNonQueryAsync" parameters="MySqlConnector.Protocol.Serialization.IOBehavior,System.Threading.CancellationToken" />
17+
<exactMethodMatcher methodName="ExecuteScalarAsync" parameters="MySqlConnector.Protocol.Serialization.IOBehavior,System.Threading.CancellationToken" />
1818
</match>
19-
2019
</tracerFactory>
2120

22-
<!-- DataReader methods. DISABLED by default due to possible performance impact. Set enabled to "true" (or omit completely) to enable this instrumentation. -->
23-
<tracerFactory name="NewRelic.Agent.Core.Tracer.Factories.Sql.DataReaderTracerFactory" level="1" enabled="false">
24-
21+
<!-- DataReader methods. DISABLED by default due to possible performance impact. Set enabled to "true" (or omit completely) to enable this instrumentation. -->
22+
<tracerFactory name="DataReaderTracer" enabled="false">
2523
<!-- MySqlConnector -->
2624
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlDataReader">
2725
<exactMethodMatcher methodName="NextResult" />
2826
<exactMethodMatcher methodName="Read" />
2927
</match>
30-
3128
</tracerFactory>
3229

33-
<!-- DbConnection.Open() -->
34-
<tracerFactory>
35-
30+
<tracerFactory name="DataReaderTracerAsync" enabled="false">
3631
<!-- MySqlConnector -->
37-
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlConnection">
38-
<exactMethodMatcher methodName="Open" />
39-
<exactMethodMatcher methodName="OpenAsync" parameters="System.Threading.CancellationToken" />
40-
</match>
41-
42-
</tracerFactory>
43-
44-
<tracerFactory>
45-
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlCommand">
46-
<exactMethodMatcher methodName="ExecuteReaderAsync" parameters="System.Data.CommandBehavior,System.Threading.CancellationToken" />
47-
<exactMethodMatcher methodName="ExecuteNonQueryAsync" parameters="System.Threading.CancellationToken" />
48-
<exactMethodMatcher methodName="ExecuteScalarAsync" parameters="System.Threading.CancellationToken" />
49-
</match>
50-
</tracerFactory>
51-
52-
<tracerFactory enabled="false">
5332
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlDataReader">
5433
<exactMethodMatcher methodName="NextResultAsync" />
5534
<exactMethodMatcher methodName="ReadAsync" />
5635
</match>
36+
</tracerFactory>
5737

38+
<!-- DbConnection.Open() -->
39+
<tracerFactory name="OpenConnectionTracer">
40+
<!-- MySqlConnector -->
41+
<match assemblyName="MySqlConnector" className="MySql.Data.MySqlClient.MySqlConnection">
42+
<exactMethodMatcher methodName="Open" />
43+
</match>
5844
</tracerFactory>
5945

6046
</instrumentation>

contrib/NewRelic/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
Copy `MySqlConnector.xml` from this folder to `%PROGRAMDATA%\New Relic\.NET Agent\Extensions`.
66

7+
You must be running [New Relic .NET Agent](https://docs.newrelic.com/docs/agents/net-agent) [version 8.19.353.0](https://docs.newrelic.com/docs/release-notes/agent-release-notes/net-release-notes/net-agent-8193530) or later.
8+
79
## Documentation
810

911
See the New Relic documentation for [.NET custom transactions](https://docs.newrelic.com/docs/agents/net-agent/instrumentation/net-custom-transactions)
1012
and [.NET custom instrumentation](https://docs.newrelic.com/docs/agents/net-agent/instrumentation/net-custom-instrumentation).
1113

1214
## Discussion
1315

14-
For more information, see this [discussion on the New Relic forums](https://discuss.newrelic.com/t/integrate-custom-ado-net-provider-with-newrelic/39964).
16+
For more information, see this [discussion on the New Relic forums](https://discuss.newrelic.com/t/integrate-custom-ado-net-provider-with-newrelic/39964).
17+
18+
## Credit
19+
20+
The instrumentation file was [posted by ppavlov](https://discuss.newrelic.com/t/feature-idea-support-mysqlconnector-driver-for-db-instrumentation/63414/8).

0 commit comments

Comments
 (0)