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

Ensure that request error meta-data is string #1075

Merged

Conversation

danielmitterdorfer
Copy link
Member

With this commit we ensure that the error-description property that is
added to request metadata on errors always contains a string. This
avoids serialization issues later on when these objects are written to
the metrics store.

With this commit we ensure that the `error-description` property that is
added to request metadata on errors always contains a string. This
avoids serialization issues later on when these objects are written to
the metrics store.
@danielmitterdorfer danielmitterdorfer added bug Something's wrong :Load Driver Changes that affect the core of the load driver such as scheduling, the measurement approach etc. labels Oct 7, 2020
@danielmitterdorfer danielmitterdorfer added this to the 2.0.2 milestone Oct 7, 2020
@danielmitterdorfer danielmitterdorfer self-assigned this Oct 7, 2020
if isinstance(e.error, bytes):
error_description = e.error.decode("utf-8")
else:
error_description = str(e.error)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be soo bad to leave as None given thats the only other viable type? For safety this probably makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed elsewhere I'd rather be a bit more cautious here and always enforce conversion to a string.

@danielmitterdorfer danielmitterdorfer merged commit bcf9bb8 into elastic:master Oct 7, 2020
@danielmitterdorfer danielmitterdorfer deleted the handle-byte-errs branch October 8, 2020 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's wrong :Load Driver Changes that affect the core of the load driver such as scheduling, the measurement approach etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants