-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[receiver/oracledb] discrepancy between the metric values in DBA_TABLESPACE_USAGE_METRICS and the ones calculated by the receiver #31451
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
It looks like there's at least one problem here, and then I have a clarifying question to see if there's another.
The existing calculation is missing logic to account for how many data blocks are in each extent. We could use We could also expose |
Background investigationDoing some local testing with
Block size is Findings on This is the metric data for
This value is in bytes, but converted to blocks it's This means the metric we're calculating and sending as the limit is 553 times larger than what's being reported by Findings on
This value is in bytes, so converting it to blocks we get the following:
The Proposed solutionI think the best solution here would be to rely on |
I realize that this may just be a discrepancy between "maximum possible size of tablespace" and "tablespace size" to change how we're calculating |
) **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% ```
Component(s)
receiver/oracledb
What happened?
Description
The oracledb receiver uses the below [queries] respectively (https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/oracledbreceiver/scraper.go#L41-L42) to set values for
oracledb.tablespace_size.limit
andoracledb.tablespace_size.usage
in bytesOur backend uses those metrics to calculate the % used tablespace
(oracledb.tablespace_size.usage/oracledb.tablespace_size.limit)*100
However, when we look at the values in table
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 , the percentage used and the table size/used space, although in data blocks, still do not match the receiver's datapoints when converted.Steps to Reproduce
enable the oracledb receiver and compare
(oracledb.tablespace_size.usage/oracledb.tablespace_size.limit)*100
toUSED_PERCENT
fromDBA_TABLESPACE_USAGE_METRICS
Expected Result
Both values should match
Actual Result
Different values
Collector version
0.93.0
The text was updated successfully, but these errors were encountered: