-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[receiver/oracledb] Fix incorrect values for a couple of metrics (#32028
) **Description:** Values were being scraped incorrectly for the metrics `oracledb.tablespace_size.limit` and `oracledb.tablespace_size.usage`. The changes these metrics to be scraped from the [`DBA_TABLESPACE_USAGE_METRICS`](https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/DBA_TABLESPACE_USAGE_METRICS.html#GUID-FE479528-BB37-4B55-92CF-9EC19EDF4F46) table. This results in a slight loss of granularity in these metrics, as values will always be in multiples of the respective tablespace's block size, but I think the clarity and simplicity is worth the trade off. Note: The value of the usage metric was generally close to the expected value, but the limit was being calculated as potential theoretical capacity, unbound by server capacity. For example, in testing in a docker container on my local machine, limit was set to **17TB**. This doesn't line up with user expectations. **Link to tracking Issue:** Fixes #31451 **Testing:** Updated existing tests, added a couple new ones. Also, the original issue filed was comparing `DBA_TABLESPACE_USAGE_METRICS` output for percent used to what we got from `usage/limit * 100`. Here's the local testing outputs compared to show they now line up. ``` 2024-03-27T16:31:57.938-0700 info oracledbreceiver/scraper.go:285 DBA_TABLESPACE_USAGE_METRICS: Tablespace name: SYSTEM, used space: 111288, tablespace size: 3518587, percent used: 3.16286054600895188892586711654422641816 {"kind": "receiver", "name": "oracledb", "data_type": "metrics"} ``` ``` Metric #20 Descriptor: -> Name: oracledb.tablespace_size.usage -> Description: Used tablespace in bytes. -> Unit: By -> DataType: Gauge NumberDataPoints #0 Data point attributes: -> tablespace_name: Str(SYSTEM) StartTimestamp: 2024-03-27 23:31:56.873576 +0000 UTC Timestamp: 2024-03-27 23:32:12.523295 +0000 UTC Value: 911671296 ``` ``` Metric #19 Descriptor: -> Name: oracledb.tablespace_size.limit -> Description: Maximum size of tablespace in bytes, -1 if unlimited. -> Unit: By -> DataType: Gauge NumberDataPoints #0 Data point attributes: -> tablespace_name: Str(SYSTEM) StartTimestamp: 2024-03-27 23:31:56.873576 +0000 UTC Timestamp: 2024-03-27 23:32:12.523295 +0000 UTC Value: 28824264704 ``` Doing the same calculation, we get: ``` (911671296 / 28824264704) * 100 = ~3.16% ```
- Loading branch information
Showing
6 changed files
with
85 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: oracledbreceiver | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fix incorrect values being set for oracledb.tablespace_size.limit and oracledb.tablespace_size.usage | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [31451] | ||
|
||
# (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: | ||
|
||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [] |
7 changes: 1 addition & 6 deletions
7
receiver/oracledbreceiver/internal/metadata/generated_metrics.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
receiver/oracledbreceiver/internal/metadata/generated_metrics_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters