summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_stats_aggregator.erl
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2009-10-24 04:14:12 +0000
committerPaul Joseph Davis <davisp@apache.org>2009-10-24 04:14:12 +0000
commita883c9aa32f00b10b85dfeefbb0dcb5b890c231a (patch)
tree0fdb172d1a1a54374d4c51eaabdcb7a3357c03c6 /src/couchdb/couch_stats_aggregator.erl
parentdf38ecb4975f250f7a93b7327f8244d618d5ab99 (diff)
Move stat descriptions out of the config.
This lists stat descriptions in an Erlang term file to avoid abusing the config system. Uses a file in CouchDB's priv directory that is a list of three-tuple terms. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@829304 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_stats_aggregator.erl')
-rw-r--r--src/couchdb/couch_stats_aggregator.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/couchdb/couch_stats_aggregator.erl b/src/couchdb/couch_stats_aggregator.erl
index 6833fcbe..01e0f62a 100644
--- a/src/couchdb/couch_stats_aggregator.erl
+++ b/src/couchdb/couch_stats_aggregator.erl
@@ -90,16 +90,17 @@ init(_) ->
ets:new(?MODULE, [named_table, set, protected]),
SampleStr = couch_config:get("stats", "samples", "[0]"),
{ok, Samples} = couch_util:parse_term(SampleStr),
- lists:foreach(fun({KeyStr, Value}) ->
- {ok, Key} = couch_util:parse_term(KeyStr),
+ PrivDir = couch_util:priv_dir(),
+ {ok, Descs} = file:consult(filename:join(PrivDir, "stat_descriptions.cfg")),
+ lists:foreach(fun({Sect, Key, Value}) ->
lists:foreach(fun(Secs) ->
Agg = #aggregate{
description=list_to_binary(Value),
seconds=Secs
},
- ets:insert(?MODULE, {{Key, Secs}, Agg})
+ ets:insert(?MODULE, {{{Sect, Key}, Secs}, Agg})
end, Samples)
- end, couch_config:get("stats_descriptions")),
+ end, Descs),
Self = self(),
ok = couch_config:register(