Skip to content

Commit f1a728a

Browse files
committed
Consolidate Diagnostics documentation.
Move Logging and Tracing to new Diagnostics section and add a page for Metrics.
1 parent 82ec85c commit f1a728a

File tree

5 files changed

+71
-11
lines changed

5 files changed

+71
-11
lines changed

docs/config.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,22 @@ disablePathToLower = true
2727
identifier = "getting started"
2828
pre = "<i class='fa fa-road'></i>"
2929
weight = 20
30-
[[menu.main]]
31-
name = "Tutorials"
32-
identifier = "tutorials"
33-
pre = "<i class='fa fa-lightbulb-o'></i>"
34-
weight = 40
3530
[[menu.main]]
3631
name = "API"
3732
identifier = "api"
3833
pre = "<i class='fa fa-file-text'></i>"
3934
url = "/api/MySqlConnectorAssembly/"
40-
weight = 35
35+
weight = 30
36+
[[menu.main]]
37+
name = "Diagnostics"
38+
identifier = "diagnostics"
39+
pre = "<i class='fa fa-road'></i>"
40+
weight = 40
41+
[[menu.main]]
42+
name = "Tutorials"
43+
identifier = "tutorials"
44+
pre = "<i class='fa fa-lightbulb-o'></i>"
45+
weight = 50
4146
[[menu.main]]
4247
name = "Troubleshooting"
4348
identifier = "troubleshooting"

docs/content/overview/logging.md renamed to docs/content/diagnostics/logging.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
lastmod: 2023-07-07
2+
lastmod: 2023-11-11
33
date: 2018-01-20
44
menu:
55
main:
6-
parent: getting started
6+
parent: diagnostics
77
title: Logging
8-
weight: 50
8+
weight: 10
99
---
1010

1111
Logging

docs/content/diagnostics/metrics.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
date: 2023-11-11
3+
menu:
4+
main:
5+
parent: diagnostics
6+
title: Metrics
7+
weight: 30
8+
---
9+
10+
# Metrics
11+
12+
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+
<blockquote class="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+
new MeterListener
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.

docs/content/tutorials/tracing.md renamed to docs/content/diagnostics/tracing.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2+
lastmod: 2023-11-11
23
date: 2021-10-16
34
menu:
45
main:
5-
parent: tutorials
6+
parent: diagnostics
67
title: Tracing
7-
weight: 13
8+
weight: 20
89
---
910

1011
# Tracing

netlify.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,15 @@ from = "/tutorials/"
100100
to = "/"
101101
status = 302
102102
force = true
103+
104+
[[redirects]]
105+
from = "/overview/logging/"
106+
to = "/diagnostics/logging/"
107+
status = 302
108+
force = true
109+
110+
[[redirects]]
111+
from = "/tutorials/tracing/"
112+
to = "/diagnostics/tracing/"
113+
status = 302
114+
force = true

0 commit comments

Comments
 (0)