You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement a custom decorator to apply the logger_metadata to spawned batch processes from Absinthe's batch. I have the following module
defmoduleLoggerDecoratordo@moduledoc""" Makes it so that async functions that have been invoked can find the parent caller and put the request_id on the logger, which will enhance debugging """useDecorator.Define,[apply_request_id_to_logger: 0]requireLoggerdefapply_request_id_to_logger(body,_context)doquotedoparent_pid=:"$callers"|>Process.get()|>List.last(){_,metadata}=Process.info(parent_pid)[:dictionary][:logger_metadata]request_id=Keyword.get(metadata,:request_id,nil)Logger.metadata([request_id: request_id])unquote(body)endendend
We use Appsignal, so at the top of our resolver file I have
== Compilation error in file lib/black_mamba/templates.ex ==
** (CompileError) lib/black_mamba/templates.ex:1: def all/4 defines defaults multiple times. Elixir allows defaults to be declared once per definition. Instead of:
def foo(:first_clause, b \\ :default) do ... end
def foo(:second_clause, b \\ :default) do ... end
In other files where a function does not have a default, but both decorator modules are used, I get a slew of
warning: this clause cannot match because a previous clause at line 1 always matches
web/resolver/location.ex:1
On Elixir 1.9, decorator 1.2.4
The text was updated successfully, but these errors were encountered:
I'm trying to implement a custom decorator to apply the
logger_metadata
to spawned batch processes from Absinthe'sbatch
. I have the following moduleWe use Appsignal, so at the top of our
resolver
file I havewhich will throw the error
In other files where a function does not have a default, but both decorator modules are
use
d, I get a slew ofOn Elixir 1.9, decorator 1.2.4
The text was updated successfully, but these errors were encountered: