Skip to content

resource auto-inference is not working for JDBC spans #1913

@tobiasstadler

Description

@tobiasstadler

Describe the bug

According to elastic/apm#465 context.destination.service.resource should be ${subtype}/${instance} (or ${type}/${instance} if subtype is null) for a JDBC Span, e.g. for a postgresql db named test: postgresql/test. However, context.destination.service.resource is only ${subtype} (or ${type}), resp. postgresql in the example above.

The algorithm in co.elastic.apm.agent.impl.transaction.Span#beforeEnd is not working because:

  • JDBC spans are created as normal spans, not exit spans (see co.elastic.apm.agent.jdbc.helper.JdbcHelper#createJdbcSpan)
  • JDBC spans usually set context.destination.service.resource to ConnectionMetaData.getDbVendor() (see co.elastic.apm.agent.jdbc.helper.JdbcHelper#createJdbcSpan)

Expected behavior

For a Postgres db named test context.destination.service.resource should be postgresql/test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions