hubot-slack icon indicating copy to clipboard operation
hubot-slack copied to clipboard

WIP: Bot: support bubbling up rate limit info

Open mistydemeo opened this issue 6 years ago β€’ 11 comments

Summary

This exposes Slack rate-limiting information to Hubot. This allows custom scripts to react to rate-limiting, for example to slow themselves down or to report to an alerting channel that a rate-limiting event has occurred.

Requirements (place an x in each [ ])

mistydemeo avatar Aug 02 '19 22:08 mistydemeo

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 02 '19 22:08 CLAassistant

/cc @aoberoi

mistydemeo avatar Aug 02 '19 22:08 mistydemeo

πŸ€” The Node v4.2 build is mysteriously failing while npm is installing. I'm going to add some debugging (-dd to npm install) to the CI config for this branch (πŸ™‡β€β™€ thank you for letting maintainers make changes) to see if it'll give any hints.

clavin avatar Aug 05 '19 23:08 clavin

Codecov Report

Merging #573 into master will increase coverage by 0.15%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
+ Coverage   85.03%   85.19%   +0.15%     
==========================================
  Files           6        6              
  Lines         381      385       +4     
  Branches       85       85              
==========================================
+ Hits          324      328       +4     
  Misses         33       33              
  Partials       24       24
Impacted Files Coverage Ξ”
src/bot.coffee 74.52% <100%> (+0.99%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update ed96aca...ec3b4c8. Read the comment docs.

codecov[bot] avatar Aug 05 '19 23:08 codecov[bot]

Codecov Report

Merging #573 (ec3b4c8) into main (ed96aca) will decrease coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #573      +/-   ##
==========================================
- Coverage   85.03%   85.00%   -0.04%     
==========================================
  Files           6        6              
  Lines         381      500     +119     
  Branches       85      129      +44     
==========================================
+ Hits          324      425     +101     
- Misses         33       45      +12     
- Partials       24       30       +6     
Impacted Files Coverage Ξ”
src/bot.coffee 77.65% <100.00%> (+4.13%) :arrow_up:
src/client.coffee 91.54% <0.00%> (-0.20%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Aug 05 '19 23:08 codecov[bot]

@clavin Looks like it passed this time. Β―_(ツ)_/Β―

mistydemeo avatar Aug 06 '19 16:08 mistydemeo

Checking in again about this again; we need this to be able to track metrics on how often we're rate-limited, which helps us measure our Hubot SLOs internally.

cc @aoberoi, @seratch

mistydemeo avatar Apr 09 '20 19:04 mistydemeo

@mistydemeo Thanks for following up. I can take a look at this today.

BTW, I know you mentioned that your employer signed the CLA in another PR https://github.com/slackapi/hubot-slack/pull/567#issuecomment-503742191 but it'd be greatly appreciated if you could sign the CLA as an individual. That'd be much easier for others to understand the situation.

seratch avatar Apr 10 '20 00:04 seratch

Went ahead and signed the individual CLA.

mistydemeo avatar Apr 10 '20 01:04 mistydemeo

@mistydemeo As I mentioned above, I'm still not sure if this change works for your cases yet. Also, if I understand it correctly, there is one limitation where rate-limited errors that happened outside of the bot instance won't be notified.

Although I'm not sure if this is realistic for your use case yet, is it possible to consider using Events API for this purpose? Events API has an event for it: https://api.slack.com/events/app_rate_limited

That'll be a much easier way to detect the errors. However, to use Events API along with RTM bot, you need to have a public endpoint to receive incoming requests from Slack API. Also, if you have been using Hubot integrations, you need to migrate those into "classic" Slack apps. (FYI: the default way is no longer the "classic" model but still you can create from https://api.slack.com/apps?new_classic_app=1 ).

That said, I'm happy to help you out in the short-term by merging this PR once I verify it works.

seratch avatar Apr 10 '20 04:04 seratch

Eek! Sorry πŸ™‡!! I accidentally deleted the old default branch without changing the target of this PR and it automatically closed this PR! And I couldn't change it unless I cloned the old branch and pushed it again first! 😱 Sorry for the commotion!

clavin avatar Jul 03 '20 05:07 clavin