-
Notifications
You must be signed in to change notification settings - Fork 115
No longer raise if logging raises #86
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
Conversation
| catch | ||
| kind, reason -> | ||
| stack = System.stacktrace() | ||
| {kind, reason, stack, meter} |
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.
Now long poolboy time outs
| meter = event(meter, :checkout) | ||
| with {:ok, conn, conn_info, meter} <- checkout(pool, meter, opts) do | ||
| try do | ||
| fun.(conn, conn_info, arg, meter, opts) |
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.
All "connection time" runs inside this fun (or similar, above/below), which could be instrumented using fun based instrumentation.
| end | ||
| defp run_begin(conn, conn_info, meter, opts) do | ||
| meter = event(meter, :begin) | ||
| handle_trans(conn, conn_info, :handle_begin, meter, opts, :transaction) |
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.
Transaction calls aren't wrapped in run calls with funs but could be as parameters align.
| defp event(nil, _), | ||
| do: nil | ||
| defp event({log, events}, event), | ||
| do: {log, [{event, :erlang.monotonic_time()} | events]} |
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.
simple stack based/pure implementation so could wrap any stateful instrumenter
First commit changes the behaviour and the second commit does a substantial refactor to help with #82 and any future metrics work. Hopefully this will pave the way for future integration with any standard instrumentation lib. This PR uses a stateful approach because it fits well with multiple timestampings. However all "connection_time" work is carried out inside a closure except begin/commit/rollback.