mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/metrics-bug'
* origin/topic/bernhard/metrics-bug: add comment for seth to make us not forget about the copy statements fix the fix (thanks seth) duct-tape fix of values not propagating after intermediate check in cluster environments. Fixing coverage.bare-mode-errors test.
This commit is contained in:
commit
8992dc6cff
5 changed files with 37 additions and 8 deletions
11
CHANGES
11
CHANGES
|
@ -1,4 +1,15 @@
|
||||||
|
|
||||||
|
2.1-492 | 2013-05-02 12:46:26 -0700
|
||||||
|
|
||||||
|
* Work-around for sumstats framework not propagating updates after
|
||||||
|
intermediate check in cluster environments. (Bernhard Amann)
|
||||||
|
|
||||||
|
* Always apply tcp_connection_attempt. Before this change it was
|
||||||
|
only applied when a connection_attempt() event handler was
|
||||||
|
defined. (Robin Sommer)
|
||||||
|
|
||||||
|
* Fixing coverage.bare-mode-errors test. (Robin Sommer)
|
||||||
|
|
||||||
2.1-487 | 2013-05-01 18:03:22 -0700
|
2.1-487 | 2013-05-01 18:03:22 -0700
|
||||||
|
|
||||||
* Always apply tcp_connection_attempt timer, even if no
|
* Always apply tcp_connection_attempt timer, even if no
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.1-487
|
2.1-492
|
||||||
|
|
|
@ -124,7 +124,9 @@ event SumStats::send_data(uid: string, ssid: string, data: ResultTable)
|
||||||
if ( |data| == 0 )
|
if ( |data| == 0 )
|
||||||
done = T;
|
done = T;
|
||||||
|
|
||||||
event SumStats::cluster_ss_response(uid, ssid, local_data, done);
|
# Note: copy is needed to compensate serialization caching issue. This should be
|
||||||
|
# changed to something else later.
|
||||||
|
event SumStats::cluster_ss_response(uid, ssid, copy(local_data), done);
|
||||||
if ( ! done )
|
if ( ! done )
|
||||||
schedule 0.01 sec { SumStats::send_data(uid, ssid, data) };
|
schedule 0.01 sec { SumStats::send_data(uid, ssid, data) };
|
||||||
}
|
}
|
||||||
|
@ -150,7 +152,10 @@ event SumStats::cluster_key_request(uid: string, ssid: string, key: Key)
|
||||||
if ( ssid in result_store && key in result_store[ssid] )
|
if ( ssid in result_store && key in result_store[ssid] )
|
||||||
{
|
{
|
||||||
#print fmt("WORKER %s: received the cluster_key_request event for %s=%s.", Cluster::node, key2str(key), data);
|
#print fmt("WORKER %s: received the cluster_key_request event for %s=%s.", Cluster::node, key2str(key), data);
|
||||||
event SumStats::cluster_key_response(uid, ssid, key, result_store[ssid][key]);
|
|
||||||
|
# Note: copy is needed to compensate serialization caching issue. This should be
|
||||||
|
# changed to something else later.
|
||||||
|
event SumStats::cluster_key_response(uid, ssid, key, copy(result_store[ssid][key]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
A test metric threshold was crossed with a value of: 100.0
|
A test metric threshold was crossed with a value of: 101.0
|
||||||
|
End of epoch handler was called
|
||||||
|
101.0
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# @TEST-EXEC: sleep 3
|
# @TEST-EXEC: sleep 3
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait 10
|
# @TEST-EXEC: btest-bg-wait 20
|
||||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -20,8 +20,15 @@ redef Log::default_rotation_interval = 0secs;
|
||||||
event bro_init() &priority=5
|
event bro_init() &priority=5
|
||||||
{
|
{
|
||||||
local r1: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
local r1: SumStats::Reducer = [$stream="test.metric", $apply=set(SumStats::SUM)];
|
||||||
SumStats::create([$epoch=1hr,
|
SumStats::create([$epoch=10secs,
|
||||||
$reducers=set(r1),
|
$reducers=set(r1),
|
||||||
|
$epoch_finished(data: SumStats::ResultTable) =
|
||||||
|
{
|
||||||
|
print "End of epoch handler was called";
|
||||||
|
for ( res in data )
|
||||||
|
print data[res]["test.metric"]$sum;
|
||||||
|
terminate();
|
||||||
|
},
|
||||||
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
$threshold_val(key: SumStats::Key, result: SumStats::Result) =
|
||||||
{
|
{
|
||||||
return double_to_count(result["test.metric"]$sum);
|
return double_to_count(result["test.metric"]$sum);
|
||||||
|
@ -30,7 +37,6 @@ event bro_init() &priority=5
|
||||||
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
$threshold_crossed(key: SumStats::Key, result: SumStats::Result) =
|
||||||
{
|
{
|
||||||
print fmt("A test metric threshold was crossed with a value of: %.1f", result["test.metric"]$sum);
|
print fmt("A test metric threshold was crossed with a value of: %.1f", result["test.metric"]$sum);
|
||||||
terminate();
|
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +58,13 @@ event remote_connection_handshake_done(p: event_peer)
|
||||||
if ( p$descr == "manager-1" )
|
if ( p$descr == "manager-1" )
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
|
{
|
||||||
schedule 0.1sec { do_stats(1) };
|
schedule 0.1sec { do_stats(1) };
|
||||||
|
schedule 5secs { do_stats(60) };
|
||||||
|
}
|
||||||
if ( Cluster::node == "worker-2" )
|
if ( Cluster::node == "worker-2" )
|
||||||
schedule 0.5sec { do_stats(99) };
|
schedule 0.5sec { do_stats(40) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue