-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update to modern elixir #8
base: master
Are you sure you want to change the base?
Conversation
@craigp do you have any interest in updating and maintaining this library? I might be interest in taking ownership if you aren't. I need to try it out in production to see if it is useful first. The more I think about it the more confident I am that |
Thanks, this is great - I've been meaning to update a few of my projects, I'll look this over shortly! |
I've just done a quick review of my own, it will definitely need some work before it is merged. The biggest issue is that I don't think Other than that:
|
added another commit that solves the issues described above. |
I've noticed a security concern while playing around with this library. I think the slack webhook should be treated as a secret, but it is stored as state in the GenServers, which means that it appears in the logs if a GenServer crashes. |
lists like like `[h | "string"]` were throwing exceptions. Don't know why.
I added two commits that change some functionality. The first overrides the Poison.Encoder.List implementation. This code was crashing when it needed to encode list of the form The second commit adds debouncing in the producer. This means that if the same message is sent multiple times it will be sent once with a count for how many times it was sent instead of being sent for every instance. I've found that the slack logger tends to spam messages so I think this will be a useful feature. I'll look at adding unit tests for it later. We need to address the security concern above where a secret is stored in a GenServer. @craigp any preferences on how to handle that? The way config is handled needs to be updated as well. I'm pretty sure this isn't best practice anymore:
The above code seems to trigger warnings in code that calls this library. Instead it should be something like this:
I'm also thinking about changing the events from a tuple to a map in |
2269b2e
to
718e52d
Compare
the slack web_hook secret has been removed from most genservers. It is still likely to appear in logs if the `PoolWorker.post/3` function fails
I have done most of the stuff mentioned in the previous post and updated the documentation. I moved the
Not sure of the details of how to apply this yet. I'll have time to work on it next week. |
I've figured out a better way of handling the Poison encoding issues, so I've removed the code to override the implementation for I'm still working on ways of preventing the slack webhook from appearing in logs. So far I've reduced the scope that the URL appears in to just the |
includes a little bit of extra logic for checking if the `PoolWorker` is in the stacktrace
That last commit hides the webhook in the I'll have a bit of a think and another read through the code, but this might be everything. |
Added the |
@craigp I'm pretty sure I just need to update the documentation and I am done here. In summary I added these new features:
The code was updated to modern Elixir, some tests were added and these major implementation details were changed:
This pull request ended up being much larger than originally intended. Sorry about that. |
after some research it turns out this isn't good practise
I've removed the implementation of inspect for
|
dropping state isn't necessary with the scrubber extra_applications replaces applications in modern elixir, the application list is automatically determined from deps
this should make message grouping more effective
fix ignore list more ignore fixes
I'm planning on using this library, but I saw it was about 5 years out of date. I've updated it.
use Mix.Config
deprecated, replace withimport Config
Supervisor.Spec
deprecated, usechild_spec/1
insteadGenStage
has changed a lot since version 0.11,GenStage
modules updated to use the new designGenEvent
deprecated, use:gen_event
insteadSlackLoggerBackend.Logger
private functionhandle_event/3
was broken by updates toLogger
. I renamed itdo_handle_event/3
to distinguish it from the public function by the same name and changed it to be more robust for future changes in Logger.SLACK_LOGGER_WEBHOOK_URL
environment variable overriding config.I'm not sure about my fix for
SlackLoggerBackend.Pool
. The fix works, but I'm not sure that it should be a GenStage, it's probably meant to be a supervisor. Problem is I'm not 100% on what it does.