-
Notifications
You must be signed in to change notification settings - Fork 20
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 a -tracing flag that generates debugging/tracing calls #117
Conversation
Isn't it possible to do this in the implementation of the traits? Can add extra arguments as nedeed |
Theoretically, yes; but I'd argue that it's inherent to tracing that you …
Anyway, I'm happy to change it, if you feel strongly about it; but I really do think this is the correct approach specifically for tracing, because tracing is something of a special case. Thoughts? † as in: everyone, because nobody wants to think about tracing, which we don't want them worrying about anyway |
One has to use traits module to use generated code, and sqlgg provides builtin ones, so can add tracing there without changing the generator and they will still be available to the user by default. If you structure it as a common module that is included by all the traits then it can be also included by in-house traits too. |
also current approach requires changes to build system to enable tracing, but in traits it will be available on upgrade to everybody automatically |
I've started on this in #121; but I'm not a big fan of that approach, after taking a stab at it. The biggest issue is that this approach forces a break in backwards compatibility — and not just in theory; since now there's new, non-disable-able changes to the traits module(s) shared among the Ahrefs codebase, that approach kinda forces us to regenerate all the sqlgg-generated code. The existing approach in this PR is more backwards-compatible (both for external users, and ourselves) — we can, for example, just turn on the I can probably work around the downsides in #121, but yeah, I don't really see "one line of change to build-system commands/Make" as a poor trade-off to "an additional module and potentially some functorization in OCaml" … eh. I'll leave it up to you, though, @ygrek, as to which you prefer? |
There is no such promise to never break custom traits. I think I prefer the #121 approach which is automatic for ppl without custom traits and thus helps to enable tracing transparently in more places |
The output will generally differ in a call to
T.tracing_span ~operation ~tables ~statement name @@ fun () -> …
, something like this: