Skip to content

Attribute db.name is not handled correctly for Derby and Oracle tnsnames #12400

@obs-gh-abhishekrao

Description

@obs-gh-abhishekrao

Describe the bug

Instead of producing the actual database name,

  • In the derby case, we see an absolute directory path, for example: /usr/ibm/pep/was9/ibm/websphere/appserver/profiles/<REDACTED>/databases/ejbtimers/<HOST_REDACTED>/ejbtimerdb
  • In the Oracle tnsnames case, we see the connection string show up as db.name, for example: ( description = (connect_timeout=90)(retry_count=20)(retry_delay=3) (transport_connect_timeout=3000) (address_list = (load_balance = on) (failover = on) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) ) (connect_data = (server = dedicated) (service_name = <REDACTED>) ) )

Steps to reproduce

Instrument a Java app that connects to Derby in directory mode

  • Use opentelemetry javaagent version 2.6.0
  • SDK version 1.4.0
  • Instrumentation library io.opentelemetry.jdbc should be 2.6.0-alpha

Instrument a Java app that connects to Oracle database using tnsnames

  • Use opentelemetry javaagent version 2.6.0
  • SDK version 1.4.0
  • Instrumentation library io.opentelemetry.jdbc should be 2.6.0-alpha

Expected behavior

Apache Skywalking Java agent holds a good reference implementation for these two systems

Which if I read correctly, would result the example case I mentioned to have these values for db.name:

  • Derby - ejbtimerdb
  • Oracle tnsnames - Redacted, but the value for the service_name connection attribute would be set as db.name

Actual behavior

  • Derby - db.name is /usr/ibm/pep/was9/ibm/websphere/appserver/profiles/<REDACTED>/databases/ejbtimers/<HOST_REDACTED>/ejbtimerdb
  • Oracle tnsnames - db.name is ( description = (connect_timeout=90)(retry_count=20)(retry_delay=3) (transport_connect_timeout=3000) (address_list = (load_balance = on) (failover = on) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) (address = (protocol = tcp)(host = <REDACTED>)(port = 1521)) ) (connect_data = (server = dedicated) (service_name = <REDACTED>) ) )

Javaagent or library instrumentation version

2.6.0

Environment

Derby case

JDK: IBM Corporation IBM J9 VM 2.9
OS: Linux 3.10.0-1160.123.1.el7.x86_64

Oracle case

JDK: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 17.0.12+8-LTS-286
OS: Linux 4.18.0-553.16.1.el8_10.x86_64

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions