Draft
Conversation
Introduce a helper to cleanup the libddprof errors
nsavoire
reviewed
Apr 13, 2023
|
|
||
| inline void log_warn_and_drop_error(std::string_view message, | ||
| ddog_Error *error) { | ||
| defer { ddog_Error_drop(error); }; |
|
|
||
| LG_ERR("[EXPORTER] Failure generate tag (%.*s)", | ||
| (int)push_tag_res.err.message.len, push_tag_res.err.message.ptr); | ||
| log_warn_and_drop_error("[EXPORTER] Failure generate tag", |
Collaborator
There was a problem hiding this comment.
Won't the error message be logged twice ?
What is the benefit of using log_warn_and_drop_error ?
Collaborator
Author
There was a problem hiding this comment.
So I was not using ddog_Error_message. The aim is to have a function you can always call in case of error and not think too hard about what to do.
Ideally it would handle the error returns with it, though that behavior is different across the files.
r1viollet
commented
May 3, 2023
| exporter->_exporter = res_exporter.ok; | ||
| } else { | ||
| defer { ddog_Error_drop(&res_exporter.err); }; | ||
| log_warn_and_drop_error("[EXPORTER] Failure form ddog_prof_Exporter_new", |
Collaborator
Author
There was a problem hiding this comment.
double log to be fixed
Collaborator
Author
|
Possible improvements:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Introduce a helper to cleanup the libddprof errors
Motivation
It is easy to make mistakes when taking into account libddprof errors.