open-telemetry / open-telemetry/opentelemetry-python-contrib

"Invalid type Exchange for attribute value. Expected one of `bool, str, bytes, int, float` or a sequence of those types" warning when Celery task runs another celery task

Open
#1,195 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Celery custom configuration:

from kombu import Exchange, Queue
exchange = Exchange('custom_exchange', type='direct')
queue = Queue('custom_q', exchange, task)
class Router:
    def route_for_task(self, task, *args, **kwargs):
        return {
            'queue': queue(task),
            'exchange': exchange,
            'routing_key': 'my_key'
        }

Steps to reproduce
Run celery task from another celery task.

@celery.task()
def task_1(*args, **kwargs):
    task_2.apply_async(*args, **kwargs)

What is the actual behavior?

[WORKER / WARNING] Invalid type Exchange for attribute value. Expected one of ["bool","str","bytes","int","float"] or a sequence of those types

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning with the custom Router, Exchange, Queue, and the task_1/task_2 apply_async flow shown in the issue. Trace how the routing result is passed when one Celery task runs another, then verify that the reproduced flow no longer emits the invalid Exchange-type warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.