Skip to content
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

[psalm fix level 4] TracerFactoryInterface - not internal #1119

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

gam6itko
Copy link
Contributor

@gam6itko gam6itko commented Aug 8, 2024

Q A
Bugfix?
Breaks BC?
New feature?
Issues #...
Docs PR spiral/docs#...

Remove internal annotation from:

  • TracerFactoryInterface
  • TracerInterface

Psalm level 4 triggers error

use Spiral\Telemetry\TracerFactoryInterface;

final class TelemetryDecorator implements ResponseDataHandlerInterface
{
    public function __construct(
        private readonly TracerFactoryInterface       $tracerFactory,
        private readonly ResponseDataHandlerInterface $inner,
    ) {
    }

    public function handle(array $responseData, array $options = []): array
    {     
        return $this->tracerFactory
            ->make()
            ->trace(
                name: sprintf('ResponseDataHandler [%s]', get_class($this->inner)),
                callback: fn () => $this->inner->handle($responseData, $options),
                attributes: [
                    'itemsCount' => count($responseData),
                    'options' => $options,
                ]
            );
    }
}
ERROR: InternalMethod
at /home/gam6itko/TelemetryDecorator.php:23:15
The method Spiral\Telemetry\TracerFactoryInterface::make is internal to Spiral but called from TelemetryDecorator::handle (see https://psalm.dev/175)
            ->make()


ERROR: InternalMethod
at /home/gam6itko/TelemetryDecorator.php:24:15
The method Spiral\Telemetry\TracerInterface::trace is internal to Spiral but called from TelemetryDecorator::handle (see https://psalm.dev/175)
            ->trace(

The usage example.
https://spiral.dev/docs/advanced-telemetry/current/en#create-trace-from-context

@roxblnfk
Copy link
Member

roxblnfk commented Aug 8, 2024

If we make these classes non-internal, then the message "The component is under development" needs to be removed.

@butschster is it still under development?

@butschster
Copy link
Member

If we make these classes non-internal, then the message "The component is under development" needs to be removed.

@butschster is it still under development?

Nope, it's all done now. Also, let's delete the other part of the line "The component is under development" as well.

Cheers!

@gam6itko
Copy link
Contributor Author

gam6itko commented Aug 8, 2024

deleted

@roxblnfk roxblnfk merged commit c8e5efa into spiral:master Aug 8, 2024
11 checks passed
@gam6itko gam6itko deleted the telemetry-psalm branch August 8, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants