Skip to content

Filter event reporter payloads during encoding #37

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

Open
wants to merge 6 commits into
base: ac-structured-events
Choose a base branch
from

Conversation

zzak
Copy link

@zzak zzak commented Jul 20, 2025

This is one option I came up with for filtering potentially sensitive payload data.

We filter the data as late as possible to be able to strip secrets from even custom objects.

/cc @adrianna-chang-shopify

private

def self.transform_event(event)
parameter_filter = ActiveSupport::ParameterFilter.new(ActiveSupport.filter_parameters, mask: ActiveSupport::ParameterFilter::FILTERED)
Copy link
Author

Choose a reason for hiding this comment

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

We probably want to memoize this somewhere

Ref: rails#50452

This adds a Structured Event Reporter to Rails, accessible via `Rails.event`.
It allows you to report events to a subscriber, and provides mechanisms for adding tags and context to events.

Events encompass "structured logs", but also "business events", as well as telemetry events such as metrics
and logs. The Event Reporter is designed to be a single interface for producing any kind of event in a Rails
application.

We separate the emission of events from how these events reach end consumers; applications are expected to
define their own subscribers, and the Event Reporter is responsible for emitting events to these subscribers.
Add JSON and MessagePack encoders to ActiveSupport::EventReporter.
This allows applications to serialize events to common formats without
needing to implement their own serialization logic in subscribers.
@zzak zzak force-pushed the event-reporter-filter-params-encoding branch from 913183f to 237719c Compare July 26, 2025 06:54
@adrianna-chang-shopify adrianna-chang-shopify force-pushed the ac-structured-events branch 3 times, most recently from ebd42e3 to 2e8ae57 Compare August 5, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants