[wiki.stajistics] push by - Edited wiki page GettingStarted through web user interface. on 2011-06-21 01:31 GMT

0 views
Skip to first unread message

staji...@googlecode.com

unread,
Jun 20, 2011, 9:32:35 PM6/20/11
to stajist...@googlegroups.com
Revision: de20fa1435ed
Author: troy.k...@gmail.com
Date: Mon Jun 20 18:31:27 2011
Log: Edited wiki page GettingStarted through web user interface.
http://code.google.com/p/stajistics/source/detail?repo=wiki&r=de20fa1435ed

Modified:
/GettingStarted.wiki

=======================================
--- /GettingStarted.wiki Wed Jun 15 20:40:26 2011
+++ /GettingStarted.wiki Mon Jun 20 18:31:27 2011
@@ -153,7 +153,7 @@
}
}}}

-=== Manually Collected ===
+=== Manually Collected Data ===

In the event that Stajitics cannot know about the data being collected
through means of the span or incident trackers, a ManualTracker can collect
the data:

@@ -176,6 +176,41 @@
this.age = age;
}
}}}
+
+=== Getting Dynamic ===
+
+In the above examples, Stajistics APIs are called directly from client
code, which can be a large commitment for certain code bases. The following
shows a few ways to use Stajistics in a less intrusive manner.
+
+==== Interface Proxy ====
+
+A StatsProxy will wrap an Object, implement one or more of its interfaces,
and collect statistics on method calls. An example way to use a StatsProxy
that would minimize coupling to the Stajistics API would be to proxy
services coming out of a factory.
+
+{{{
+
+ public class ServiceFactory {
+
+ public Service createService(String name) {
+
+ Service service = new ServiceImpl(name);
+
+ // Create a key to uniquely represent the service
+ StatsKey serviceKey = Stats.buildKey("services")
+ .withAttribute("name", name)
+ .newKey();
+
+ // Proxy the service, implementing all of its interfaces
+ service = StatsProxy.wrap(Stats.getManager(),
+ serviceKey,
+ service);
+
+ // Clients of the factory are none the wiser :O
+
+ return service;
+ }
+
+ }
+
+}}}

== 5. View Collected Statistics ==

Reply all
Reply to author
Forward
0 new messages