1
2
3
4
5
6
7
8
9
10
11 package psiprobe;
12
13 import java.util.ArrayList;
14 import java.util.List;
15
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18 import org.springframework.context.annotation.Bean;
19 import org.springframework.context.annotation.Configuration;
20
21 import psiprobe.beans.stats.collectors.AppStatsCollectorBean;
22 import psiprobe.beans.stats.collectors.ClusterStatsCollectorBean;
23 import psiprobe.beans.stats.collectors.ConnectorStatsCollectorBean;
24 import psiprobe.beans.stats.collectors.DatasourceStatsCollectorBean;
25 import psiprobe.beans.stats.collectors.JvmMemoryStatsCollectorBean;
26 import psiprobe.beans.stats.collectors.RuntimeStatsCollectorBean;
27 import psiprobe.beans.stats.listeners.MemoryPoolMailingListener;
28 import psiprobe.beans.stats.listeners.StatsCollectionListener;
29 import psiprobe.beans.stats.providers.ConnectorSeriesProvider;
30 import psiprobe.beans.stats.providers.MultipleSeriesProvider;
31 import psiprobe.beans.stats.providers.StandardSeriesProvider;
32 import psiprobe.model.stats.StatsCollection;
33
34
35
36
37 @Configuration
38 public class ProbeConfigStats {
39
40
41 private static final Logger logger = LoggerFactory.getLogger(ProbeConfigStats.class);
42
43
44
45
46
47
48 @Bean(name = "statsCollection")
49 public StatsCollection getStatsCollection() {
50 logger.debug("Instantiated statsCollection");
51 return new StatsCollection();
52 }
53
54
55
56
57
58
59 @Bean(name = "connectorStatsCollector")
60 public ConnectorStatsCollectorBean getConnectorStatsCollectorBean() {
61 logger.debug("Instantiated connectorStatsCollector");
62 return new ConnectorStatsCollectorBean();
63 }
64
65
66
67
68
69
70 @Bean(name = "clusterStatsCollector")
71 public ClusterStatsCollectorBean getClusterStatsCollectorBean() {
72 logger.debug("Instantiated clusterStatsCollector");
73 return new ClusterStatsCollectorBean();
74 }
75
76
77
78
79
80
81 @Bean(name = "runtimeStatsCollector")
82 public RuntimeStatsCollectorBean getRuntimeStatsCollectorBean() {
83 logger.debug("Instantiated runtimeStatsCollector");
84 return new RuntimeStatsCollectorBean();
85 }
86
87
88
89
90
91
92 @Bean(name = "appStatsCollector")
93 public AppStatsCollectorBean getAppStatsCollectorBean() {
94 logger.debug("Instantiated appStatsCollector");
95 return new AppStatsCollectorBean();
96 }
97
98
99
100
101
102
103 @Bean(name = "memoryStatsCollector")
104 public JvmMemoryStatsCollectorBean getJvmMemoryStatsCollectorBean() {
105 logger.debug("Instantiated memoryStatsCollector");
106 return new JvmMemoryStatsCollectorBean();
107 }
108
109
110
111
112
113
114 @Bean(name = "datasourceStatsCollector")
115 public DatasourceStatsCollectorBean getDatasourceStatsCollectorBean() {
116 logger.debug("Instantiated datasourceStatsCollector");
117 return new DatasourceStatsCollectorBean();
118 }
119
120
121
122
123
124
125 @Bean(name = "listeners")
126 public List<StatsCollectionListener> getMemoryPoolMailingListener() {
127 logger.debug("Instantiated listeners");
128 List<StatsCollectionListener> list = new ArrayList<>();
129 list.add(new MemoryPoolMailingListener());
130 return list;
131 }
132
133
134
135
136
137
138 @Bean(name = "rcn")
139 public ConnectorSeriesProvider getConnectorSeriesProvider() {
140 logger.debug("Instantiated rcn");
141 return new ConnectorSeriesProvider();
142 }
143
144
145
146
147
148
149 @Bean(name = "cl_traffic")
150 public StandardSeriesProvider getClTraffic() {
151 logger.debug("Instantiated cl_traffic");
152 List<String> list = new ArrayList<>();
153 list.add("cluster.sent");
154 list.add("cluster.received");
155
156 StandardSeriesProvider provider = new StandardSeriesProvider();
157 provider.setStatNames(list);
158 return provider;
159 }
160
161
162
163
164
165
166 @Bean(name = "cl_request")
167 public StandardSeriesProvider getClRequest() {
168 logger.debug("Instantiated cl_request");
169 List<String> list = new ArrayList<>();
170 list.add("cluster.req.sent");
171 list.add("cluster.req.received");
172
173 StandardSeriesProvider provider = new StandardSeriesProvider();
174 provider.setStatNames(list);
175 return provider;
176 }
177
178
179
180
181
182
183 @Bean(name = "connector")
184 public StandardSeriesProvider getConnector() {
185 logger.debug("Instantiated connector");
186 List<String> list = new ArrayList<>();
187 list.add("stat.connector.{0}.requests");
188 list.add("stat.connector.{0}.errors");
189
190 StandardSeriesProvider provider = new StandardSeriesProvider();
191 provider.setStatNames(list);
192 return provider;
193 }
194
195
196
197
198
199
200 @Bean(name = "traffic")
201 public StandardSeriesProvider getTraffic() {
202 logger.debug("Instantiated traffic");
203 List<String> list = new ArrayList<>();
204 list.add("stat.connector.{0}.sent");
205 list.add("stat.connector.{0}.received");
206
207 StandardSeriesProvider provider = new StandardSeriesProvider();
208 provider.setStatNames(list);
209 return provider;
210 }
211
212
213
214
215
216
217 @Bean(name = "connector_proc_time")
218 public StandardSeriesProvider getConnectorProcTime() {
219 logger.debug("Instantiated connector_proc_time");
220 List<String> list = new ArrayList<>();
221 list.add("stat.connector.{0}.proc_time");
222
223 StandardSeriesProvider provider = new StandardSeriesProvider();
224 provider.setStatNames(list);
225 return provider;
226 }
227
228
229
230
231
232
233 @Bean(name = "memory_usage")
234 public StandardSeriesProvider getMemoryUsage() {
235 logger.debug("Instantiated memory_usage");
236 List<String> list = new ArrayList<>();
237 list.add("memory.pool.{0}");
238
239 StandardSeriesProvider provider = new StandardSeriesProvider();
240 provider.setStatNames(list);
241 return provider;
242 }
243
244
245
246
247
248
249 @Bean(name = "os_memory")
250 public StandardSeriesProvider getOsMemory() {
251 logger.debug("Instantiated os_memory");
252 List<String> list = new ArrayList<>();
253 list.add("os.memory.physical");
254 list.add("os.memory.committed");
255
256 StandardSeriesProvider provider = new StandardSeriesProvider();
257 provider.setStatNames(list);
258 return provider;
259 }
260
261
262
263
264
265
266 @Bean(name = "swap_usage")
267 public StandardSeriesProvider getSwapUsage() {
268 logger.debug("Instantiated swap_usage");
269 List<String> list = new ArrayList<>();
270 list.add("os.memory.swap");
271
272 StandardSeriesProvider provider = new StandardSeriesProvider();
273 provider.setStatNames(list);
274 return provider;
275 }
276
277
278
279
280
281
282 @Bean(name = "cpu_usage")
283 public StandardSeriesProvider getCpuUsage() {
284 logger.debug("Instantiated cpu_usage");
285 List<String> list = new ArrayList<>();
286 list.add("os.cpu");
287
288 StandardSeriesProvider provider = new StandardSeriesProvider();
289 provider.setStatNames(list);
290 return provider;
291 }
292
293
294
295
296
297
298 @Bean(name = "fd_usage")
299 public StandardSeriesProvider getFdUsage() {
300 logger.debug("Instantiated fd_usage");
301 List<String> list = new ArrayList<>();
302 list.add("os.fd.open");
303 list.add("os.fd.max");
304
305 StandardSeriesProvider provider = new StandardSeriesProvider();
306 provider.setStatNames(list);
307 return provider;
308 }
309
310
311
312
313
314
315 @Bean(name = "app_req")
316 public StandardSeriesProvider getAppReq() {
317 logger.debug("Instantiated app_req");
318 List<String> list = new ArrayList<>();
319 list.add("app.requests.{0}");
320 list.add("app.errors.{0}");
321
322 StandardSeriesProvider provider = new StandardSeriesProvider();
323 provider.setStatNames(list);
324 return provider;
325 }
326
327
328
329
330
331
332 @Bean(name = "app_avg_proc_time")
333 public StandardSeriesProvider getAppAvgProcTime() {
334 logger.debug("Instantiated app_avg_proc_time");
335 List<String> list = new ArrayList<>();
336 list.add("app.avg_proc_time.{0}");
337
338 StandardSeriesProvider provider = new StandardSeriesProvider();
339 provider.setStatNames(list);
340 return provider;
341 }
342
343
344
345
346
347
348 @Bean(name = "total_avg_proc_time")
349 public StandardSeriesProvider getTotalAvgProcTime() {
350 logger.debug("Instantiated total_avg_proc_time");
351 List<String> list = new ArrayList<>();
352 list.add("total.avg_proc_time");
353
354 StandardSeriesProvider provider = new StandardSeriesProvider();
355 provider.setStatNames(list);
356 return provider;
357 }
358
359
360
361
362
363
364 @Bean(name = "total_req")
365 public StandardSeriesProvider getTotalReq() {
366 logger.debug("Instantiated total_req");
367 List<String> list = new ArrayList<>();
368 list.add("total.requests");
369 list.add("total.errors");
370
371 StandardSeriesProvider provider = new StandardSeriesProvider();
372 provider.setStatNames(list);
373 return provider;
374 }
375
376
377
378
379
380
381 @Bean(name = "datasource_usage")
382 public StandardSeriesProvider getDatasourceUsage() {
383 logger.debug("Instantiated datasource_usage");
384 List<String> list = new ArrayList<>();
385 list.add("ds.est.{0}");
386 list.add("ds.busy.{0}");
387
388 StandardSeriesProvider provider = new StandardSeriesProvider();
389 provider.setStatNames(list);
390 return provider;
391 }
392
393
394
395
396
397
398 @Bean(name = "all_app_avg_proc_time")
399 public MultipleSeriesProvider getAllAppAvgProcTime() {
400 logger.debug("Instantiated all_app_avg_proc_time");
401 MultipleSeriesProvider provider = new MultipleSeriesProvider();
402 provider.setMovingAvgFrame(10);
403 provider.setStatNamePrefix("app.avg_proc_time.");
404 provider.setTop(4);
405 return provider;
406 }
407
408
409
410
411
412
413 @Bean(name = "all_app_req")
414 public MultipleSeriesProvider getAllAppReq() {
415 logger.debug("Instantiated all_app_req");
416 MultipleSeriesProvider provider = new MultipleSeriesProvider();
417 provider.setMovingAvgFrame(10);
418 provider.setStatNamePrefix("app.requests.");
419 provider.setTop(4);
420 return provider;
421 }
422
423 }