Revert "Revert "Collect ra open file stats""
This reverts commit 1770a2178e4f778f9c99847a5159459ffbdace0e.
This commit is contained in:
		
							parent
							
								
									85cab2d3c3
								
							
						
					
					
						commit
						85265430e5
					
				|  | @ -42,7 +42,7 @@ | |||
|                      rates_mode, uptime, run_queue, processors, exchange_types, | ||||
|                      auth_mechanisms, applications, contexts, log_files, | ||||
|                      db_dir, config_files, net_ticktime, enabled_plugins, | ||||
|                      mem_calculation_strategy]). | ||||
|                      mem_calculation_strategy, ra_open_file_metrics]). | ||||
| 
 | ||||
| %%-------------------------------------------------------------------- | ||||
| 
 | ||||
|  | @ -230,7 +230,22 @@ i(gc_bytes_reclaimed, _State) -> | |||
|     Words * erlang:system_info(wordsize); | ||||
| i(context_switches, _State) -> | ||||
|     {Sw, 0} = erlang:statistics(context_switches), | ||||
|     Sw. | ||||
|     Sw; | ||||
| i(ra_open_file_metrics, _State) -> | ||||
|     [{ra_log_wal, ra_metrics(ra_log_wal)}, | ||||
|      {ra_log_file_segment_writer, ra_metrics(ra_log_file_segment_writer)}]. | ||||
| 
 | ||||
| ra_metrics(K) -> | ||||
|     try | ||||
|         case ets:lookup(ra_open_file_metrics, whereis(K)) of | ||||
|             [] -> 0; | ||||
|             [{_, C}] -> C | ||||
|         end | ||||
|     catch | ||||
|         error:badarg -> | ||||
|             %% On startup the mgmt might start before ra does | ||||
|             0 | ||||
|     end. | ||||
| 
 | ||||
| resource_alarm_set(Source) -> | ||||
|     lists:member({{resource_limit, Source, node()},[]}, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue