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