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

[Attribute-based hooking] SpanAttribute example does not align with the declared attribute target #1429

Open
LauJosefsen opened this issue Nov 7, 2024 · 4 comments · May be fixed by #1433
Labels
bug Something isn't working

Comments

@LauJosefsen
Copy link

Hi.

PHPStan will report the error

Attribute class OpenTelemetry\API\Instrumentation\SpanAttribute does not have the parameter target.    

If used as the examples in the readme. It is working, ignoring the stan error, so I think it just needs to be added to the attribute target? I am however not sure if it will break the anything in the extension code to do so.

This occurs with open-telemetry/api^1.1.1, which is as of writing the latest version.

@LauJosefsen LauJosefsen added the bug Something isn't working label Nov 7, 2024
@ChrisLightfootWild
Copy link
Contributor

Looks to be the same as this report, in that we are using constructor property promotion and thus facing this complaint.

@LauJosefsen
Copy link
Author

Ah sorry, I only searched through open issues, as I was sure this was a bug.

Does this mean it is a bug of phpstan and phpstorm to report this as an error?

@ChrisLightfootWild
Copy link
Contributor

@LauJosefsen I think we could leave this open and test adding the additional target parameter to see if we can make phpstan happy 👍

@LauJosefsen LauJosefsen reopened this Nov 8, 2024
@mlebrun
Copy link

mlebrun commented Nov 14, 2024

I almost created another ticket with a Psalm error. I agree, it would be great if the attribute could also target function parameters as that is what the docs recommend the attribute be used for. 🙏

I really appreciate all of the hard work going into the PHP OTEL libraries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants