opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

fix(celery): prevent a warning when only one of time limits is set

Open maxkomarychev opened this issue 2 years ago • 3 comments
trafficstars

I am not 100% sure what is the correct way to fix this issue and looking for feedback from maintainers

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2022

This fixes a warning from https://github.com/open-telemetry/opentelemetry-python/blob/34d11d59e9b37052eb3aa6706288641ecb3056e7/opentelemetry-api/src/opentelemetry/attributes/init.py#L86-L93 when running celery tasks with one of time limits set.

For example:

@app.task(soft_time_limit=42)
def add(x, y):
    return x + y

or

@app.task(time_limit=42)
def add(x, y):
    return x + y

which produces heterogenous sequence int, str or str,int of attribute celery.timelimit

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [ ] Test A

Does This PR Require a Core Repo Change?

  • [ ] Yes. - Link to PR:
  • [x] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [x] Followed the style guidelines of this project
  • [x] Changelogs have been updated
  • [x] Unit tests have been added
  • [x] Documentation has been updated

maxkomarychev avatar Oct 27 '23 13:10 maxkomarychev