You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/03/04 05:15:22 UTC
[couchdb] branch fix-flaky-prometheus-test created (now b86ee775d)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch fix-flaky-prometheus-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at b86ee775d Fix bad prometheus section name
This branch includes the following new commits:
new b86ee775d Fix bad prometheus section name
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Fix bad prometheus section name
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch fix-flaky-prometheus-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit b86ee775d2fad36f3b9b89cf6f64612cbae5a6d0
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Sat Mar 4 00:10:28 2023 -0500
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
---
rel/overlay/etc/default.ini | 2 ++
src/couch_prometheus/src/couch_prometheus_server.erl | 2 +-
src/couch_prometheus/test/eunit/couch_prometheus_e2e_tests.erl | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
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) ->