Skip to content

Commit 3151125

Browse files
committed
chore(axiom): add additional parameters as user attributes
1 parent fa99aeb commit 3151125

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

axiom/nr_txn.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2536,13 +2536,6 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
25362536
nro_set_hash_string(params, "error.class", nr_error_get_klass(txn->error));
25372537
nro_set_hash_string(params, "error.message",
25382538
nr_error_get_message(txn->error));
2539-
if (nr_error_get_file(txn->error) && nr_error_get_context(txn->error)) {
2540-
nro_set_hash_string(params, "error.file", nr_error_get_file(txn->error));
2541-
nro_set_hash_int(params, "error.line", nr_error_get_line(txn->error));
2542-
nro_set_hash_string(params, "error.context",
2543-
nr_error_get_context(txn->error));
2544-
nro_set_hash_int(params, "error.no", nr_error_get_no(txn->error));
2545-
}
25462539
nro_set_hash_string(params, "transactionName", txn->name);
25472540
nro_set_hash_double(params, "duration",
25482541
((double)duration) / NR_TIME_DIVISOR_D);
@@ -2590,6 +2583,19 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
25902583
NR_ATTRIBUTE_DESTINATION_ERROR);
25912584
user_attributes = nr_attributes_user_to_obj(txn->attributes,
25922585
NR_ATTRIBUTE_DESTINATION_ERROR);
2586+
if (nr_error_get_file(txn->error) && nr_error_get_context(txn->error)) {
2587+
if (NULL == user_attributes) {
2588+
user_attributes = nro_new_hash();
2589+
}
2590+
nro_set_hash_string(user_attributes, "user.error.file",
2591+
nr_error_get_file(txn->error));
2592+
nro_set_hash_int(user_attributes, "user.error.line",
2593+
nr_error_get_line(txn->error));
2594+
nro_set_hash_string(user_attributes, "user.error.context",
2595+
nr_error_get_context(txn->error));
2596+
nro_set_hash_int(user_attributes, "user.error.no",
2597+
nr_error_get_no(txn->error));
2598+
}
25932599
event = nr_analytics_event_create(params, agent_attributes, user_attributes);
25942600

25952601
nro_delete(params);

0 commit comments

Comments
 (0)