hubot-slack
hubot-slack copied to clipboard
WIP: Bot: support bubbling up rate limit info
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 [ ])
- [x] I've read and understood the Contributing Guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
/cc @aoberoi
π€ 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.
Codecov Report
Merging #573 into master will increase coverage by
0.15%. The diff coverage is100%.
@@ 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 dataPowered by Codecov. Last update ed96aca...ec3b4c8. Read the comment docs.
Codecov Report
Merging #573 (ec3b4c8) into main (ed96aca) will decrease coverage by
0.03%. The diff coverage is100.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
@clavin Looks like it passed this time. Β―_(γ)_/Β―
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 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.
Went ahead and signed the individual CLA.
@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.
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!