Skip to content

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
@adrianna-chang-shopify adrianna-chang-shopify force-pushed the ac-structured-events branch 4 times, most recently from 2731985 to 071670b Compare August 13, 2025 18:23
@rafaelfranca
Copy link
Member

Can you submit those PRs to Rails now?

@zzak zzak changed the base branch from ac-structured-events to main August 14, 2025 07:13
@zzak zzak closed this Aug 14, 2025
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.

3 participants