@@ -2537,13 +2537,6 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
2537
2537
nro_set_hash_string (params , "error.class" , nr_error_get_klass (txn -> error ));
2538
2538
nro_set_hash_string (params , "error.message" ,
2539
2539
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
- }
2547
2540
nro_set_hash_string (params , "transactionName" , txn -> name );
2548
2541
nro_set_hash_double (params , "duration" ,
2549
2542
((double )duration ) / NR_TIME_DIVISOR_D );
@@ -2591,6 +2584,19 @@ nr_analytics_event_t* nr_error_to_event(const nrtxn_t* txn) {
2591
2584
NR_ATTRIBUTE_DESTINATION_ERROR );
2592
2585
user_attributes = nr_attributes_user_to_obj (txn -> attributes ,
2593
2586
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
+ }
2594
2600
event = nr_analytics_event_create (params , agent_attributes , user_attributes );
2595
2601
2596
2602
nro_delete (params );
0 commit comments