Skip to content

Feat/render reports hook#84

Open
rubenvanassche wants to merge 12 commits into
mainfrom
feat/render-reports-hook
Open

Feat/render reports hook#84
rubenvanassche wants to merge 12 commits into
mainfrom
feat/render-reports-hook

Conversation

@rubenvanassche

Copy link
Copy Markdown
Member

No description provided.

Adds Flare::renderReportsUsing() so a consumer (Ignition) can render an
uncaught exception's report locally. The uncaught handler builds the report
once and invokes the render callback before send-gating, so ignored or
filtered exceptions still render locally while only sending when allowed.
Handled exceptions reported via report()/reportHandled() never render.
- report() kept untouched; finalizeReport() added for the uncaught handler
  to send an already-built report.
- FlareConfig gains a nullable $mode; FlareProvider uses it and falls back to
  the existing apiToken-based match, so current behaviour is unchanged when
  mode is null.
- Ignition mode collects and builds locally but never transmits: Api gains a
  sendingDisabled guard, set when mode === Ignition.
- Flare exposes its resolved $mode so consumers can read it.
Instead of a separate finalizeReport method, report() gains an optional
$report parameter. The uncaught handler builds the report (so it can render
it), then calls report(report: $report); the shouldReport ignore gating and
filterReports still run before sending. Minimal, backward-compatible surface.
- Ignition mode now swaps in the existing NullSender instead of an Api
  sendingDisabled flag, so transmission is a no-op with no Api change.
- report()'s first argument is a Throwable|ReportFactory union: pass a
  pre-built report and it is rendered first, then the ignore/filter gating runs.
- renderAndReport is inlined: handleException/handleError build the report when
  a renderer is registered and hand it to report().
Key the no-op sender on token presence rather than FlareMode. Without a token
there is nothing to authenticate with, so never transmit: reports and traces
still build (and Ignition renders them) but the send is a no-op. Enabled mode
with a token uses the configured sender as before.
Register Ignition's render callback on the FlareConfig (renderReportsUsing) so
the Flare provider wires it into the reporter when it is built, matching how
filterReportsCallable flows. Ignition no longer holds the Flare instance: it
keeps only the Flare and Ignition configs and does the start/shutdown wiring in
make().
The renderer is an integration hook (like gracefulSpanEnderClosure), not user
config, so it lives on the FlareProvider constructor and Flare::make() forwards
it. Removed from FlareConfig.
Renders any report that is not explicitly marked handled, so the global
handlers can stay as plain report() and integrations do not need to thread
handled: false. reportHandled()/handled: true stays silent.
Ignition constructs the FlareProvider itself to pass the renderer, so
Flare::make() no longer needs to forward it.
mode is an integration decision, not user config: it becomes a FlareProvider
constructor arg (falling back to the apiToken-based match when null) and is
removed from FlareConfig. Flare::make() passes null, so its behaviour is
unchanged.
The renderer is injected via the FlareProvider (and Reporter) constructor, so
the Reporter::reportRenderer() setter and Flare::renderReportsUsing() are dead.
Removed both; the renderer is now constructor-only, like mode.
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.

1 participant