diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2023-03-04 00:10:28 -0500 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2023-03-04 01:08:22 -0500 |
commit | b8abb4aad40d2826aae695aef48d866f62c83185 (patch) | |
tree | 9c36604f0396b9b877509cd73ff50cc62bba30e0 | |
parent | c0b8839bf28bd2c914d71a4dfafd3ea508c3040a (diff) | |
download | couchdb-b8abb4aad40d2826aae695aef48d866f62c83185.tar.gz |
Fix bad prometheus section name
Interval was not read from the correct section.
The tests had the correct section.
This should fix the prometheus flaky test [1]. This was apparent on MacOS
a bit more. The interval in the test was still 5 seconds instead of 1,
so it was right at the edge of timing out (5 seconds is the default
eunit timeout).
[1] https://github.com/apache/couchdb/issues/4397#issuecomment-1425027913
-rw-r--r-- | rel/overlay/etc/default.ini | 2 | ||||
-rw-r--r-- | src/couch_prometheus/src/couch_prometheus_server.erl | 2 | ||||
-rw-r--r-- | src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index ed8692989..3795c9c68 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -848,6 +848,8 @@ state_dir = {{state_dir}} additional_port = false bind_address = 127.0.0.1 port = {{prometheus_port}} +; Refresh interval in seconds +;interval = 5 [view_upgrade] ; When enabled, views with more than one collator versions will be submitted diff --git a/src/couch_prometheus/src/couch_prometheus_server.erl b/src/couch_prometheus/src/couch_prometheus_server.erl index d13d11941..7a0eb4bf9 100644 --- a/src/couch_prometheus/src/couch_prometheus_server.erl +++ b/src/couch_prometheus/src/couch_prometheus_server.erl @@ -195,7 +195,7 @@ drain_refresh_messages() -> update_refresh_timer() -> drain_refresh_messages(), - RefreshTime = 1000 * config:get_integer("couch_prometheus", "interval", ?REFRESH_INTERVAL), + RefreshTime = 1000 * config:get_integer("prometheus", "interval", ?REFRESH_INTERVAL), erlang:send_after(RefreshTime, self(), refresh). -ifdef(TEST). diff --git a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl index 027402b51..5f458ba8c 100644 --- a/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl +++ b/src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl @@ -85,6 +85,8 @@ setup_prometheus(WithAdditionalPort) -> % It's already started by default, so restart to pick up config ok = application:stop(couch_prometheus), ok = application:start(couch_prometheus), + % Flush so that stats aggregator starts using the new, shorter interval + couch_stats_aggregator:flush(), Ctx. t_chttpd_port(Port) -> |