summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holley <willholley@gmail.com>2020-01-06 09:30:55 +0000
committerWill Holley <willholley@gmail.com>2020-01-17 13:54:34 +0000
commitb5fe3d69271813ac5aa7966b60eb2e94947a0606 (patch)
tree013adb9f569e2a9b64603e79e737dae03dd6c6e6
parentf86747f02a8b066f136a275fa28e92200404d0e7 (diff)
downloadcouchdb-b5fe3d69271813ac5aa7966b60eb2e94947a0606.tar.gz
Add mango.query_invalid_index counter
Adds a metric to expose the number of Mango queries that could not use the index specified in the _find query.
-rw-r--r--src/couch/priv/stats_descriptions.cfg4
-rw-r--r--src/mango/src/mango_cursor.erl2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/couch/priv/stats_descriptions.cfg b/src/couch/priv/stats_descriptions.cfg
index ae203bb21..0d81ea31b 100644
--- a/src/couch/priv/stats_descriptions.cfg
+++ b/src/couch/priv/stats_descriptions.cfg
@@ -302,3 +302,7 @@
{type, counter},
{desc, <<"number of mango queries that could not use an index">>}
]}.
+{[mango, query_invalid_index], [
+ {type, counter},
+ {desc, <<"number of mango queries that generated an invalid index warning">>}
+]}.
diff --git a/src/mango/src/mango_cursor.erl b/src/mango/src/mango_cursor.erl
index f50824545..a16e0d5e4 100644
--- a/src/mango/src/mango_cursor.erl
+++ b/src/mango/src/mango_cursor.erl
@@ -166,6 +166,7 @@ invalid_index_warning(Index, Opts) ->
invalid_index_warning_int(Index, {use_index, [DesignId]}) ->
case filter_indexes([Index], DesignId) of
[] ->
+ couch_stats:increment_counter([mango, query_invalid_index]),
Reason = fmt("_design/~s was not used because it does not contain a valid index for this query.",
[ddoc_name(DesignId)]),
[Reason];
@@ -175,6 +176,7 @@ invalid_index_warning_int(Index, {use_index, [DesignId]}) ->
invalid_index_warning_int(Index, {use_index, [DesignId, ViewName]}) ->
case filter_indexes([Index], DesignId, ViewName) of
[] ->
+ couch_stats:increment_counter([mango, query_invalid_index]),
Reason = fmt("_design/~s, ~s was not used because it is not a valid index for this query.",
[ddoc_name(DesignId), ViewName]),
[Reason];