Skip to content

Commit c715b68

Browse files
[receiver/mysql] Add delete_multi, update_multi to mysql.commands metric (#37329)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #37301 <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 9ffaf0d commit c715b68

File tree

6 files changed

+53
-6
lines changed

6 files changed

+53
-6
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use this changelog template to create an entry for release notes.
2+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
3+
change_type: enhancement
4+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
5+
component: mysqlreceiver
6+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
7+
note: "Add delete_multi, update_multi metrics to mysql.commands for mysqlreceiver"
8+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
9+
issues: [37301]
10+
# (Optional) One or more lines of additional information to render under the primary note.
11+
# These lines will be padded with 2 spaces and then inserted directly into the document.
12+
# Use pipe (|) for multiline entries.
13+
subtext:
14+
# If your change doesn't affect end users or the exported elements of any package,
15+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
16+
# Optional: The change log or logs in which this entry should be included.
17+
# e.g. '[user]' or '[user, api]'
18+
# Include 'user' if the change is relevant to end users.
19+
# Include 'api' if there is a change to a library API.
20+
# Default: '[user]'
21+
change_logs: [user]

receiver/mysqlreceiver/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ The number of times each type of command has been executed.
392392
393393
| Name | Description | Values |
394394
| ---- | ----------- | ------ |
395-
| command | The command types. | Str: ``delete``, ``insert``, ``select``, ``update`` |
395+
| command | The command types. | Str: ``delete``, ``delete_multi``, ``insert``, ``select``, ``update``, ``update_multi`` |
396396
397397
### mysql.connection.count
398398

receiver/mysqlreceiver/internal/metadata/generated_metrics.go

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/mysqlreceiver/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ attributes:
3838
command:
3939
description: The command types.
4040
type: string
41-
enum: [delete, insert, select, update]
41+
enum: [delete, delete_multi, insert, select, update, update_multi]
4242
connection_error:
4343
name_override: error
4444
description: The connection error type.

receiver/mysqlreceiver/scraper.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,16 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
229229
// commands
230230
case "Com_delete":
231231
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandDelete))
232+
case "Com_delete_multi":
233+
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandDeleteMulti))
232234
case "Com_insert":
233235
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandInsert))
234236
case "Com_select":
235237
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandSelect))
236238
case "Com_update":
237239
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandUpdate))
240+
case "Com_update_multi":
241+
addPartialIfError(errs, m.mb.RecordMysqlCommandsDataPoint(now, v, metadata.AttributeCommandUpdateMulti))
238242

239243
// created tmps
240244
case "Created_tmp_disk_tables":

receiver/mysqlreceiver/testdata/scraper/expected.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ resourceMetrics:
181181
stringValue: delete
182182
startTimeUnixNano: "1000000"
183183
timeUnixNano: "2000000"
184+
- asInt: "51"
185+
attributes:
186+
- key: command
187+
value:
188+
stringValue: delete_multi
189+
startTimeUnixNano: "1000000"
190+
timeUnixNano: "2000000"
184191
- asInt: "78"
185192
attributes:
186193
- key: command
@@ -202,6 +209,13 @@ resourceMetrics:
202209
stringValue: update
203210
startTimeUnixNano: "1000000"
204211
timeUnixNano: "2000000"
212+
- asInt: "174"
213+
attributes:
214+
- key: command
215+
value:
216+
stringValue: update_multi
217+
startTimeUnixNano: "1000000"
218+
timeUnixNano: "2000000"
205219
isMonotonic: true
206220
unit: "1"
207221
- description: The number of connection attempts (successful or not) to the MySQL server.

0 commit comments

Comments
 (0)