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

Warning: ClassName::method(): OpenTelemetry: WithSpan attribute found but attribute hooks disabled in Unknown on line 0 #1476

Closed
rauanmayemir opened this issue Jan 12, 2025 · 2 comments · Fixed by open-telemetry/opentelemetry-php-instrumentation#156
Labels
bug Something isn't working

Comments

@rauanmayemir
Copy link

Describe your environment

When ext-opentelemetry is enabled and codebase has classes with #[WithSpan] attribute, opentelemetry.attr_hooks_enabled = On also needs to be set. Otherwise, the following warning is thrown in runtime:

Warning: ClassName::method(): OpenTelemetry: WithSpan attribute found but attribute hooks disabled in Unknown on line 0

It's fine having opentelemetry.attr_hooks_enabled = On in the running code, however, PHPUnit will crash with a nebulous segfault:

zsh: trace trap  ./vendor/bin/phpunit tests/

Steps to reproduce

PHP 8.2.27
PHPUnit 10.5.40

php.ini

opentelemetry.attr_hooks_enabled = On

What is the expected behavior?

Disable warning or hooks in some way and not trigger warning

What is the actual behavior?

Unless I delete #[WithSpan] attributes or disable ext-opentelemetry altogether, there is no way to fix this.

@rauanmayemir rauanmayemir added the bug Something isn't working label Jan 12, 2025
@brettmc
Copy link
Collaborator

brettmc commented Jan 12, 2025

Hi @rauanmayemir thanks for the bug report. It sounds reasonable that warnings like this should be controllable (perhaps behind a config and off by default).

@brettmc
Copy link
Collaborator

brettmc commented Jan 20, 2025

1.1.1 released: https://pecl.php.net/package/opentelemetry/1.1.1

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
Development

Successfully merging a pull request may close this issue.

2 participants