Skip to content

Commit

Permalink
[receiver/mysql]: add mysql.locked_connects metric (open-telemetry#14745
Browse files Browse the repository at this point in the history
)

feat(mysqlreceiver): add mysql.locked_connects metric
  • Loading branch information
sumo-drosiek authored and shalper2 committed Dec 6, 2022
1 parent 98824b3 commit fd4b221
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .chloggen/drosiek-uptime-innodb-row-lock-metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mysqlreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: add mysql.locked_connects metric

# One or more tracking issues related to the change
issues: [14138]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
1 change: 1 addition & 0 deletions receiver/mysqlreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ These are the metrics available for this scraper.
| **mysql.handlers** | The number of requests to various MySQL handlers. | 1 | Sum(Int) | <ul> <li>handler</li> </ul> |
| **mysql.index.io.wait.count** | The total count of I/O wait events for an index. | 1 | Sum(Int) | <ul> <li>io_waits_operations</li> <li>table_name</li> <li>schema</li> <li>index_name</li> </ul> |
| **mysql.index.io.wait.time** | The total time of I/O wait events for an index. | ns | Sum(Int) | <ul> <li>io_waits_operations</li> <li>table_name</li> <li>schema</li> <li>index_name</li> </ul> |
| **mysql.locked_connects** | The number of attempts to connect to locked user accounts. | 1 | Sum(Int) | <ul> </ul> |
| **mysql.locks** | The number of MySQL locks. | 1 | Sum(Int) | <ul> <li>locks</li> </ul> |
| **mysql.log_operations** | The number of InnoDB log operations. | 1 | Sum(Int) | <ul> <li>log_operations</li> </ul> |
| **mysql.operations** | The number of InnoDB operations. | 1 | Sum(Int) | <ul> <li>operations</li> </ul> |
Expand Down
68 changes: 68 additions & 0 deletions receiver/mysqlreceiver/internal/metadata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions receiver/mysqlreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@ metrics:
monotonic: false
aggregation: cumulative
attributes: [threads]
mysql.locked_connects:
enabled: true
description: The number of attempts to connect to locked user accounts.
unit: 1
sum:
value_type: int
input_type: string
monotonic: true
aggregation: cumulative
mysql.tmp_resources:
enabled: true
description: The number of created temporary resources.
Expand Down
4 changes: 4 additions & 0 deletions receiver/mysqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
case "Table_locks_waited":
addPartialIfError(errs, m.mb.RecordMysqlLocksDataPoint(now, v, metadata.AttributeLocksWaited))

// locked_connects
case "Locked_connects":
addPartialIfError(errs, m.mb.RecordMysqlLockedConnectsDataPoint(now, v))

// sorts
case "Sort_merge_passes":
addPartialIfError(errs, m.mb.RecordMysqlSortsDataPoint(now, v, metadata.AttributeSortsMergePasses))
Expand Down
16 changes: 16 additions & 0 deletions receiver/mysqlreceiver/testdata/scraper/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,22 @@
},
"unit": "ns"
},
{
"description": "The number of attempts to connect to locked user accounts.",
"name": "mysql.locked_connects",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
{
"asInt": "293",
"startTimeUnixNano": "1644862687825728000",
"timeUnixNano": "1644862687825772000"
}
],
"isMonotonic": true
},
"unit": "1"
},
{
"description": "The number of created temporary resources.",
"name": "mysql.tmp_resources",
Expand Down

0 comments on commit fd4b221

Please sign in to comment.