Skip to content

Commit 08c4261

Browse files
hahuja2mfulb
authored andcommitted
chore(axiom): add additional parameters as user attributes
1 parent 93d9f8b commit 08c4261

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
@@ -2537,13 +2537,6 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
25372537
nro_set_hash_string(params, "error.class", nr_error_get_klass(txn->error));
25382538
nro_set_hash_string(params, "error.message",
25392539
nr_error_get_message(txn->error));
2540-
if (nr_error_get_file(txn->error) && nr_error_get_context(txn->error)) {
2541-
nro_set_hash_string(params, "error.file", nr_error_get_file(txn->error));
2542-
nro_set_hash_int(params, "error.line", nr_error_get_line(txn->error));
2543-
nro_set_hash_string(params, "error.context",
2544-
nr_error_get_context(txn->error));
2545-
nro_set_hash_int(params, "error.no", nr_error_get_no(txn->error));
2546-
}
25472540
nro_set_hash_string(params, "transactionName", txn->name);
25482541
nro_set_hash_double(params, "duration",
25492542
((double)duration) / NR_TIME_DIVISOR_D);
@@ -2591,6 +2584,19 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
25912584
NR_ATTRIBUTE_DESTINATION_ERROR);
25922585
user_attributes = nr_attributes_user_to_obj(txn->attributes,
25932586
NR_ATTRIBUTE_DESTINATION_ERROR);
2587+
if (nr_error_get_file(txn->error) && nr_error_get_context(txn->error)) {
2588+
if (NULL == user_attributes) {
2589+
user_attributes = nro_new_hash();
2590+
}
2591+
nro_set_hash_string(user_attributes, "user.error.file",
2592+
nr_error_get_file(txn->error));
2593+
nro_set_hash_int(user_attributes, "user.error.line",
2594+
nr_error_get_line(txn->error));
2595+
nro_set_hash_string(user_attributes, "user.error.context",
2596+
nr_error_get_context(txn->error));
2597+
nro_set_hash_int(user_attributes, "user.error.no",
2598+
nr_error_get_no(txn->error));
2599+
}
25942600
event = nr_analytics_event_create(params, agent_attributes, user_attributes);
25952601

25962602
nro_delete(params);

0 commit comments

Comments
 (0)