|
66 | 66 | /********* WRITING APPLICATION-LEVEL STATISTICS **********/
|
67 | 67 |
|
68 | 68 | /**
|
69 |
| - * To write statistics, obtain a StatWriter for a particular domain, and then |
70 |
| - * use the writer's incr(), set(), and push() methods. |
71 |
| - * |
72 |
| - */ |
| 69 | + * To maintain statistics, a module keeps its own statistics object, |
| 70 | + * and registers that object with the stats module. |
73 | 71 |
|
74 |
| -/** Get a stats writer for a domain. |
| 72 | +/** Register statistics for a domain. |
75 | 73 | * IMMEDIATE
|
76 | 74 | *
|
77 |
| - * The domain is specified as an array literal |
78 | 75 | * EXAMPLES:
|
79 |
| - * var stats = stats_module.get_writer(["app"]); |
80 |
| - * var stats = stats_module.get_writer(["app","user_connections"]); |
81 |
| - * |
82 |
| - * stats.incr(["created"]); |
83 |
| - * stats.incr(["get","cached"]); |
84 |
| - * stats.set(["login"],"enabled"); |
85 |
| - * stats.push(["users"], current_user); |
86 |
| - */ |
87 |
| - getWriter([ domain ]); |
88 |
| - |
89 |
| - |
90 |
| -/*** StatWriter methods ***/ |
91 |
| - |
92 |
| -/** Coerce the value at domain to a Number, then set it to 1 (if new) |
93 |
| - * or increment it (if existing). |
94 |
| - * The domain is specified as an array literal. |
95 |
| - * A single-part domain can alternately be given as a string |
96 |
| - * IMMEDIATE |
97 |
| - * |
98 |
| - */ |
99 |
| - statWriter.incr(domain); |
100 |
| - |
101 |
| - |
102 |
| -/** Set the current value at "domain" to "value". |
103 |
| - * IMMEDIATE |
104 |
| - * The domain is specified as an array literal. |
105 |
| - * A single-part domain can alternately be given as a string |
106 |
| - * |
107 |
| - */ |
108 |
| - statWriter.set(domain, value); |
109 |
| - |
110 |
| - |
111 |
| -/** Coerce the value at "domain" to an Array, then push value to it. |
112 |
| - * IMMEDIATE |
113 |
| - * The domain is specified as an array literal. |
114 |
| - * A single-part domain can alternately be given as a string |
115 |
| - * |
116 |
| - * Note that pop(), etc. are missing; to access the array directly, use query() |
117 |
| - * to fetch it. |
| 76 | + * stats_module.register(my_stats, "app"); |
| 77 | + * stats_module.register(module_stats, "app","sub_module_1"); |
118 | 78 | *
|
119 | 79 | */
|
120 |
| - statWriter.push(domain, value); |
121 |
| - |
| 80 | + register(stats_container, domain_part, ... ); |
0 commit comments