You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MySqlConnector exposes metrics that follow the [OpenTelemetry Semantic Conventions for Database Metrics](https://opentelemetry.io/docs/specs/semconv/database/database-metrics/) via types in the [System.Diagnostics.Metrics](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.metrics) namespace.
13
+
14
+
<blockquoteclass="note">Metrics are only supported in MySqlConnector 2.3.0 or later.</blockquote>
15
+
16
+
The name used for the meter is `MySqlConnector`.
17
+
18
+
Connect a listener using the `MeterListener` class:
19
+
20
+
```csharp
21
+
newMeterListener
22
+
{
23
+
InstrumentPublished= (instrument, listener) =>
24
+
{
25
+
if (instrument.Meter.Name=="MySqlConnector")
26
+
listener.EnableMeasurementEvents(instrument);
27
+
}
28
+
};
29
+
```
30
+
31
+
## Supported Instruments
32
+
33
+
Name | Type | Unit | Description
34
+
--- | --- | --- | ---
35
+
`db.client.connections.usage` | UpDownCounter | `{connection}` | The number of connections that are currently in the state described by the state tag.
36
+
`db.client.connections.pending_requests` | UpDownCounter | `{request}` | The number of pending requests for an open connection, cumulative for the entire pool.
37
+
`db.client.connections.create_time` | Histogram | `ms` | The time it took to create a new connection.
38
+
`db.client.connections.use_time` | Histogram | `ms` | The time between borrowing a connection and returning it to the pool.
39
+
`db.client.connections.wait_time` | Histogram | `ms` | The time it took to obtain an open connection from the pool.
40
+
`db.client.connections.idle.max` | UpDownCounter | `{connection}` | The maximum number of idle open connections allowed; this corresponds to `MaximumPoolSize` in the connection string.
41
+
`db.client.connections.idle.min` | UpDownCounter | `{connection}` | The minimum number of idle open connections allowed; this corresponds to `MinimumPoolSize` in the connection string.
42
+
`db.client.connections.max` | UpDownCounter | `{connection}` | The maximum number of open connections allowed; this corresponds to `MaximumPoolSize` in the connection string.
0 commit comments