Skip to content

Conversation

@sv-splunk
Copy link
Owner

@sv-splunk sv-splunk commented Nov 14, 2025

DBMon - Internal PR

This PR is to introduce the capability in Oracle receiver to have separate collection interval for top_query.

This feature is already existing in sql server.

Only difference in Oracle's implementation is that the lookbackTime for each collection is calculated dynamically, and the user cannot provide a value through config. SQL server receiver has an option for this to be configured manually.

A vsqlRefreshLagSec of 10 seconds is added to the lookbackTime to offset the refresh lag in v$sql table
( https://docs.oracle.com/en/database/oracle/oracle-database/21/refrn/V-SQL.html#:~:text=they%20are%20updated%20every%205%20seconds )

topNCollectionErrors := s.collectTopNMetricData(ctx, logs, currentCollectionTime, lookbackTimeCounter)
if topNCollectionErrors != nil {
scrapeErrors = append(scrapeErrors, topNCollectionErrors)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move s.lastExecutionTimestamp = collectionTime here? so the early returned collectTopNMetricData can still update the last execution time.

Currently, if the hits is zero, then the last execution time won't get updated.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good point. I had multiple thoughts about this too.

I did it this way to make the first collection happen as early as possible, otherwise it would happen only at the end of first 60 seconds. But it's nothing huge. Let me check if there could be some work around.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @XSAM updated as you suggested!

return int(s.topQueryCollectCfg.CollectionInterval.Seconds())
}

const vsqlRefreshLagSec = 10 * time.Second // Buffer to account for v$sql maximum refresh latency
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain or update the comment for the buffer design? Why do we need to go back further for 10 seconds.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @XSAM

Copy link

@XSAM XSAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants