Skip to content

Commit

Permalink
MB-43914: Add metric to track successful timer callbacks
Browse files Browse the repository at this point in the history
Change-Id: I4cd2556d4d0858f2b4133be68fe23ef0dd8e1b30
Reviewed-on: http://review.couchbase.org/c/ns_server/+/144724
Well-Formed: Build Bot <build@couchbase.com>
Tested-by: Timofey Barmin <timofey.barmin@couchbase.com>
Reviewed-by: Timofey Barmin <timofey.barmin@couchbase.com>
  • Loading branch information
srini-raman authored and timofey-barmin committed Feb 2, 2021
1 parent ec9e1d2 commit fd87358
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
8 changes: 4 additions & 4 deletions priv/public/ui/app/mn_admin/mn_statistics_description.js
Original file line number Diff line number Diff line change
Expand Up @@ -1819,13 +1819,13 @@ function get65CompatDesc() {
"@eventing":{
"eventing/processed_count": {
unit: "number",
title: "Eventing Mutations Processed",
desc: "Mutations the function has finished processing. Per function."
title: "Successful Function Invocations",
desc: "Count of times the function was invoked successfully. Per function."
},
"eventing/failed_count": {
unit: "number",
title: "Eventing Failures",
desc: "Mutations for which the function execution failed. Per function."
title: "Failed Function Invocations",
desc: "Count of times the function invocation failed. Per function."
},
"eventing/dcp_backlog": {
unit: "number",
Expand Down
7 changes: 3 additions & 4 deletions src/menelaus_stats.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1527,20 +1527,19 @@ do_couchbase_eventing_stats_descriptions() ->
[{struct,
[{title, <<"Processed">>},
{name, per_fun_evening_stat(Id, <<"processed_count">>)},
{desc, <<"Mutations for which the function has finished "
"processing">>}]},
{desc, <<"Successful function invocations.">>}]},
{struct,
[{title, <<"Failures">>},
{name, per_fun_evening_stat(Id, <<"failed_count">>)},
{desc, <<"Mutations for which the function execution failed">>}]},
{desc, <<"Failed function invocations.">>}]},
{struct,
[{title, <<"Backlog">>},
{name, per_fun_evening_stat(Id, <<"dcp_backlog">>)},
{desc, <<"Mutations yet to be processed by the function">>}]},
{struct,
[{title, <<"Timeouts">>},
{name, per_fun_evening_stat(Id, <<"timeout_count">>)},
{desc, <<"Function execution timed-out while processing.">>}]}]}]}
{desc, <<"Timed out function invocations.">>}]}]}]}
|| Id <- Functions].

couchbase_fts_stats_descriptions(BucketId, ServiceNodes) ->
Expand Down
5 changes: 4 additions & 1 deletion src/prometheus_cfg.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,9 @@ derived_metrics(xdcr) ->
"(xdcr_changes_left_total + ignoring(name) xdcr_docs_processed_total)"}];
derived_metrics(eventing) ->
[{"eventing_processed_count",
"eventing_on_delete_success + ignoring(name) eventing_on_update_success"},
"eventing_timer_callback_success + ignoring(name) "
"eventing_on_delete_success + ignoring(name) "
"eventing_on_update_success"},
{"eventing_failed_count",
"sum without(name) ("
"{name=~`eventing_bucket_op_exception_count|"
Expand All @@ -1060,6 +1062,7 @@ derived_metrics(eventing) ->
"eventing_non_doc_timer_create_failure|"
"eventing_on_delete_failure|"
"eventing_on_update_failure|"
"eventing_timer_callback_failure|"
"eventing_timeout_count`})"}];
derived_metrics(_) ->
[].
Expand Down
6 changes: 4 additions & 2 deletions src/service_eventing.erl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ get_computed() ->

successes() ->
[on_update_success,
on_delete_success].
on_delete_success,
timer_callback_success].

failures() ->
[bucket_op_exception_count,
Expand All @@ -122,7 +123,8 @@ failures() ->
doc_timer_create_failure,
non_doc_timer_create_failure,
on_update_failure,
on_delete_failure].
on_delete_failure,
timer_callback_failure].

get_service_gauges() ->
[dcp_backlog | successes() ++ failures()].
Expand Down
26 changes: 18 additions & 8 deletions src/stat_names_mappings.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,8 @@ pre_70_to_prom_query_test_() ->
Test("@eventing", [], ""),
Test("@eventing", all,
"label_replace(sum by () ({name=~`eventing_on_delete_success|"
"eventing_on_update_success`}),"
"eventing_on_update_success|"
"eventing_timer_callback_success`}),"
"`name`,`eventing_processed_count`,``,``) or "
"label_replace(sum by () ("
"{name=~`eventing_bucket_op_exception_count|"
Expand All @@ -1222,11 +1223,13 @@ pre_70_to_prom_query_test_() ->
"eventing_non_doc_timer_create_failure|"
"eventing_on_delete_failure|"
"eventing_on_update_failure|"
"eventing_timeout_count`}),"
"eventing_timeout_count|"
"eventing_timer_callback_failure`}),"
"`name`,`eventing_failed_count`,``,``) or "
"label_replace(sum by (functionName) ("
"{name=~`eventing_on_delete_success|"
"eventing_on_update_success`}),"
"eventing_on_update_success|"
"eventing_timer_callback_success`}),"
"`name`,`eventing_processed_count`,``,``) or "
"label_replace(sum by (functionName) ("
"{name=~`eventing_bucket_op_exception_count|"
Expand All @@ -1236,7 +1239,8 @@ pre_70_to_prom_query_test_() ->
"eventing_non_doc_timer_create_failure|"
"eventing_on_delete_failure|"
"eventing_on_update_failure|"
"eventing_timeout_count`}),"
"eventing_timeout_count|"
"eventing_timer_callback_failure`}),"
"`name`,`eventing_failed_count`,``,``) or "
"sum by (name) ({name=~`eventing_bucket_op_exception_count|"
"eventing_checkpoint_failure_count|"
Expand All @@ -1248,7 +1252,9 @@ pre_70_to_prom_query_test_() ->
"eventing_on_delete_success|"
"eventing_on_update_failure|"
"eventing_on_update_success|"
"eventing_timeout_count`}) or "
"eventing_timeout_count|"
"eventing_timer_callback_failure|"
"eventing_timer_callback_success`}) or "
"sum by (name,functionName) ("
"{name=~`eventing_bucket_op_exception_count|"
"eventing_checkpoint_failure_count|"
Expand All @@ -1260,14 +1266,17 @@ pre_70_to_prom_query_test_() ->
"eventing_on_delete_success|"
"eventing_on_update_failure|"
"eventing_on_update_success|"
"eventing_timeout_count`})"),
"eventing_timeout_count|"
"eventing_timer_callback_failure|"
"eventing_timer_callback_success`})"),
Test("@eventing", [<<"eventing/test/failed_count">>,
<<"eventing/test/processed_count">>,
<<"eventing/bucket_op_exception_count">>,
<<"eventing/test/bucket_op_exception_count">>],
"label_replace(sum by (functionName) ("
"{name=~`eventing_on_delete_success|"
"eventing_on_update_success`,"
"eventing_on_update_success|"
"eventing_timer_callback_success`,"
"functionName=`test`}),"
"`name`,`eventing_processed_count`,``,``) or "
"label_replace(sum by (functionName) ("
Expand All @@ -1278,7 +1287,8 @@ pre_70_to_prom_query_test_() ->
"eventing_non_doc_timer_create_failure|"
"eventing_on_delete_failure|"
"eventing_on_update_failure|"
"eventing_timeout_count`,"
"eventing_timeout_count|"
"eventing_timer_callback_failure`,"
"functionName=`test`}),"
"`name`,`eventing_failed_count`,``,``) or "
"sum by (name) ({name=`eventing_bucket_op_exception_count`}) or "
Expand Down

0 comments on commit fd87358

Please sign in to comment.