Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlackClient.api_call error responses are not logged #207

Open
alexander-matsievsky opened this issue Sep 1, 2019 · 2 comments
Open

SlackClient.api_call error responses are not logged #207

alexander-matsievsky opened this issue Sep 1, 2019 · 2 comments

Comments

@alexander-matsievsky
Copy link
Member

@jesuslosada @rennerocha Hi, Spidermon team!

Recently I started to get these errors in my job logs:

======================================================================
ERROR: SendSlackMessageSpiderFinished
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/app/python/lib/python3.6/site-packages/spidermon/core/actions.py", line 37, in run
    self.run_action()
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 213, in run_action
    attachments=self.get_attachments(),
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 58, in send_message
    for recipient in to
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 58, in <listcomp>
    for recipient in to
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 79, in send_message
    attachments=attachments,
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 129, in _send_channel_message
    icon_url=self.users[self.sender_name]["profile"]["image_48"],
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 36, in users
    self._users = self._get_users_info()
  File "/app/python/lib/python3.6/site-packages/spidermon/contrib/actions/slack/__init__.py", line 91, in _get_users_info
    for member in self._api_call("users.list")["members"]
KeyError: 'members'

From the looks of it, they are caused by the transient Slack API error responses, in my case to the https://api.slack.com/methods/users.list method.

  1. Could we log ok=false responses?
  2. Could we retry such responses several times as they seem to be retryable?
@alexander-matsievsky
Copy link
Member Author

In fact, that might be the cause:

Clients should not send more than one message per second sustained. If you do you may receive an error message or be disconnected.

https://api.slack.com/rtm#errors

@alexander-matsievsky
Copy link
Member Author

I've started to receive these errors this week when I automatically scheduled around 15 jobs instantly. Then, SPIDERMON_PERIODIC_MONITORS chimed in emitting 15 alerts every 3 hours within the same minute or so. That's a plausible explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant