Skip to content

[Action Cable] Add parameter filtering to logging#25090

Closed
maclover7 wants to merge 1 commit intorails:masterfrom
maclover7:jm-fix-25088
Closed

[Action Cable] Add parameter filtering to logging#25090
maclover7 wants to merge 1 commit intorails:masterfrom
maclover7:jm-fix-25088

Conversation

@maclover7
Copy link
Copy Markdown
Contributor

@michaeldever
Copy link
Copy Markdown
Contributor

This would be useful to have

@maclover7
Copy link
Copy Markdown
Contributor Author

maclover7 commented Jun 22, 2016

Sorry for my delay here -- updated my PR, and build should hopefully be passing now 👍

- Reuses most of the architecture that Action Pack uses :)
- Fixes #25088
@maclover7
Copy link
Copy Markdown
Contributor Author

👍 Build is passing

@maclover7
Copy link
Copy Markdown
Contributor Author

r? @rafaelfranca

@siegy22
Copy link
Copy Markdown
Contributor

siegy22 commented Nov 12, 2016

@maclover7 That's what I was looking for, do you think this is going to be merged in?

@rafaelfranca cascasca 🍷 😂

Copy link
Copy Markdown
Member

@rafaelfranca rafaelfranca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea but I think a better direction is to make the ActionDispatch parameter filter generic enough to not need to not use the env object and headers so we don't need this data wrapper class.

A good design would have a object that given a hash and a list of keys to be filtered return the filtered hash.

@arthurdandrea
Copy link
Copy Markdown

arthurdandrea commented Jan 9, 2017

Facing an issue similiar to #25088, I came up with a solution using ActionDispatch::Http::ParameterFilter instead of ActionDispatch::Http::FilterParameters, all the code I implemented on my ApplicationCable::Channel class.

Following @rafaelfranca suggestion, this implementation does not depend on a data wrapper class, the filter class used is generic enough and it is already part of Rails 😄.

module ApplicationCable
  class Channel < ActionCable::Channel::Base
    def action_signature(action, data)
      signature = "#{self.class.name}##{action}"
      if (arguments = data.except('action')).any?
        filter = ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters)
        signature += "(#{filter.filter(arguments).inspect})"
      end
      signature
    end
  end
end

@Anuragjain89
Copy link
Copy Markdown

@rafaelfranca

cc: @maclover7 @arthurdandrea

Do you agree with @arthurdandrea 's approach to addressing #25088 ?
If so, please advise so that @maclover7 / @arthurdandrea can submit a PR with the suggested changes.

I will be happy to volunteer / submit a PR for the same.

Thanks.

@Schwad
Copy link
Copy Markdown
Contributor

Schwad commented Sep 3, 2017

Howdy all :) do we have any thoughts on this on moving forward with the PR?

@benglewis
Copy link
Copy Markdown

What is the status of this PR? Rails has had ActionCable for a year now, but it still doesn't support filtering.

@helpse
Copy link
Copy Markdown

helpse commented Jan 10, 2018

Any update as of January 10th, 2018 ?

@dillonwelch
Copy link
Copy Markdown
Contributor

Hi @maclover7 I realize this is old, but the first step to potentially getting this merged is cleaning up the merge conflicts so this can be viewed against latest master and discussed. Thanks for the PR 💝

@cmichelQT
Copy link
Copy Markdown

Would love to see an update on this!

@rafaelfranca
Copy link
Copy Markdown
Member

Feel free to take over this PR and implement it. Now we are a generic parameter filter at ActiveSupport::ParameterFilter.

@rafaelfranca
Copy link
Copy Markdown
Member

I'm closing this since it is not going to be updated.

@calebkeene
Copy link
Copy Markdown

@rafaelfranca Is this worth re-submitting? seems to still be an issue

@rafaelfranca
Copy link
Copy Markdown
Member

#25090 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.