Skip to content

Move encoder require up the stack #40

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 26, 2025

This way we require msgpack when calling
ActiveSupport::EventReporter.encoder(:msgpack) which can be setup and stored during boot, rather than when calling Encoder#encoder event.

In this way it is slightly earlier to detect, for example, missing gem dependency without the need for a config and railtie initializer.

We could still go that route though, just fleshing out this idea first.

adrianna-chang-shopify and others added 6 commits July 22, 2025 11:04
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.
This way we require msgpack when calling
`ActiveSupport::EventReporter.encoder(:msgpack)` which can be setup and
stored during boot, rather than when calling `Encoder#encoder` event.

In this way it is slightly earlier to detect, for example, missing gem
dependency without the need for a config and railtie initializer.

We could still go that route though, just fleshing out this idea first.
@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