telemetry: Use dynamic metrics port, remove broker topic mentioning from NEWS entry

This commit is contained in:
Arne Welzel 2022-08-30 11:19:28 +02:00
parent 7310952358
commit 65b31c525d
3 changed files with 18 additions and 4 deletions

5
NEWS
View file

@ -131,9 +131,8 @@ Changed Functionality
This prevents callbacks into script-land through change handlers when parts This prevents callbacks into script-land through change handlers when parts
of the environment have already been torn down. of the environment have already been torn down.
- When running in cluster mode, the manager by default now imports metrics - When running in cluster mode, the manager by default now imports metrics from
from all other cluster nodes via broker topics and opens port 9911/tcp for all other cluster nodes and opens port 9911/tcp for Prometheus metrics exposition.
Prometheus metrics exposition.
Removed Functionality Removed Functionality
--------------------- ---------------------

View file

@ -1,2 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
manager-1, original Broker::metrics_port, 9911/tcp
[endpoint="logger-1", endpoint="manager-1", endpoint="proxy-1", endpoint="worker-1"] [endpoint="logger-1", endpoint="manager-1", endpoint="proxy-1", endpoint="worker-1"]

View file

@ -4,6 +4,8 @@
# @TEST-PORT: BROKER_PORT2 # @TEST-PORT: BROKER_PORT2
# @TEST-PORT: BROKER_PORT3 # @TEST-PORT: BROKER_PORT3
# @TEST-PORT: BROKER_PORT4 # @TEST-PORT: BROKER_PORT4
# @TEST-PORT: BROKER_PORT4
# @TEST-PORT: BROKER_TEST_METRICS_PORT
# #
# @TEST-REQUIRES: which curl # @TEST-REQUIRES: which curl
# @TEST-EXEC: zeek --parse-only %INPUT # @TEST-EXEC: zeek --parse-only %INPUT
@ -44,7 +46,7 @@ event run_test()
terminate(); terminate();
} }
timeout 3sec timeout 10sec
{ {
# This is bad. # This is bad.
print "ERROR: HTTP request timeout"; print "ERROR: HTTP request timeout";
@ -54,6 +56,17 @@ event run_test()
global node_count = 0; global node_count = 0;
@if ( Cluster::node == "manager-1" )
# Use a dynamic metrics port for testing to avoid colliding on 9911/tcp
# when running tests in parallel.
global orig_metrics_port = Broker::metrics_port;
redef Broker::metrics_port = to_port(getenv("BROKER_TEST_METRICS_PORT"));
event zeek_init()
{
print Cluster::node, "original Broker::metrics_port", orig_metrics_port;
}
event Cluster::node_up(name: string, id: string) event Cluster::node_up(name: string, id: string)
{ {
++node_count; ++node_count;
@ -63,6 +76,7 @@ event Cluster::node_up(name: string, id: string)
if ( node_count == 3 ) if ( node_count == 3 )
schedule 2 * Broker::metrics_export_interval { run_test() }; schedule 2 * Broker::metrics_export_interval { run_test() };
} }
@endif
# If any node goes down, terminate() right away. # If any node goes down, terminate() right away.
event Cluster::node_down(name: string, id: string) event Cluster::node_down(name: string, id: string)