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

Fix OTEL issues when dealing with unsupported objects #698

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Conversation

JAVGan
Copy link
Contributor

@JAVGan JAVGan commented Jul 1, 2024

This PR prevents the OTEL instrument_tracing method to crash when dealing with complex types.

It has the following changes:

First, it detects a typical IIB API response, which consists of a tuple with a Flask.Response object and the HTTP code.

Example:

def add_bundles() -> Tuple[flask.Response, int]:
    ...
    return flask.jsonify(request.to_json()), 200

Then, it also changes the execution from the else condition on instrument_tracing so any object which is not properly mapped gets converted into String before being sent as a dictionary value to the OTEL span_result.

With this we no longer see the following messages in IIB-API logs:

Invalid type Response in attribute 'result' value sequence.
Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None

Refers to CLOUDDST-23028

JAVGan added 2 commits July 1, 2024 17:38
This commit detects a typical IIB API response, which consists of a
tuple with a Flask.Response object and the HTTP code.

Example:

```
def add_bundles() -> Tuple[flask.Response, int]:
    ...
    return flask.jsonify(request.to_json()), 200
```

With this we no longer see the following messages in IIB-API logs:

```
Invalid type Response in attribute 'result' value sequence.
Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None
```

Refers to CLOUDDST-23028
This commit changes the `else` condition from `instrument_tracing` so
any object which is not properly mapped gets converted into `String`
before sending the dictionary to the span.

With this we expect to no longer have an OTEL unsupported type being
passed as a span value.

Refers to CLOUDDST-23028
@JAVGan JAVGan merged commit c7c59a6 into master Jul 2, 2024
2 checks passed
@JAVGan JAVGan deleted the otel-fix branch July 2, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants