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

Instrument java.sql.Statement.executeBatch #4476

Open
johnbley opened this issue Oct 22, 2021 · 0 comments · May be fixed by #12797
Open

Instrument java.sql.Statement.executeBatch #4476

johnbley opened this issue Oct 22, 2021 · 0 comments · May be fixed by #12797
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request

Comments

@johnbley
Copy link
Member

Is your feature request related to a problem? Please describe.
We currently cover java.sql.{Statement,PreparedStatement,CallableStatement} quite well, but we are missing instrumentation for Statement.executeBatch.

Describe the solution you'd like
At minimum a span:

  • named with a constant value indicating it is a batch - e.g. "executeBatch", "Batch Statement(s)", or (Batch of statements)
  • including a "placeholder" db.statement value indicating a batch - probably the same value as the span name
  • that includes an attribute for how many statements were executed (the size of the return value) (e.g., db.statement.count)
  • and with span status set appropriately if any returned values are EXECUTE_FAILED

For bonus points:

  • Include a db.statement.error.count (or similar) attribute with the number of failed statements (return value needed to be iterated anyway for the span status)
  • If all statements in the batch sanitize/normalize to the same string, set db.statement to that value. This would entail instrumenting addBatch and clearBatch and may not be worth the extra overhead. I'd lean towards "don't build this" based on previous experience with instrumenting this API, since batches of "mixed" sql still wouldn't have a better representation anyway.

Describe alternatives you've considered
None; this is an odd blind spot in the existing instrumentation, and admittedly a bit of a corner case in the API anyway.

Additional context
N/A.

@johnbley johnbley added the enhancement New feature or request label Oct 22, 2021
@trask trask added the contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome label Aug 15, 2023
@laurit laurit linked a pull request Nov 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants