Support for using own Representation Serializer
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start in src/DependencyInjection/SentryExtension.php around lines 123-125 and compare the requested sentry.yaml representation_serializer option with the existing bundle configuration. Trace how representation serialization is wired, then verify that a configured custom serializer can format objects with values such as an entity ID without breaking the default behavior.
Written by the indexing model from the issue text.
Description
I would like to support something similar as discussed in this issue: https://github.com/getsentry/sentry-php/issues/889
- Old:
Object: App\Entity\SomeEntity - New:
Object: App\Entity\SomeEntity(#123)
A solution for this would be this:
use Sentry\Serializer\Serializable;
class ExampleObject implements Serializable
{
private $id = 123;
public function toSentry(): array
{
return [
'internal_state' => 'Object: ExampleObject(#' . $this->id . ')' ,
];
}
}
But I would rather have a more re-usable solution, via a custom Serializer:
# sentry.yaml
sentry:
representation_serializer: App\Sentry\RepresentationSerializer
# App\Sentry\RepresentationSerializer.php
class RepresentationSerializer extends AbstractSerializer implements RepresentationSerializerInterface
{
public function representationSerialize($value)
{
if (\is_object($value)) {
return 'Object ' . \get_class($value) . '(#' . $value->getId() . ')';
}
}
}
For this we need to be able to pass a custom Serializer to this bundle. Would it be possible to support using a custom Serializer with the sentry-symfony bundle?
https://github.com/getsentry/sentry-symfony/blob/master/src/DependencyInjection/SentryExtension.php#L123-L125
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 474
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-php
-
Improvement PHP Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
getsentry/sentry-php#2173 · 1 comment ·
-
PHP Task
getsentry/sentry-php#2162 · 1 comment · 1 assignee ·
-
PHP
getsentry/sentry-php#2140 · 1 comment · 1 assignee ·
-
5.0 Improvement PHP
getsentry/sentry-php#1956 · 1 comment · 1 assignee ·
-
PHP Spans Task
getsentry/sentry-php#1954 · 1 comment · 1 assignee ·
All issues in getsentry/sentry-php
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
coollabsio/coolify#11927 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100