You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/12/15 02:57:29 UTC
[GitHub] [couchdb] jaydoane opened a new pull request #3299: Support pluggable custodian monitor
jaydoane opened a new pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299
<!-- Thank you for your contribution!
Please file this form by replacing the Markdown comments
with your text. If a section needs no action - remove it.
Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
of code collaboration. Positive feedback is represented +1 from committers
and negative is a -1. The -1 also means veto, and needs to be addressed
to proceed. Once there are no objections, the PR can be merged by a
CouchDB committer.
See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
## Overview
Enable build time configurable monitor for custodian and remove custom
sensu events.
<!-- Please give a short brief for the pull request,
what problem it solves or how it makes things better. -->
## Testing recommendations
```
make eunit apps=custodian
```
<!-- Describe how we can test your changes.
Does it provides any behaviour that the end users
could notice? -->
## Related Issues or Pull Requests
<!-- If your changes affects multiple components in different
repositories please put links to those issues or pull requests here. -->
## Checklist
- [x] Code is written and works correctly
- [x] Changes are covered by tests
- [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
- [ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on a change in pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299#discussion_r543661272
##########
File path: src/custodian/src/custodian_noop_monitor.erl
##########
@@ -0,0 +1,35 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(custodian_noop_monitor).
+
+
+-behaviour(custodian_monitor).
+
+
+-export([
+ send_missing_db_alert/1,
+ clear_missing_dbs_alert/0,
+ send_event/1
+]).
+
+
+send_missing_db_alert(_DbName) ->
+ "no-op".
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on a change in pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
rnewson commented on a change in pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299#discussion_r543668819
##########
File path: src/custodian/src/custodian_server.erl
##########
@@ -143,7 +143,49 @@ handle_db_event(_DbName, _Event, _St) ->
{ok, nil}.
check_shards() ->
- [?CUSTODIAN_MONITOR:send_event(Item) || Item <- custodian:summary()].
+ [send_event(Item) || Item <- custodian:summary()].
+
+
+send_event({_, Count} = Item) ->
+ Description = describe(Item),
+ Name = check_name(Item),
+ Level = case Count of
+ 0 ->
+ "--ok";
+ 1 ->
+ couch_log:critical("~s", [Description]),
+ "--critical";
+ _ ->
+ couch_log:warning("~s", [Description]),
+ "--warning"
+ end,
+ ?CUSTODIAN_MONITOR:send_event(Name, Level, Description).
Review comment:
think we should send `Count` itself, the transformation to `Level` is sensu-specific. 😬
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane merged pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
jaydoane merged pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on a change in pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
rnewson commented on a change in pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299#discussion_r543181517
##########
File path: src/custodian/src/custodian_monitor.erl
##########
@@ -10,20 +10,16 @@
% License for the specific language governing permissions and limitations under
% the License.
-{application, custodian,
- [
- {description, "in your cluster, looking after your stuff"},
- {vsn, git},
- {registered, []},
- {applications, [
- kernel,
- stdlib,
- couch_log,
- config,
- couch_event,
- couch,
- mem3
- ]},
- {mod, { custodian_app, []}},
- {env, []}
- ]}.
+-module(custodian_monitor).
+
+
+-callback send_missing_db_alert(DbName :: binary()) ->
+ Output :: string().
Review comment:
I'd encode the fact that we don't use the result of these functions, we call them only for their implementation. so perhaps insist on `false` atom in all cases or say `any()` and document that the result of the function is ignored.
##########
File path: src/custodian/src/custodian_noop_monitor.erl
##########
@@ -0,0 +1,35 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(custodian_noop_monitor).
+
+
+-behaviour(custodian_monitor).
+
+
+-export([
+ send_missing_db_alert/1,
+ clear_missing_dbs_alert/0,
+ send_event/1
+]).
+
+
+send_missing_db_alert(_DbName) ->
+ "no-op".
Review comment:
adjust these to `false`.
##########
File path: src/custodian/src/custodian_server.erl
##########
@@ -143,52 +143,7 @@ handle_db_event(_DbName, _Event, _St) ->
{ok, nil}.
check_shards() ->
- [send_sensu_event(Item) || Item <- custodian:summary()].
Review comment:
this is a cut too far imo. we still want to log the descriptive error message to couch_log. the pluggable module allows a sysadmin to send that message (or one of its own invention) to some other system.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on a change in pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299#discussion_r543664012
##########
File path: src/custodian/src/custodian_server.erl
##########
@@ -143,52 +143,7 @@ handle_db_event(_DbName, _Event, _St) ->
{ok, nil}.
check_shards() ->
- [send_sensu_event(Item) || Item <- custodian:summary()].
Review comment:
Hah, I didn't even notice that logging cleverly interleaved in the case statement. In any case, I've returned them, and changed the `send_event/3` callback to DRY things up a bit.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on a change in pull request #3299: Support pluggable custodian monitor
Posted by GitBox <gi...@apache.org>.
jaydoane commented on a change in pull request #3299:
URL: https://github.com/apache/couchdb/pull/3299#discussion_r543661041
##########
File path: src/custodian/src/custodian_monitor.erl
##########
@@ -10,20 +10,16 @@
% License for the specific language governing permissions and limitations under
% the License.
-{application, custodian,
- [
- {description, "in your cluster, looking after your stuff"},
- {vsn, git},
- {registered, []},
- {applications, [
- kernel,
- stdlib,
- couch_log,
- config,
- couch_event,
- couch,
- mem3
- ]},
- {mod, { custodian_app, []}},
- {env, []}
- ]}.
+-module(custodian_monitor).
+
+
+-callback send_missing_db_alert(DbName :: binary()) ->
+ Output :: string().
Review comment:
Done in fixup
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org