Skip to content

Make span attributes json parseable for celery #3169

Open
@shivanshuraj1333

Description

Describe your environment

OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.8.10)
Package version: (e.g., 0.46.0)

What happened?

Currently, the "delivery_info" attribute in celery is a string and not a map (or even a json).
The attribute is transformed into a string, which makes it hard to parse, and one has to use regex instead.

Steps to Reproduce

Run the celery instrumentation application from https://github.com/shivanshuraj1333/celery-opentelemetry-instrumentation/

Expected Result

attribute name: celetry.delivery_info

option 1: return a python dict

{
    'exchange': '',
    'routing_key': 'queue2',
    'priority': 0,
    'redelivered': False
}

option 2: return a valid json

{
  "exchange": "",
  "routing_key": "queue2",
  "priority": 0,
  "redelivered": false
}

A dict is supported by semconv and proto message https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/common/v1/common.proto#L37

Also, the unmarshalling is already supported, see.

So, let's go for having option 1 makes sense, since, it helps in extracting the keys from map values of an attribute

Actual Result

attribute name: celetry.delivery_info
value: {'exchange': '', 'routing_key': 'queue2', 'priority': 0, 'redelivered': False}

Additional context

No response

Would you like to implement a fix?

None

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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