OracleDB Query Samples Changes #39284
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to tracking issue: #37478
Description
We introduced OracleDB Query Sample collection in this PR. The scraper will record all the currently executing queries once (in most case) and report related metrics. This enables users to monitor executed queries and correlate them with Top Query data for deeper insights into troubleshooting and performance optimization.
New Log Attributes
Example Output
{
"resourceLogs": [
{
"resource": {},
"scopeLogs": [
{
"scope": {
"name": "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver",
"version": "v0.0.1"
},
"logRecords": [
{
"timeUnixNano": "1744198629213688000",
"body": {},
"attributes": [
{
"key": "oracledb.PLAN_HASH_VALUE",
"value": {
"stringValue": "34313939393139353638"
}
},
{
"key": "oracledb.machine",
"value": {
"stringValue": "AKSHASRI-M-VGCY"
}
},
{
"key": "oracledb.username",
"value": {
"stringValue": "ADMIN"
}
},
{
"key": "oracledb.schemaname",
"value": {
"stringValue": "ADMIN"
}
},
{
"key": "oracledb.query.program",
"value": {
"stringValue": "oracle-test"
}
},
{
"key": "oracledb.query.module",
"value": {
"stringValue": "oracle-test"
}
},
{
"key": "oracledb.query.status",
"value": {
"stringValue": "ACTIVE"
}
},
{
"key": "oracledb.query.state",
"value": {
"stringValue": "WAITED KNOWN TIME"
}
},
{
"key": "oracledb.query.wait_class",
"value": {
"stringValue": ""
}
},
{
"key": "oracledb.query.event",
"value": {
"stringValue": ""
}
},
{
"key": "oracledb.query.object_name",
"value": {
"stringValue": ""
}
},
{
"key": "oracledb.query.object_type",
"value": {
"stringValue": ""
}
},
{
"key": "oracledb.query.sql_fulltext",
"value": {
"stringValue": "SELECT /* collector-query */ S.MACHINE, S.USERNAME, S.SCHEMANAME, S.SQL_ID, S.SQL_CHILD_NUMBER, S.SID, S.SERIAL#, Q.SQL_FULLTEXT, S.OSUSER, S.PROCESS, S.PORT, S.PROGRAM, S.MODULE, S.STATUS, S.STATE, Q.PLAN_HASH_VALUE, ROUND((SYSDATE - SQL_EXEC_START) * 86400) AS DURATION_SEC, CASE WHEN S.TIME_REMAINING_MICRO IS NOT NULL THEN S.WAIT_CLASS END AS WAIT_CLASS, CASE WHEN S.TIME_REMAINING_MICRO IS NOT NULL THEN S.EVENT END AS EVENT, CASE WHEN S.PLSQL_ENTRY_OBJECT_ID IS NOT NULL THEN CASE WHEN P.PROCEDURE_NAME IS NULL THEN P.OWNER || '.' || P.OBJECT_NAME ELSE P.OWNER || '.' || P.OBJECT_NAME || '.' || P.PROCEDURE_NAME END END AS OBJECT_NAME, P.OBJECT_TYPE FROM V$SESSION S LEFT JOIN DBA_PROCEDURES P ON S.PLSQL_ENTRY_OBJECT_ID = P.OBJECT_ID AND S.PLSQL_ENTRY_SUBPROGRAM_ID = P.SUBPROGRAM_ID LEFT JOIN V$SQL Q ON S.SQL_ID = Q.SQL_ID WHERE S.SQL_ID IS NOT NULL AND S.STATUS = 'ACTIVE'"
}
},
{
"key": "oracledb.query.osuser",
"value": {
"stringValue": "akshasri"
}
},
{
"key": "oracledb.query.DURATION_SEC",
"value": {
"intValue": "1"
}
}
],
"traceId": "",
"spanId": ""
}
]
}
]
}
]
}
Testing
Documentation
Updated