Skip to content

Commit

Permalink
Fix bad prometheus section name
Browse files Browse the repository at this point in the history
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] #4397 (comment)
  • Loading branch information
nickva committed Mar 4, 2023
1 parent c0b8839 commit b8abb4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rel/overlay/etc/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/couch_prometheus/src/couch_prometheus_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down

0 comments on commit b8abb4a

Please sign in to comment.