beyla
beyla copied to clipboard
SQL: Capture full SQL statement instead of `PREPARED STATEMENT`
Teeing off of https://github.com/grafana/beyla/issues/1695
A lot of the spans say PREPARED STATEMENT . while we should be capturing the underlying SQL calls.
Yeah, this is sort of a limitation of how things work at the moment, with us detecting the SQL statement based on the protocol information. When prepared statement is run, the client supplies the statement ID + the arguments, so the SQL is not actually visible.
I think we need to look into if we can do the same thing we did for gRPC. Namely, if we see the prepare command, then we can create internal mapping SQL statement <> ID and then we can substitute it when someone calls the prepared statement.
Is this Postgres or MySQL?
This is Postgres. And this is purely on the server side btw. The client sits on a node that doesn't have BTF.
There's currenly a WIP PR for mysql. Postgres can be implemented soon: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/pull/256