Skip to content

Commit

Permalink
fix(agent): Adds guid attribute
Browse files Browse the repository at this point in the history
Adds the "guid" intrinsics attribute to ErrorTrace and TransactionError
to aid in the linking of these in errors inbox UI.
  • Loading branch information
mfulb committed Mar 4, 2024
1 parent f2b4c9c commit 74c4d6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion axiom/cmd_txndata_transmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
char* nr_txndata_error_to_json(const nrtxn_t* txn) {
nrobj_t* agent_attributes;
nrobj_t* user_attributes;
nrobj_t* intrinsics_attributes;
char* json;

if (0 == txn->error) {
Expand All @@ -51,12 +52,19 @@ char* nr_txndata_error_to_json(const nrtxn_t* txn) {
user_attributes = nr_attributes_user_to_obj(txn->attributes,
NR_ATTRIBUTE_DESTINATION_ERROR);

// add guid to aid error linking ui
// make copy of txn->intrisics to not cause it to be modified for other
// potential uses during conversion to flatbuffer
intrinsics_attributes = nr_copy(txn->intrinsics);
nro_set_hash_string(intrinsics_attributes, "guid", nr_txn_get_guid(txn));

json = nr_error_to_daemon_json(txn->error, txn->name, nr_txn_get_guid(txn),
agent_attributes, user_attributes,
txn->intrinsics, txn->request_uri);
intrinsics_attributes, txn->request_uri);

nro_delete(agent_attributes);
nro_delete(user_attributes);
nro_delete(intrinsics_attributes);

return json;
}
Expand Down
3 changes: 3 additions & 0 deletions axiom/nr_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,9 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {

nro_set_hash_string(params, "nr.transactionGuid", nr_txn_get_guid(txn));

// add guid to aid error linking ui
nro_set_hash_string(params, "guid", nr_txn_get_guid(txn));

if (txn->cat.inbound_guid) {
nro_set_hash_string(params, "nr.referringTransactionGuid",
txn->cat.inbound_guid);
Expand Down

0 comments on commit 74c4d6f

Please sign in to comment.