Skip to content

Commit 6d35fd7

Browse files
authored
[mysqlreceiver]: add aborted, aborted_clients and locked values to error property for mysql.connection.errors metric (open-telemetry#23211)
Signed-off-by: Dominik Rosiek <[email protected]>
1 parent 88ac450 commit 6d35fd7

File tree

6 files changed

+66
-7
lines changed

6 files changed

+66
-7
lines changed

.chloggen/drosiek-mysql-aborted.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# If your change doesn't affect end users, such as a test fix or a tooling change,
3+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
4+
5+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
6+
change_type: enhancement
7+
8+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
9+
component: mysqlreceiver
10+
11+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
12+
note: "add `aborted`, `aborted_clients` and `locked` values to `error` property for `mysql.connection.errors` metric"
13+
14+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
15+
issues: [14138]
16+
17+
# (Optional) One or more lines of additional information to render under the primary note.
18+
# These lines will be padded with 2 spaces and then inserted directly into the document.
19+
# Use pipe (|) for multiline entries.
20+
subtext:

receiver/mysqlreceiver/documentation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ Errors that occur during the client connection process.
422422
423423
| Name | Description | Values |
424424
| ---- | ----------- | ------ |
425-
| error | The connection error type. | Str: ``accept``, ``internal``, ``max_connections``, ``peer_address``, ``select``, ``tcpwrap`` |
425+
| error | The connection error type. | Str: ``accept``, ``internal``, ``max_connections``, ``peer_address``, ``select``, ``tcpwrap``, ``aborted``, ``aborted_clients``, ``locked`` |
426426
427427
### mysql.joins
428428

receiver/mysqlreceiver/internal/metadata/generated_metrics.go

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/mysqlreceiver/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ attributes:
4141
name_override: error
4242
description: The connection error type.
4343
type: string
44-
enum: [accept, internal, max_connections, peer_address, select, tcpwrap]
44+
enum: [accept, internal, max_connections, peer_address, select, tcpwrap, aborted, aborted_clients, locked]
4545
handler:
4646
name_override: kind
4747
description: The handler types.

receiver/mysqlreceiver/scraper.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
122122

123123
for k, v := range globalStats {
124124
switch k {
125-
126125
// bytes transmission
127126
case "Bytes_received":
128127
addPartialIfError(errs, m.mb.RecordMysqlClientNetworkIoDataPoint(now, v, metadata.AttributeDirectionReceived))
@@ -186,6 +185,17 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
186185
case "Connection_errors_tcpwrap":
187186
addPartialIfError(errs, m.mb.RecordMysqlConnectionErrorsDataPoint(now, v,
188187
metadata.AttributeConnectionErrorTcpwrap))
188+
case "Aborted_clients":
189+
addPartialIfError(errs, m.mb.RecordMysqlConnectionErrorsDataPoint(now, v,
190+
metadata.AttributeConnectionErrorAbortedClients))
191+
case "Aborted_connects":
192+
addPartialIfError(errs, m.mb.RecordMysqlConnectionErrorsDataPoint(now, v,
193+
metadata.AttributeConnectionErrorAborted))
194+
case "Locked_connects":
195+
addPartialIfError(errs, m.mb.RecordMysqlLockedConnectsDataPoint(now, v))
196+
addPartialIfError(errs, m.mb.RecordMysqlConnectionErrorsDataPoint(now, v,
197+
metadata.AttributeConnectionErrorLocked))
198+
189199
// connection
190200
case "Connections":
191201
addPartialIfError(errs, m.mb.RecordMysqlConnectionCountDataPoint(now, v))
@@ -322,10 +332,6 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
322332
case "Table_locks_waited":
323333
addPartialIfError(errs, m.mb.RecordMysqlLocksDataPoint(now, v, metadata.AttributeLocksWaited))
324334

325-
// locked_connects
326-
case "Locked_connects":
327-
addPartialIfError(errs, m.mb.RecordMysqlLockedConnectsDataPoint(now, v))
328-
329335
// joins
330336
case "Select_full_join":
331337
addPartialIfError(errs, m.mb.RecordMysqlJoinsDataPoint(now, v, metadata.AttributeJoinKindFull))

receiver/mysqlreceiver/testdata/scraper/expected.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,27 @@ resourceMetrics:
261261
stringValue: tcpwrap
262262
startTimeUnixNano: "1644862687825728000"
263263
timeUnixNano: "1644862687825772000"
264+
- asInt: "2"
265+
attributes:
266+
- key: error
267+
value:
268+
stringValue: aborted
269+
startTimeUnixNano: "1644862687825728000"
270+
timeUnixNano: "1644862687825772000"
271+
- asInt: "1"
272+
attributes:
273+
- key: error
274+
value:
275+
stringValue: aborted_clients
276+
startTimeUnixNano: "1644862687825728000"
277+
timeUnixNano: "1644862687825772000"
278+
- asInt: "293"
279+
attributes:
280+
- key: error
281+
value:
282+
stringValue: locked
283+
startTimeUnixNano: "1644862687825728000"
284+
timeUnixNano: "1644862687825772000"
264285
isMonotonic: true
265286
unit: "1"
266287
- description: The number of writes to the InnoDB doublewrite buffer.

0 commit comments

Comments
 (0)