refactor(metrics): extract error.type resolver to a shared utility#32
Merged
jstojiljkovic merged 1 commit intoMay 10, 2026
Merged
Conversation
Replaces the inline anonymous-class fallback in OpenTelemetryMetricsMiddleware with a reusable Util\ErrorTypeResolver, deduplicating logic that the parallel metrics-http-client / metrics-http-server / metrics-doctrine PRs introduce under the same name.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
jstojiljkovic
approved these changes
May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pure cleanup. Removes the inline
resolveErrorType()helper that #27 introduced inOpenTelemetryMetricsMiddlewareand replaces it with a sharedUtil\ErrorTypeResolver::resolve().Why
The same FQCN-with-anonymous-class fallback shows up identically in the parallel metrics
PRs:
feat(metrics): add Messenger dispatch metricsfeat(metrics): add HTTP client metricsfeat(metrics): add HTTP server metricsfeat(metrics): add Doctrine DBAL metricsThis PR is mostly useful once at least one of those lands: it consolidates the
duplication into one place so the next contributor doesn't have to choose which copy to
call. If none of the metrics-* PRs are accepted, this refactor is harmless but loses most of
its motivation.
Behaviour
No semantic change. The resolver is byte-equivalent to the inline implementation: returns
$exception::class, falls back toget_parent_class($exception) ?: \Throwable::classwhenthe FQCN contains
@anonymous.Tests
Util\ErrorTypeResolverTestcovers root-namespace, namespaced,anonymous-extends-RuntimeException and anonymous-extends-Exception cases.
error.typevalues,untouched.
Conflict handling
Whichever metrics-* PR merges first lands
Util\ErrorTypeResolveron master. After that,this PR rebases and the file-introduction commit drops automatically (Git detects identical
content). If this PR merges first instead, the metrics-* PRs do the same on rebase.