|
252 | 252 | "tomcat": [ |
253 | 253 | ("*:type=Manager,*", "activeSessions,maxActiveSessions", None, ["path", "context"], False), |
254 | 254 | ("*:j2eeType=Servlet,name=default,*", "stateName", None, ["WebModule"], False), |
255 | | - # Check not yet working |
256 | | - ("*:j2eeType=Servlet,name=default,*", "requestCount", None, ["WebModule"], False), |
257 | | - # too wide location for addressing the right info |
258 | | - # ( "*:j2eeType=Servlet,*", "requestCount", None, [ "WebModule" ] , False), |
| 255 | + # Check not yet working. Counts only requests handled by the default servlet. |
| 256 | + # ("*:j2eeType=Servlet,name=default,*", "requestCount", None, ["WebModule"], False), |
| 257 | + # Too wide location for addressing the right info. Compensation implemented in fetch_metric. |
| 258 | + ( "*:j2eeType=Servlet,*", "requestCount", None, [ "WebModule" ] , False), |
259 | 259 | ], |
260 | 260 | "jboss": [ |
261 | 261 | ("*:type=Manager,*", "activeSessions,maxActiveSessions", None, ["path", "context"], False), |
@@ -580,6 +580,17 @@ def fetch_metric(inst, path, title, itemspec, inst_add=None): |
580 | 580 | values = fetch_var(inst, "read", path, use_target=True) |
581 | 581 | item_list = make_item_list((), values, itemspec) |
582 | 582 |
|
| 583 | + # aggregate request counts over all servlets per web application |
| 584 | + # (identified by the web applications context path) and replace item list |
| 585 | + if path == "*:j2eeType=Servlet,*/requestCount": |
| 586 | + item_list_map = {} # type: dict[str, int] |
| 587 | + for subinstance, partial_request_count in item_list: |
| 588 | + context_path = subinstance[0] |
| 589 | + item_list_map[context_path] = item_list_map.get(context_path, 0) + partial_request_count |
| 590 | + item_list = [] |
| 591 | + for context_path, total_request_count in item_list_map.items(): |
| 592 | + item_list.append(((context_path, 'requestCount'), total_request_count)) |
| 593 | + |
583 | 594 | for subinstance, value in item_list: |
584 | 595 | if not subinstance and not title: |
585 | 596 | sys.stderr.write("INTERNAL ERROR: %s\n" % value) |
|
0 commit comments