Skip to content

OracleDB Query Samples Changes #39284

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

Closed
wants to merge 1 commit into from
Closed

Conversation

akshays-19
Copy link

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

      oracledb.username
      oracledb.query.wait_class:
      oracledb.schemaname
      oracledb.query.program
      oracledb.query.module
      oracledb.query.status
      oracledb.query.state
      oracledb.query.event
      oracledb.query.object_name
      oracledb.query.object_type
      oracledb.query.osuser
      db.query.text
      oracledb.query.duration
       oracledb.query.id
       oracledb.query.child_number
       oracledb.query.sid
       oracledb.query.serial_number
       oracledb.query.process
       oracledb.query.plan_hash

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

@akshays-19 akshays-19 requested review from dmitryax, crobert-1, atoulme and a team as code owners April 9, 2025 13:53
Copy link

linux-foundation-easycla bot commented Apr 9, 2025

CLA Not Signed

@akshays-19
Copy link
Author

Closing this PR, as CLA is still unapproved

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

Successfully merging this pull request may close these issues.

3 participants