@@ -122,6 +122,9 @@ const ES_INDEX_NAME: &str = "scaphandre";
122122pub struct ScaphandreData {
123123 pub scaphandre_version : String ,
124124 pub scaphandre_cpu_usage_percentage : Option < u32 > ,
125+ pub scaphandre_mem_total_program_size : Option < u64 > ,
126+ pub scaphrandre_mem_resident_set_size : Option < u64 > ,
127+ pub scaphandre_mem_shared_resident_size : Option < u64 > ,
125128}
126129
127130impl ElasticExporter {
@@ -153,6 +156,10 @@ impl ElasticExporter {
153156 . body ( ScaphandreData {
154157 scaphandre_version : get_scaphandre_version ( ) ,
155158 scaphandre_cpu_usage_percentage : self . get_scaphandre_cpu_usage_percentage ( ) ,
159+ scaphandre_mem_total_program_size : self . get_scaphandre_mem_total_program_size ( ) ,
160+ scaphrandre_mem_resident_set_size : self . get_scaphandre_mem_resident_set_size ( ) ,
161+ scaphandre_mem_shared_resident_size : self
162+ . get_scaphandre_mem_shared_resident_size ( ) ,
156163 } )
157164 . send ( )
158165 . await
@@ -176,6 +183,27 @@ impl ElasticExporter {
176183 . ok ( )
177184 }
178185
186+ fn get_scaphandre_mem_total_program_size ( & self ) -> Option < u64 > {
187+ let statm_value = procfs:: process:: Process :: myself ( ) . ok ( ) ?. statm ( ) . ok ( ) ?;
188+ let page_size = procfs:: page_size ( ) . ok ( ) ?;
189+
190+ Some ( statm_value. size * page_size as u64 )
191+ }
192+
193+ fn get_scaphandre_mem_resident_set_size ( & self ) -> Option < u64 > {
194+ let statm_value = procfs:: process:: Process :: myself ( ) . ok ( ) ?. statm ( ) . ok ( ) ?;
195+ let page_size = procfs:: page_size ( ) . ok ( ) ?;
196+
197+ Some ( statm_value. resident * page_size as u64 )
198+ }
199+
200+ fn get_scaphandre_mem_shared_resident_size ( & self ) -> Option < u64 > {
201+ let statm_value = procfs:: process:: Process :: myself ( ) . ok ( ) ?. statm ( ) . ok ( ) ?;
202+ let page_size = procfs:: page_size ( ) . ok ( ) ?;
203+
204+ Some ( statm_value. shared * page_size as u64 )
205+ }
206+
179207 async fn ensure_index ( & self , client : & Elasticsearch ) -> Result < ( ) , Error > {
180208 let index_exist_resp = client
181209 . indices ( )
0 commit comments