Refactor exporter API: setExporters + sampler on interface#5
Conversation
- Replace Span::addExporter() with variadic Span::setExporters() - Move sampling onto the Exporter interface (sample(): bool) - Built-in exporters take an optional sampler closure as first ctor arg - Sentry composes user sampler with its error-only filter - Span::setStorage() now accepts ?Storage (null clears); drop resetStorage/reset Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Greptile SummaryThis PR ships the 3.0.0 breaking-change refactor of the exporter API:
Confidence Score: 5/5Safe to merge; the breaking changes are intentional, well-documented, and all tests pass. The refactor is cleanly scoped: the core Span loop is simpler, the Sentry DSN validation is now robust (empty-string guard + component checks), and the sampling contract is enforced at the interface level. No logic errors were found in the changed paths. Minor gaps in tests/Exporter/SentryTest.php — Sentry::sample() behavior is not directly tested. Important Files Changed
Reviews (2): Last reviewed commit: "Apply rector suggestions" | Re-trigger Greptile |
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
parse_url('') returns ['path' => ''] rather than false, so an empty or
incomplete DSN previously slipped through and only failed later as an
opaque cURL error. Reject empty DSNs and DSNs missing the public key,
host, or project ID at construction time.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Span::addExporter()with variadicSpan::setExporters(Exporter ...)(replaces the full set; no-arg call clears).Exporterinterface viasample(Span): bool. Built-in exporters take an optionalsamplerclosure as their first constructor argument by convention.Sentryis hard-wired to error spans only; a user-supplied sampler is composed (AND) with the error filter, so it can further restrict but not broaden.Span::setStorage()now accepts?Storage— passnullto clear.resetStorage()andreset()removed.CHANGELOG.mddocumenting the 3.0.0 breaking changes.Test plan
./vendor/bin/phpunit— 91 tests passsetExporters(...)and anysetStorage(null)swaps forresetStorage()🤖 Generated with Claude Code