Skip to content

[opentelemetry-auto-laravel] Watchers/RedisCommand/Serializer error #1503

@090809

Description

@090809

Describe your environment

PHP 8.4.3 (cli) (built: Jan 15 2025 01:03:17) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.3, Copyright (c) Zend Technologies
    with Xdebug v3.4.1, Copyright (c) 2002-2025, by Derick Rethans
    with Zend OPcache v8.4.3, Copyright (c), by Zend Technologies
{
  "require": {
    "open-telemetry/opentelemetry-auto-laravel": "^1.0", (1.0.1)
    "open-telemetry/sdk": "^1.2", (1.2.1)
    ...
    "laravel/framework": "^10.0", (10.48.28)
    "laravel/horizon": "^5.24", (5.30.2)
    ...
  }
    

Steps to reproduce
Run php artisan horizon

What is the expected behavior?
No errors

What is the actual behavior?

   Error 

  Object of class Closure could not be converted to string

  at vendor/open-telemetry/opentelemetry-auto-laravel/src/Watchers/RedisCommand/Serializer.php:75
     71▕ 
     72▕         // In some cases (for example when using LUA scripts) arrays are valid parameters
     73▕         $paramsToSerialize = array_map(function($param) { return is_array($param) ? json_encode($param) : $param; }, $paramsToSerialize);
     74▕         
  ➜  75▕         return $command . ' ' . implode(' ', $paramsToSerialize);
     76▕     }
     77▕ }
     78▕ 

      +23 vendor frames 

Additional context
Horizon runs this code snippet:

RedisMasterSupervisorRepository.php:73, Laravel\Horizon\Repositories\RedisMasterSupervisorRepository->get()

        $this->connection()->pipeline(function ($pipe) use ($names) {
            foreach ($names as $name) {
                $pipe->hmget('master:'.$name, ['name', 'pid', 'status', 'supervisors', 'environment']);
            }
        });

Then it, as event, catched via RedisCommandWatcher with parameter - pipeline closure. Closure cannot be converted as string.
Pipeline isnt Redis command, its internal Illuminate/Redis/Connections/PhpRedisConnection construction, but it used for event dispatching also.

Probably, we need drop serialization for "Pipeline" call, as we can't extract data from it correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions