Skip to content

Updated dbname and service name for both query sample and top query log events#48995

Open
sjyothi54 wants to merge 8 commits into
open-telemetry:mainfrom
newrelic-forks:oracle-dbname-servicename
Open

Updated dbname and service name for both query sample and top query log events#48995
sjyothi54 wants to merge 8 commits into
open-telemetry:mainfrom
newrelic-forks:oracle-dbname-servicename

Conversation

@sjyothi54

@sjyothi54 sjyothi54 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in how the oracledbreceiver collecting db.namespace for query_sample
The Problem:
Previously, the code used the Oracle service_name (the network connection string) as the db.name. This was incorrect for modern multi-tenant (CDB/PDB) Oracle setups. If one database used 3 different connection services, the collector treated them as 3 completely separate databases, splitting up your performance data and cluttering dashboards.

The Fix:

  • Moved the service_name to the correct OpenTelemetry attribute (db.namespace).
  • Added a JOIN to v$containers using the container ID (con_id). This ensures that db.name always shows the actual name of the Pluggable Database (PDB)
  • Used NVL (null handling) so that if a system background task doesn't have a PDB name, it defaults cleanly to a placeholder string rather than sending a blank space which breaks dashboards.

Link to tracking issue

Fixes
#48996

Testing

  • Added unit tests in scraper_test.go
  • Updated expectedSamplesFile.yaml and exepectedQueryTextAndPlanQuery.yaml in testdata

Documentation

Updated documentation.md with the new db.namespace and db.servicename for top and query sample log events

Authorship

  • I, a human, wrote this pull request description myself.

Comment thread receiver/oracledbreceiver/metadata.yaml Outdated
Comment thread .chloggen/oracledb-db-namespace-from-containers.yaml
stringValue: ORCLPDB1
- key: oracle.db.service
value:
stringValue: ORCLPDB1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
stringValue: ORCLPDB1
stringValue: ORCL

Probably not a big deal, but it looks like this should just be the service, not the db name.

Comment on lines +23 to +24
Requires Oracle 12c+ and `SELECT` on `V$CONTAINERS`. Both events are still
`enabled: false` by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These should be removed unless they're different from before.

On `db.server.query_sample` and `db.server.top_query` events, `db.namespace`
now reports the database name instead of the Oracle service
name. The service name moves to the new `oracle.db.service` attribute.
Existing dashboards or queries grouping by `db.namespace` on these events should be updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should remove this sentence, we don't need to recommend how to handle this outside the scope of the collector itself.

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.

4 participants