Merge remote-tracking branch 'origin/topic/seth/metrics-merge' into topic/bernhard/hyperloglog-with-measurement

Conflicts:
	scripts/base/frameworks/sumstats/plugins/__load__.bro
This commit is contained in:
Bernhard Amann 2013-04-23 15:27:17 -07:00
commit 567fee6439
16 changed files with 35 additions and 264 deletions

View file

@ -182,7 +182,7 @@ global thresholds_store: table[string, Key] of bool = table();
global data_added: function(ss: SumStat, key: Key, result: Result);
# Prototype the hook point for plugins to do calculations.
global add_to_reducer_hook: hook(r: Reducer, val: double, data: Observation, rv: ResultVal);
global observe_hook: hook(r: Reducer, val: double, data: Observation, rv: ResultVal);
# Prototype the hook point for plugins to initialize any result values.
global init_resultval_hook: hook(r: Reducer, rv: ResultVal);
# Prototype the hook point for plugins to merge Results.
@ -323,7 +323,7 @@ function observe(id: string, key: Key, obs: Observation)
if ( obs?$num || obs?$dbl )
val = obs?$dbl ? obs$dbl : obs$num;
hook add_to_reducer_hook(r, val, obs, result_val);
hook observe_hook(r, val, obs, result_val);
data_added(ss, key, result);
}
}

View file

@ -1,9 +1,9 @@
@load ./average
@load ./hll_unique
@load ./max
@load ./min
@load ./sample
@load ./variance
@load ./std-dev
@load ./sum
@load ./unique
@load ./hll_unique
@load ./variance

View file

@ -14,7 +14,7 @@ export {
};
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( AVERAGE in r$apply )
{

View file

@ -31,7 +31,7 @@ hook init_resultval_hook(r: Reducer, rv: ResultVal)
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( HLLUNIQUE in r$apply )
{

View file

@ -14,7 +14,7 @@ export {
};
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( MAX in r$apply )
{

View file

@ -14,7 +14,7 @@ export {
};
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( MIN in r$apply )
{

View file

@ -29,7 +29,7 @@ function get_samples(rv: ResultVal): vector of Observation
return s;
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( r$samples > 0 )
{

View file

@ -22,7 +22,7 @@ function calc_std_dev(rv: ResultVal)
}
# This depends on the variance plugin which uses priority -5
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal) &priority=-10
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal) &priority=-10
{
if ( STD_DEV in r$apply )
calc_std_dev(rv);

View file

@ -34,7 +34,7 @@ hook init_resultval_hook(r: Reducer, rv: ResultVal)
rv$sum = 0;
}
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( SUM in r$apply )
rv$sum += val;

View file

@ -23,7 +23,7 @@ redef record ResultVal += {
unique_vals: set[Observation] &optional;
};
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal)
{
if ( UNIQUE in r$apply )
{

View file

@ -29,7 +29,7 @@ function calc_variance(rv: ResultVal)
}
# Reduced priority since this depends on the average
hook add_to_reducer_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal) &priority=-5
hook observe_hook(r: Reducer, val: double, obs: Observation, rv: ResultVal) &priority=-5
{
if ( VARIANCE in r$apply )
{

View file

@ -174,8 +174,9 @@ function ftp_message(s: Info)
if ( s$cmdarg$cmd in file_cmds )
{
local comp_path = build_path_compressed(s$cwd, arg);
if ( s$cwd[0] != "/" )
if ( comp_path[0] != "/" )
comp_path = cat("/", comp_path);
arg = fmt("ftp://%s%s", addr_to_uri(s$id$resp_h), comp_path);
}
@ -245,16 +246,13 @@ event ftp_request(c: connection, command: string, arg: string) &priority=5
event ftp_reply(c: connection, code: count, msg: string, cont_resp: bool) &priority=5
{
# TODO: figure out what to do with continued FTP response (not used much)
#if ( cont_resp ) return;
local id = c$id;
set_ftp_session(c);
c$ftp$cmdarg = get_pending_cmd(c$ftp$pending_commands, code, msg);
c$ftp$reply_code = code;
c$ftp$reply_msg = msg;
# TODO: figure out what to do with continued FTP response (not used much)
if ( cont_resp ) return;
# TODO: do some sort of generic clear text login processing here.
local response_xyz = parse_ftp_reply_code(code);
@ -283,10 +281,10 @@ event ftp_reply(c: connection, code: count, msg: string, cont_resp: bool) &prior
c$ftp$passive=T;
if ( code == 229 && data$h == [::] )
data$h = id$resp_h;
data$h = c$id$resp_h;
ftp_data_expected[data$h, data$p] = c$ftp;
expect_connection(id$orig_h, data$h, data$p, ANALYZER_FILE, 5mins);
expect_connection(c$id$orig_h, data$h, data$p, ANALYZER_FILE, 5mins);
}
else
{