-
Notifications
You must be signed in to change notification settings - Fork 70
feat(agent): add additional arguments as error attributes for newrelic_notice_error #942
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
Closed
+722
−68
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e4e0491
feat(agent): handle additional args for newrelic_notice_error
hahuja2 addcdec
chore(axiom): add unit tests
hahuja2 b7fe442
chore(axiom): add integration tests
hahuja2 09648a4
chore(axiom): format function
hahuja2 449c525
chore(agent): remove unnecessary use of nr_strdup
hahuja2 a232371
chore(agent): add helper function for nr_error_create
hahuja2 382c5d9
chore(axiom): reduce code duplication
hahuja2 20b568b
chore(axiom): update description and remove option variable
hahuja2 3481c07
chore(axiom): remove unnecessary function
hahuja2 93d9f8b
Update axiom/tests/test_txn.c
hahuja2 08c4261
chore(axiom): add additional parameters as user attributes
hahuja2 2da5096
chore(agent): simplify if statement
hahuja2 524754d
chore(axiom): remove helper function and add if statements
hahuja2 2017e8e
chore(axiom): change usage of 0 to NULL
hahuja2 28b6f33
chore(axiom): remove if check
hahuja2 92b0d2d
chore(axiom): update comments
hahuja2 1ec5164
chore(axiom): remove helper function and add additional if statements
hahuja2 cbe1fa2
chore(axiom): fix duplication
hahuja2 604762c
chore(axiom): add comments
hahuja2 a7a519c
chore(axiom): allow NULL to be passed in as a parameter
hahuja2 9f44c72
chore(axiom): remove helper function and split up if statements
hahuja2 2c72637
chore(axiom): add description
hahuja2 8099059
chore(axiom): update unit tests
hahuja2 62afe8a
chore(axiom): update unit tests
hahuja2 785e83c
chore(axiom): modify unit tests
hahuja2 a47bf1d
chore(tests): add integration tests
hahuja2 8b6a0e3
chore(axiom): create nr_user_error_t struct
hahuja2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,14 @@ | |
*/ | ||
typedef struct _nr_error_t nr_error_t; | ||
|
||
typedef struct _nr_user_error_t { | ||
char* user_error_message; /* User error message */ | ||
char* user_error_file; /* User error file */ | ||
char* user_error_context; /* User error context */ | ||
int user_error_line; /* User error line */ | ||
int user_error_number; /* User error number */ | ||
} nr_user_error_t; | ||
|
||
/* | ||
* Purpose : Create a new error. | ||
* | ||
|
@@ -38,40 +46,80 @@ extern nr_error_t* nr_error_create(int priority, | |
const char* span_id, | ||
nrtime_t when); | ||
|
||
extern void nr_user_error_destroy(nr_user_error_t* user_error_ptr); | ||
|
||
extern nr_user_error_t* nr_user_error_create(const char* user_error_message, | ||
int user_error_number, | ||
const char* user_error_file, | ||
int user_error_line, | ||
const char* user_error_context); | ||
|
||
/* | ||
* Purpose : Create a new error for the use case where additional parameters are | ||
* passed in. The following parameters are required and can not be NULL: klass | ||
* and stacktrace_json. If these are NULL, the function will return 0. The | ||
* remaining parameters can be passed in as NULL if they are not needed. | ||
* | ||
* Params : 1. The importance of the error. Higher number is more important. | ||
* 2. Message string. | ||
* 3. Class string. This string is used to aggregate errors in RPM. | ||
* RPM does not expect strings from a specific namespace. | ||
* The PHP agent uses PHP's predefined error constant names. | ||
* Examples are "E_ERROR" and "E_WARNING". | ||
* 4. Error file provided by user. | ||
* 5. Error line provided by user. | ||
* 6. Error context provided by user. | ||
* 7. Error number provided by user. | ||
* 8. String containing stack trace in JSON format. | ||
* 9. Span ID | ||
* 10. When the error occurred. | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be good to explain if all are required or if there are certain combinations allowed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added: 9fad7fa |
||
* Returns : A newly allocated error, or 0 on failure. | ||
*/ | ||
extern nr_error_t* nr_error_create_additional_params( | ||
int priority, | ||
const char* message, | ||
const char* klass, | ||
nr_user_error_t* user_error, | ||
const char* stacktrace_json, | ||
const char* span_id, | ||
nrtime_t when); | ||
|
||
/* | ||
* Purpose : Retrieve error fields for the purpose of creating attributes. | ||
*/ | ||
|
||
/* | ||
* Purpose : Get the message of an error. | ||
* | ||
* Returns : The message of the error or NULL on failure. | ||
* Returns : The message of the error or NULL if not defined. | ||
*/ | ||
extern const char* nr_error_get_message(const nr_error_t* error); | ||
/* | ||
* Purpose : Get the klass of an error. | ||
* | ||
* Returns : The klass of the error or NULL on failure. | ||
* Returns : The klass of the error or NULL if not defined. | ||
*/ | ||
extern const char* nr_error_get_klass(const nr_error_t* error); | ||
|
||
/* | ||
* Purpose : Get the span_id of an error. | ||
* | ||
* Returns : The span_id of the error or NULL on failure. | ||
* Returns : The span_id of the error or NULL if not defined. | ||
*/ | ||
extern const char* nr_error_get_span_id(const nr_error_t* error); | ||
|
||
/* | ||
* Purpose : Get the time of an error. | ||
* | ||
* Returns : The time of the error or 0 on failure. | ||
* Returns : The time of the error or 0 if not defined. | ||
*/ | ||
extern nrtime_t nr_error_get_time(const nr_error_t* error); | ||
|
||
/* | ||
* Purpose : Get the priority of an error. | ||
* | ||
* Returns : The priority of the error or 0 on failure. | ||
* Returns : The priority of the error or 0 if not defined. | ||
*/ | ||
extern int nr_error_priority(const nr_error_t* error); | ||
|
||
|
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these guards removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were removed because these guards are being checked before this helper function is called. An example of this is in nr_error_create.