Skip to content
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

agent version 2.3, The span attribute of the database span is missing db.operation #11369

Closed
zhangjiabin1010 opened this issue May 16, 2024 · 5 comments · Fixed by #11472
Closed
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@zhangjiabin1010
Copy link

Describe the bug

After upgrading the agent to version 2.3,
there is no db.operation in the span attributes of databases such as oracle and postgres.

Steps to reproduce

The following is the span data collected:

        {
          "traceId": "232ca492da8af16623bebfe65e235407",
          "spanId": "a88ae62a9678eb76",
          "parentSpanId": "d324ad6c3cbf9c61",
          "name": "SELECT link_monitor.usertest",
          "kind": 3,
          "startTimeUnixNano": "1715825338514041100",
          "endTimeUnixNano": "1715825338563625300",
          "attributes": [
            {
              "key": "db.statement",
              "value": {
                "stringValue": "select user0_.id as id1_0_0_, user0_.age as age2_0_0_, user0_.name as name3_0_0_ from link_monitor.usertest user0_ where user0_.id=?"
              }
            },
            {
              "key": "db.system",
              "value": {
                "stringValue": "postgresql"
              }
            },
            {
              "key": "server.port",
              "value": {
                "intValue": "31003"
              }
            },
            {
              "key": "db.connection_string",
              "value": {
                "stringValue": "postgresql://122.237.99.140:31003"
              }
            },
            {
              "key": "server.address",
              "value": {
                "stringValue": "122.237.99.140"
              }
            },
            {
              "key": "thread.id",
              "value": {
                "intValue": "137"
              }
            },
            {
              "key": "db.user",
              "value": {
                "stringValue": "postgres"
              }
            },
            {
              "key": "thread.name",
              "value": {
                "stringValue": "http-nio-8181-exec-3"
              }
            },
            {
              "key": "entryId",
              "value": {
                "stringValue": "fb6a7f9f0664d0f7"
              }
            },
            {
              "key": "db.name",
              "value": {
                "stringValue": "postgres"
              }
            }
          ],
          "status": {}
        }
      ]
    }
  ],
  "schemaUrl": "https://opentelemetry.io/schemas/1.24.0"
}

]
}

Expected behavior

Contains db.operation or db.operation.name

Actual behavior

missing db.operation

Javaagent or library instrumentation version

v2.3

Environment

JDK:1.8
OS:centos7

Additional context

No response

@zhangjiabin1010 zhangjiabin1010 added bug Something isn't working needs triage New issue that requires triage labels May 16, 2024
@laurit
Copy link
Contributor

laurit commented May 16, 2024

@zhangjiabin1010 did this work in a previous version? What instrumentation generates this span? Would it be possible to provide a minimal sample application that reproduces the issue?

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label May 16, 2024
@zhangjiabin1010
Copy link
Author

@zhangjiabin1010这在以前的版本中有效吗?什么仪器产生这个跨度?是否可以提供一个重现该问题的最小示例应用程序?

It is work in version 1.32. ScopeName = 'io.opentelemetry.jdbc' ,
The service source code is not here with me, so I can't provide an example.

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label May 17, 2024
@laurit
Copy link
Contributor

laurit commented May 17, 2024

To me the most likely explanation is that you have disabled the sql statement sanitizer. Besides sanitizing the query sanitizer is also used to extract the operation and table name.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label May 17, 2024
@zhangjiabin1010
Copy link
Author

对我来说,最可能的解释是您已禁用 sql 语句清理程序。除了清理之外,查询清理程序还用于提取操作和表名称。

Yes, that's the reason, maybe it should be added to the documentation. thanks for reply

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label May 20, 2024
@trask
Copy link
Member

trask commented May 20, 2024

re-opening, as @laurit pointed out elsewhere it may make sense to capture db.operation even when sanitization is enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants