Skip to content

Commit

Permalink
[receiver/mysql]: add mysql.mysqlx_worker_threads (open-telemetry#14741)
Browse files Browse the repository at this point in the history
feat(mysqlreceiver): add mysql.mysqlx_worker_threads

Signed-off-by: Dominik Rosiek <drosiek@sumologic.com>
  • Loading branch information
sumo-drosiek committed Oct 20, 2022
1 parent 9763d5c commit 7f77b16
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .chloggen/drosiek-mysqlx-worker-threads.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.mysqlx_worker_threads

# 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:
2 changes: 2 additions & 0 deletions receiver/mysqlreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ These are the metrics available for this scraper.
| **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.mysqlx_worker_threads** | The number of worker threads available. This metric is specific for MySQL working as Document Store (X-Plugin). [more docs](https://dev.mysql.com/doc/refman/8.0/en/document-store.html) | 1 | Sum(Int) | <ul> <li>mysqlx_threads</li> </ul> |
| **mysql.opened_resources** | The number of opened resources. | 1 | Sum(Int) | <ul> <li>opened_resources</li> </ul> |
| **mysql.operations** | The number of InnoDB operations. | 1 | Sum(Int) | <ul> <li>operations</li> </ul> |
| **mysql.page_operations** | The number of InnoDB page operations. | 1 | Sum(Int) | <ul> <li>page_operations</li> </ul> |
Expand Down Expand Up @@ -62,6 +63,7 @@ metrics:
| io_waits_operations (operation) | The io_waits operation type. | delete, fetch, insert, update |
| locks (kind) | The table locks type. | immediate, waited |
| log_operations (operation) | The log operation types. | waits, write_requests, writes |
| mysqlx_threads (kind) | The worker thread count kind. | available, active |
| opened_resources (kind) | The kind of the resource. | file, table_definition, table |
| operations (operation) | The operation types. | fsyncs, reads, writes |
| page_operations (operation) | The page operation types. | created, read, written |
Expand Down
96 changes: 96 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.

15 changes: 15 additions & 0 deletions receiver/mysqlreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ attributes:
value: resource
description: The kind of temporary resources.
enum: [disk_tables, files, tables]
mysqlx_threads:
value: kind
description: The worker thread count kind.
enum: [available, active]

metrics:
mysql.buffer_pool.pages:
Expand Down Expand Up @@ -316,3 +320,14 @@ metrics:
monotonic: true
aggregation: cumulative
attributes: [tmp_resource]
mysql.mysqlx_worker_threads:
enabled: true
description: The number of worker threads available.
unit: 1
extended_documentation: This metric is specific for MySQL working as Document Store (X-Plugin). [more docs](https://dev.mysql.com/doc/refman/8.0/en/document-store.html)
sum:
value_type: int
input_type: string
monotonic: false
aggregation: cumulative
attributes: [mysqlx_threads]
6 changes: 6 additions & 0 deletions receiver/mysqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ func (m *mySQLScraper) scrapeGlobalStats(now pcommon.Timestamp, errs *scrapererr
addPartialIfError(errs, m.mb.RecordMysqlOpenedResourcesDataPoint(now, v, metadata.AttributeOpenedResourcesTable))
case "Opened_table_definitions":
addPartialIfError(errs, m.mb.RecordMysqlOpenedResourcesDataPoint(now, v, metadata.AttributeOpenedResourcesTableDefinition))

// mysqlx_worker_threads
case "Mysqlx_worker_threads":
addPartialIfError(errs, m.mb.RecordMysqlMysqlxWorkerThreadsDataPoint(now, v, metadata.AttributeMysqlxThreadsAvailable))
case "Mysqlx_worker_threads_active":
addPartialIfError(errs, m.mb.RecordMysqlMysqlxWorkerThreadsDataPoint(now, v, metadata.AttributeMysqlxThreadsActive))
}
}
}
Expand Down
37 changes: 37 additions & 0 deletions receiver/mysqlreceiver/testdata/scraper/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,43 @@
},
"unit": "ns"
},
{
"description": "The number of worker threads available.",
"name": "mysql.mysqlx_worker_threads",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
{
"asInt": "363",
"attributes": [
{
"key": "kind",
"value": {
"stringValue": "available"
}
}
],
"startTimeUnixNano": "1644862687825728000",
"timeUnixNano": "1644862687825772000"
},
{
"asInt": "364",
"attributes": [
{
"key": "kind",
"value": {
"stringValue": "active"
}
}
],
"startTimeUnixNano": "1644862687825728000",
"timeUnixNano": "1644862687825772000"
}
],
"isMonotonic": false
},
"unit": "1"
},
{
"description": "The number of opened resources.",
"name": "mysql.opened_resources",
Expand Down

0 comments on commit 7f77b16

Please sign in to comment.