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

NoopSpan doesn't have additional methods #140

Closed
funkjedi opened this issue Nov 23, 2018 · 8 comments
Closed

NoopSpan doesn't have additional methods #140

funkjedi opened this issue Nov 23, 2018 · 8 comments
Labels
🐛 bug Something isn't working

Comments

@funkjedi
Copy link
Contributor

funkjedi commented Nov 23, 2018

Integration works fine for web requests but my Laravel workers fail when running artisan queue:work

Symfony\Component\Debug\Exception\FatalThrowableError Call to undefined method OpenTracing\NoopSpan::setResource() 
    vendor/datadog/dd-trace/src/DDTrace/Integrations/PDO/PDOIntegration.php:42 PDO::DDTrace\Integrations\PDO\{closure}
    vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68 Illuminate\Database\Connectors\Connector::createPdoConnection
    vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:44 Illuminate\Database\Connectors\Connector::createConnection
    vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php:24 Illuminate\Database\Connectors\MySqlConnector::connect

The problem appears to be the tracer is trying to use NoopSpan which doesn't have the extra methods implemented in DDTrace\Span.

if (!$this->config['enabled']) {
return NoopSpan::create();
}

There probably needs to be a OpenTracing\NoopSpan subclass in DDTrace that implements all the additional methods that have been added.

Temporarily worked around by registering the DDTrace service provider from my AppServiceProvider only when not on CLI.

/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    if (extension_loaded('ddtrace') && php_sapi_name() !== 'cli') {
        $this->app->register(\DDTrace\Integrations\LaravelProvider::class);
    }
@labbati
Copy link
Member

labbati commented Nov 23, 2018

Hi @funkjedi, thanks for the issue. Working on it very soon!

@labbati
Copy link
Member

labbati commented Nov 23, 2018

Fixed by #141 currently in CR.

@labbati labbati added the 🐛 bug Something isn't working label Nov 23, 2018
@labbati labbati modified the milestone: 0.4.2 Nov 23, 2018
@labbati
Copy link
Member

labbati commented Nov 26, 2018

Hi @funkjedi, 0.4.2 has been released: https://github.com/DataDog/dd-trace-php/releases/tag/0.4.2
Can you please confirm that this release fixes your issue?
Thanks for the patience!

@alkin
Copy link

alkin commented Nov 27, 2018

I am getting an error that may be related to this issue:

Call to undefined method OpenTracing\NoopSpan::setRawError()

Checking the code i found that the method is called in two integrations:

src/DDTrace/Integrations/Curl/CurlIntegration.php
src/DDTrace/Integrations/PDO/PDOIntegration.php

@labbati
Copy link
Member

labbati commented Nov 29, 2018

Hi @alkin , we are aware of the issue and we will be providing a fix in two steps:

  • initially we are just returning a DDTrace version of NoopSpan which provides the required methods
  • then we will refactor our integration with open tracing entirely relying on our classes (which will be compatible with open tracing though)
    Working on it today, for the first step, which will be enough to work around the issue, though.

@labbati
Copy link
Member

labbati commented Nov 29, 2018

Just to let you know, we just release 0.5.0 which fixes the issue reported here (we implemented our own NoopSpan as @funkjedi was suggesting). We will also go further soon and slightly refactor the way we integrate with OpenTracing.

If you have a moment and can confirm that this actually works for you it would be great.

Thanks for the patience.

@funkjedi
Copy link
Contributor Author

funkjedi commented Dec 1, 2018

So far so good.

@labbati
Copy link
Member

labbati commented Dec 3, 2018

Closing this issue as it seems to be resolved!

@labbati labbati closed this as completed Dec 3, 2018
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

No branches or pull requests

3 participants