Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions agents/plugins/mk_jolokia.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@
"tomcat": [
("*:type=Manager,*", "activeSessions,maxActiveSessions", None, ["path", "context"], False),
("*:j2eeType=Servlet,name=default,*", "stateName", None, ["WebModule"], False),
# Check not yet working
("*:j2eeType=Servlet,name=default,*", "requestCount", None, ["WebModule"], False),
# too wide location for addressing the right info
# ( "*:j2eeType=Servlet,*", "requestCount", None, [ "WebModule" ] , False),
# Check not yet working. Counts only requests handled by the default servlet.
# ("*:j2eeType=Servlet,name=default,*", "requestCount", None, ["WebModule"], False),
# Too wide location for addressing the right info. Compensation implemented in fetch_metric.
( "*:j2eeType=Servlet,*", "requestCount", None, [ "WebModule" ] , False),
],
"jboss": [
("*:type=Manager,*", "activeSessions,maxActiveSessions", None, ["path", "context"], False),
Expand Down Expand Up @@ -580,6 +580,17 @@ def fetch_metric(inst, path, title, itemspec, inst_add=None):
values = fetch_var(inst, "read", path, use_target=True)
item_list = make_item_list((), values, itemspec)

# aggregate request counts over all servlets per web application
# (identified by the web applications context path) and rewrite item list
if path == "*:j2eeType=Servlet,*/requestCount":
request_counts = {} # type: dict[str, int]
for subinstance, partial_request_count in item_list:
context_path = subinstance[0]
request_counts[context_path] = request_counts.get(context_path, 0) + partial_request_count
item_list = []
for context_path, total_request_count in request_counts.items():
item_list.append(((context_path, 'requestCount'), total_request_count))

for subinstance, value in item_list:
if not subinstance and not title:
sys.stderr.write("INTERNAL ERROR: %s\n" % value)
Expand Down