You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2024/02/19 22:00:20 UTC
(couchdb) branch add-dbname-to-mango-exec-stats updated (8f611bbfd -> d6d202a93)
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a change to branch add-dbname-to-mango-exec-stats
in repository https://gitbox.apache.org/repos/asf/couchdb.git
from 8f611bbfd Don't output dbname in exec stats http response
new 211ccc1ff Make sure mango nouveau logs reports
new d6d202a93 Test that mango reports get the dbname in the stats
The 2 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.
Summary of changes:
src/mango/src/mango_cursor_nouveau.erl | 2 ++
src/mango/src/mango_cursor_view.erl | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
(couchdb) 02/02: Test that mango reports get the dbname in the stats
Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a commit to branch add-dbname-to-mango-exec-stats
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit d6d202a937d91fb4de1f29c40b8f458c576bf1e6
Author: Russell Branca <ch...@apache.org>
AuthorDate: Mon Feb 19 14:00:11 2024 -0800
Test that mango reports get the dbname in the stats
---
src/mango/src/mango_cursor_view.erl | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index 3e67bbbf2..29880309f 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -1190,14 +1190,14 @@ t_execute_ok_all_docs_with_execution_stats(_) ->
executionStartTime = {0, 0, 0},
dbname = DbName
},
+ %% Stats doesn't include dbname as it will have already been stripped out
Stats =
{[
{total_keys_examined, TotalKeysExamined},
{total_docs_examined, TotalDocsExamined},
{total_quorum_docs_examined, TotalQuorumDocsExamined},
{results_returned, ResultsReturned},
- {execution_time_ms, '_'},
- {dbname, DbName}
+ {execution_time_ms, '_'}
]},
UserFnDefinition =
[
@@ -1258,10 +1258,17 @@ t_execute_ok_all_docs_with_execution_stats(_) ->
Parameters = [
db, [{user_ctx, user_ctx}], fun mango_cursor_view:handle_all_docs_message/2, Cursor1, Args
],
+ meck:new(couch_log, [passthrough]),
+ %% Pattern matching on DbName in the fun head results in a shadowed variable
+ %% warning. Creating a new variable and testing in the guard works around this.
+ meck:expect(couch_log, report,
+ fun("mango-stats", #{dbname := DbName1}) when DbName1 =:= DbName -> true end),
+ meck:expect(chttpd_stats, incr_rows, [TotalKeysExamined], meck:val(ok)),
meck:expect(chttpd_stats, incr_rows, [TotalKeysExamined], meck:val(ok)),
meck:expect(chttpd_stats, incr_reads, [TotalDocsExamined], meck:val(ok)),
meck:expect(fabric, all_docs, Parameters, meck:val({ok, Cursor2})),
?assertEqual({ok, updated_accumulator2}, execute(Cursor, fun foo:bar/2, accumulator)),
+ ?assert(meck:called(couch_log, report, '_')),
?assert(meck:called(fabric, all_docs, '_')).
t_execute_error_1(_) ->
(couchdb) 01/02: Make sure mango nouveau logs reports
Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
chewbranca pushed a commit to branch add-dbname-to-mango-exec-stats
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 211ccc1ff1730750fd57f224fb4d346978445d6a
Author: Russell Branca <ch...@apache.org>
AuthorDate: Mon Feb 19 13:58:58 2024 -0800
Make sure mango nouveau logs reports
---
src/mango/src/mango_cursor_nouveau.erl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mango/src/mango_cursor_nouveau.erl b/src/mango/src/mango_cursor_nouveau.erl
index 7caf8c427..863af73d4 100644
--- a/src/mango/src/mango_cursor_nouveau.erl
+++ b/src/mango/src/mango_cursor_nouveau.erl
@@ -129,6 +129,8 @@ execute(Cursor, UserFun, UserAcc) ->
{FinalUserAcc0, Stats1} = mango_execution_stats:maybe_add_stats(
Opts, UserFun, Stats0, FinalUserAcc
),
+ %% This needs Stats1 as log_end is called in maybe_add_stats
+ mango_execution_stats:log_stats(Stats1),
FinalUserAcc1 = mango_cursor:maybe_add_warning(UserFun, Cursor, Stats1, FinalUserAcc0),
{ok, FinalUserAcc1}
end.