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

Missing db.operation for CREATE/DROP/ALTER SQL statement #10031

Closed
bjrara opened this issue Dec 7, 2023 · 0 comments · Fixed by #10020
Closed

Missing db.operation for CREATE/DROP/ALTER SQL statement #10031

bjrara opened this issue Dec 7, 2023 · 0 comments · Fixed by #10020
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@bjrara
Copy link
Contributor

bjrara commented Dec 7, 2023

Describe the bug

The attribute db.operation is missing for some certain SQL statements including CREATE, DROP, ALTER.

Per Semantic Conventions for Database Client Calls,

it should be set if the operation name is provided by the library being instrumented.

Since the general SQL client is supported in the auto-instrumentation, it's expected to have valid db.operation attribute for db statement that performs CREATE, DROP, ALTER operation

Steps to reproduce

Auto-instrument a Java application that executes CREATE INDEX/DROP INDEX/ALTER TABLE command on MySQL programmatically. The generated trace is not emitted with db.operation but only db.statement.

Sample trace (business information is sanitized):

ScopeSpans #0
ScopeSpans SchemaURL: 
InstrumentationScope io.opentelemetry.jdbc 1.33.0-alpha-SNAPSHOT
Span #0
    Trace ID       : 656a3cef641c89ebfc6e371001ee7a47
    Parent ID      : 
    ID             : 1d68b32ea8ac620e
    Name           : 0d9a31b6-6617-4019-a9c9-aa66406d056b
    Kind           : Client
    Start time     : 2023-12-01 20:07:11.331591 +0000 UTC
    End time       : 2023-12-01 20:07:11.331839515 +0000 UTC
    Status code    : Unset
    Status message : 
Attributes:
     -> db.name: Str(xxx)
     -> db.statement: Str(CREATE INDEX types_name ON types (name))
     -> db.system: Str(xxx)
     -> db.user: Str(xxx)
     -> thread.id: Int(1)
     -> thread.name: Str(main)

Expected behavior

The attribute db.operation is present.

Actual behavior

The attribute db.operation is missing.

Javaagent or library instrumentation version

latest

Environment

JDK:
OS:

Additional context

No response

@bjrara bjrara added bug Something isn't working needs triage New issue that requires triage labels Dec 7, 2023
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
1 participant