-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add debugging-metadata and tracing directly to OCaml traits-module #121
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 5efe95f.
* upstream/master: opam: update prepare release 20231201 Revert "gen_caml: some hygiene" gen: ensure no trailing whitespace collect params of subqueries gen_caml: some hygiene build: do not let dune mess up warnings sql: + some string functions sql: parse generated columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- need to finish dune conditional
@@ -271,8 +272,8 @@ let with_stmt db sql f = | |||
|
|||
let row_array = (module M.Row.Array : M.Row.S with type t = M.Field.t array) | |||
|
|||
let select db sql set_params callback = | |||
with_stmt db sql @@ fun stmt -> | |||
let select ?operation ?tables ~span_name db sql set_params callback = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets put all meta information into one record { tables; span_name; operation }
"db.system", Some system; | ||
"db.statement", Some sql; | ||
"db.operation", operation; | ||
"db.table", Option.map List.hd tables; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List.hd :sideeye:
This PR implements an alternative to #117, making tracing-information non-optional (and thus requiring no build-system changes), instead requiring traits-implementations to be updated to accept the new tracing-information.
This is a breaking change for custom traits-implementations.
The built-in traits implementation use ocaml-trace, if present in the installed world (
opam install trace
), to generate tracing-spans for each SQL statement.All of the additions are noops at runtime if the user does not have
ocaml-trace
installed, and doesn't use a custom traits implementation.The diff in the generated output is as following: