{"id":46,"date":"2006-05-01T22:45:02","date_gmt":"2006-05-01T21:45:02","guid":{"rendered":"http:\/\/www.epischel.de\/wordpress\/?p=46"},"modified":"2012-04-09T11:45:38","modified_gmt":"2012-04-09T10:45:38","slug":"jamon-20-monitoring-java-applications","status":"publish","type":"post","link":"https:\/\/www.epischel.de\/wordpress\/2006\/05\/jamon-20-monitoring-java-applications\/","title":{"rendered":"JAMon 2.0 &#8211; Monitoring Java Applications"},"content":{"rendered":"<p>K\u00fcrzlich wurde Version 2.0 von <a title=\"JAMon\" href=\"http:\/\/www.jamonapi.com\">JAMon <\/a>ver\u00f6ffentlicht. JAMon ist eine kleine, f\u00fcr Java-Anwendungen n\u00fctzliche Monitoring-Bibliothek.<\/p>\n<p>In Version 1  gab es die M\u00f6glichkeit, Ausf\u00fchrungszeiten von Code programmatisch zu messen:<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">java<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">Monitor m <span style=\"color: #339933\">=<\/span> MonitorFactory.<span style=\"color: #006633\">start<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #0000ff\">&quot;berechnung&quot;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">BerechnungsModul.<span style=\"color: #006633\">berechne<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">m.<span style=\"color: #006633\">stop<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>misst die Ausf\u00fchrungszeit der berechne-Methode. Das interessante hierbei ist<\/p>\n<ol>\n<li>Statistiken werden \u00fcber die Ausf\u00fchrungszeiten (genauer: Ausf\u00fchrungsdauer) erstellt (Summe, Mittelwert, Standardabweichung und sogar Einteilung in bestimmte Klassen),<\/li>\n<li>Ausf\u00fchrungszeiten werden Namen gegeben (hier &#8222;berechnung&#8220;) und<\/li>\n<li>Die Statistiken k\u00f6nnen als HTML-Report ausgegeben (programmatisch oder per JSP).<\/li>\n<\/ol>\n<p>Damit ist schon viel getan, u.a.:<\/p>\n<ul>\n<li>in Webanwendungen kann ich einen Servletfilter erstellen, der die Ausf\u00fchrungsdauer aller (oder nur bestimmter) Aufrufe misst (dies hat bei geringem Aufwand gro\u00dfen Nutzen),<\/li>\n<li>Aufrufe an &#8222;externe Systeme&#8220; (z.B. Datenbank, Web-Services oder Betriebssystem) k\u00f6nnen gemessen werden<\/li>\n<li>anhand der Messergebnisse kann der Entwickler absch\u00e4tzen, ob eine Optimierung notwendig ist<\/li>\n<li>anhand der Messergebnisse (z.B. im Vergleich zum Vortag) kann der Betrieb absch\u00e4tzen, ob sich das System derzeit aussergew\u00f6hnlich verh\u00e4lt.<\/li>\n<\/ul>\n<p>In Version 2 (ein komplettes Redesign) kommt hinzu, dass ich nicht nur Zeiten messen kann, sondern beliebige Einheiten. Ich kann z.B. eine Statistik \u00fcber die Trefferzahl einer Suche f\u00fchren:<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">java<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000066;font-weight: bold\">int<\/span> treffer <span style=\"color: #339933\">=<\/span> Suche.<span style=\"color: #006633\">ausfuehren<\/span><span style=\"color: #009900\">&#040;<\/span>...<span style=\"color: #009900\">&#041;<\/span><\/div><\/li>\n<li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">MonitorFactory.<span style=\"color: #006633\">add<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #0000ff\">&quot;treffer&quot;<\/span>,<span style=\"color: #0000ff\">&quot;anzahl&quot;<\/span>,treffer<span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>f\u00fcgt die Trefferzahl dem Statistikeintrag &#8222;treffer&#8220;, die in der Einheit &#8222;anzahl&#8220; gemessen wird, zu. Bisher habe ich nur noch nicht herausgefunden, wie man Klassen (im Sinne von &#8222;Unterteilung des Wertebereiches&#8220;) f\u00fcr nutzerdefinierte Einheiten definieren kann.<br \/>\nAlles in allem ein Tool, welches einen gro\u00dfen Nutzen bringt. Das Spring-Framework unterst\u00fctzt JAMon.<\/p>\n<div class=\"syndication-links\"><\/div>","protected":false},"excerpt":{"rendered":"<p>K\u00fcrzlich wurde Version 2.0 von JAMon ver\u00f6ffentlicht. JAMon ist eine kleine, f\u00fcr Java-Anwendungen n\u00fctzliche Monitoring-Bibliothek. In Version 1 gab es die M\u00f6glichkeit, Ausf\u00fchrungszeiten von Code programmatisch zu messen: [java] Monitor m = MonitorFactory.start(&#8222;berechnung&#8220;); BerechnungsModul.berechne(); m.stop(); [\/java] misst die Ausf\u00fchrungszeit der berechne-Methode. Das interessante hierbei ist Statistiken werden \u00fcber die Ausf\u00fchrungszeiten (genauer: Ausf\u00fchrungsdauer) erstellt (Summe, Mittelwert,&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"webmentions_disabled_pings":false,"webmentions_disabled":false,"footnotes":""},"categories":[3,2],"tags":[120,119],"series":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-java","category-entwicklung","tag-java","tag-entwicklung","kind-"],"kind":false,"_links":{"self":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":2,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/46\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/tags?post=46"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/series?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}