github-readme-stats icon indicating copy to clipboard operation
github-readme-stats copied to clipboard

Implement github action that adds the `rate-limited` label to 1471 automatically when the PATs are failing

Open rickstaa opened this issue 2 years ago β€’ 14 comments

Describe the solution you'd like

I think a simple GitHub action that runs periodically to check if the PATs are failing and adds the rate-limited label to #1471 if the PATs fall more than a certain number of times in 24 hours would let people know that we are aware of the problem and working on it. We could then update https://github.com/anuraghazra/github-readme-stats/issues/1772 to explain this behavoir.

rickstaa avatar Aug 31 '22 06:08 rickstaa

Hey, can I work on this?

mohitsaxenaknoldus avatar Sep 03 '22 02:09 mohitsaxenaknoldus

Great I assigned you! Take your time.

rickstaa avatar Sep 03 '22 08:09 rickstaa

I have a few questions:

  1. By 1471, you mean 14:71 (hh:mm) right?
  2. Where do we post the comment?
  3. Where can I find the PATs?

mohitsaxenaknoldus avatar Sep 06 '22 07:09 mohitsaxenaknoldus

@mohitsaxenaknoldus Ah, sorry for being unclear. With 1471 I meant #1471. We use this issue to check if the card throws a Maximum retries exceeded error.

This GitHub action I had in mind would periodically check (e.g. every hour) whether the action throws this error and post a comment in #1471 if the error is thrown more than N times in 24 hours. However, thinking more about it πŸ€”, I now realise that this action could potentially empty @anuraghazra's GitHub action budget. I, therefore, think it is not wise to implement this action at the current time. Sorry for the inconvenience. πŸ˜“ Another valuable action you can work on is https://github.com/anuraghazra/github-readme-stats/issues/1659.

rickstaa avatar Sep 06 '22 07:09 rickstaa

@mohitsaxenakno I added an E2E test GitHub action last week (see https://github.com/anuraghazra/github-readme-stats/blob/master/.github/workflows/e2e-test.yml) and now think that implementing the action in #1989 is possible. The E2E test will call the server and fail if the card that is returned is not equal to the local card. We can, however, use this same mechanism to test whether the card that is returned is equal to the value returned by the renderError function:

https://github.com/anuraghazra/github-readme-stats/blob/acbc03dc0f2e70da946fbb75822bbe9d041fb729/src/common/utils.js#L12

Running this action every hour while caching the dependencies would keep it relatively low on resources (see https://github.com/anuraghazra/github-readme-stats/blob/94d0978d2bf7c5324513ac924cb42afe1e7774cc/.github/workflows/e2e-test.yml#L19-L23).

If you still want to take on this feature, that would be great πŸš€! Maybe for Hacktoberfest?

rickstaa avatar Oct 04 '22 13:10 rickstaa

Or maybe it is better to create a new issue with an explanation of what happened and that we are working on it. From experience, I noticed that people don't search for old issues when a problem occurs.

rickstaa avatar Oct 04 '22 14:10 rickstaa

@mohitsaxenaknoldus I just thought of a better way. I plan to add a status/up Vercel cloud function that will return true if the PATs are still functioning and false if they are not. I think we can call this function a simple bash action and create an issue if the PATs are failing. I am done with this function already but still have to complete the tests (see https://github.com/anuraghazra/github-readme-stats/blob/add_uptime_monitor/api/status/up.js).

rickstaa avatar Oct 04 '22 19:10 rickstaa

Hey can you assign this issue to me?

Jaya-sys avatar Oct 23 '22 22:10 Jaya-sys

@Jaya-sys Thanks a lot for wanting to implement this feature. I already implemented a cloud function that can be used to check whether the public instance is up (See https://github.com/anuraghazra/github-readme-stats/pull/2178).

https://github-readme-stats-git-monitoring-github-readme-stats-team.vercel.app/api/status/up

Custom badge

I use this cloud function to create a graph in grafana.com that shows every 15 min whether the instance is down. I can give you access to this graph if you want to check it out.

image

Therefore, we already have enough information to track our public instance. One thing that could still be improved is that we could create an action that adds the https://github.com/anuraghazra/github-readme-stats/labels/rate-limited label to #1471 when the instance has been down more than N times in the last 24 hours. We already have this data in the grafana.com Prometheus database, so maybe it is possible to fetch this data in the action? If this is impossible, we can also store this value in a database (see https://vercel.com/docs/concepts/solutions/databases#providers).

Are you interested in adding this functionality? I am happy to work with you on this feature.

rickstaa avatar Oct 24 '22 07:10 rickstaa

Other issues that are still available to be worked on for Hacktoberfest are:

  • https://github.com/anuraghazra/github-readme-stats/issues/1649
  • https://github.com/anuraghazra/github-readme-stats/issues/1708

rickstaa avatar Oct 24 '22 07:10 rickstaa

@rickstaa Yes i'd would like to work upon this

Jaya-sys avatar Oct 25 '22 14:10 Jaya-sys

@Jaya-sys, great I assigned you to this issue. Do you need access to the grafana.com instance?

rickstaa avatar Oct 25 '22 19:10 rickstaa

Yes

Jaya-sys avatar Oct 26 '22 00:10 Jaya-sys

@Jaya-sys Of course, can you send me your grafana.com account email over discord?

rickstaa avatar Oct 27 '22 07:10 rickstaa

Is this issue solved

Lavishmunjal avatar Sep 30 '23 17:09 Lavishmunjal

i would like to work upon this issue if it isn't solved

AvinashReddy19 avatar Oct 01 '23 07:10 AvinashReddy19

"Hey, I would like to work on this issue. I have checked out #1470 after some research, deployed my own Vercel instance to test the PAT exhaustion. It's my first issue, so I am not sure how to reproduce PAT exhaustion in order to test whether PATs are failing or not.

mohit-negi avatar Oct 01 '23 10:10 mohit-negi

want to work on this issue

crocmons avatar Oct 02 '23 19:10 crocmons

@Lavishmunjal, @AvinashReddy19, @mohit-negi, @crocmons, sorry for the late reply I was on holiday 🌴🌞. This issue hasn't been solved yet. I have thought a bit about it, and I think we can do the following:

  • Create a small GitHub action that pings the https://github.com/anuraghazra/github-readme-stats/blob/master/api/status/up.js endpoint every 5 min to see if the instance is limited. This action can then attach and remove the rate-limited label from #1471. Since the response is cached on Vercels servers, this will not cause any more GraphQL points to be used.

@mohit-negi Since you already started on this issue, I assigned you if you still want to work on it. However, let's first check with @qwerty541 and @anuraghazra about this solution. Another possible solution would be to add the uptime badge to the readme under the #important-notice- section (see #3350).

Custom badge
<img alt="Custom badge" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgithub-readme-stats-git-monitoring-github-readme-stats-team.vercel.app%2Fapi%2Fstatus%2Fup%3Ftype%3Dshields">

rickstaa avatar Oct 13 '23 10:10 rickstaa

@Lavishmunjal, @AvinashReddy19, @mohit-negi, @crocmons, sorry for the late reply I was on holiday 🌴🌞. This issue hasn't been solved yet. I have thought a bit about it, and I think we can do the following:

  • Create a small GitHub action that pings the https://github.com/anuraghazra/github-readme-stats/blob/master/api/status/up.js endpoint every 5 min to see if the instance is limited. This action can then attach and remove the rate-limited label from [Down Time] Card throws 'maximum retries exceeded' errorΒ #1471. Since the response is cached on Vercels servers, this will not cause any more GraphQL points to be used.

@mohit-negi Since you already started on this issue, I assigned you if you still want to work on it. However, let's first check with @qwerty541 and @anuraghazra about this solution. Another possible solution would be to add the uptime badge to the readme under the #important-notice- section (see #3350).

Custom badge

<img alt="Custom badge" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgithub-readme-stats-git-monitoring-github-readme-stats-team.vercel.app%2Fapi%2Fstatus%2Fup%3Ftype%3Dshields">

@rickstaa I think that adding and removing label from some issue would be unnecessary, i can't imagine how users would notice this, it's not quite obvious that it's worth paying attention to. I already approved and merged into master pull request with addition of uptime badge into readme https://github.com/anuraghazra/github-readme-stats/pull/3350, i think it's enought.

qwerty541 avatar Oct 15 '23 05:10 qwerty541

@Lavishmunjal, @AvinashReddy19, @mohit-negi, @crocmons, sorry for the late reply I was on holiday 🌴🌞. This issue hasn't been solved yet. I have thought a bit about it, and I think we can do the following:

  • Create a small GitHub action that pings the https://github.com/anuraghazra/github-readme-stats/blob/master/api/status/up.js endpoint every 5 min to see if the instance is limited. This action can then attach and remove the rate-limited label from [Down Time] Card throws 'maximum retries exceeded' errorΒ #1471. Since the response is cached on Vercels servers, this will not cause any more GraphQL points to be used.

@mohit-negi Since you already started on this issue, I assigned you if you still want to work on it. However, let's first check with @qwerty541 and @anuraghazra about this solution. Another possible solution would be to add the uptime badge to the readme under the #important-notice- section (see #3350). Custom badge

<img alt="Custom badge" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgithub-readme-stats-git-monitoring-github-readme-stats-team.vercel.app%2Fapi%2Fstatus%2Fup%3Ftype%3Dshields">

@rickstaa I think that adding and removing label from some issue would be unnecessary, i can't imagine how users would notice this, it's not quite obvious that it's worth paying attention to. I already approved and merged into master pull request with addition of uptime badge into readme #3350, i think it's enought.

I agree. Let's close this down. Sorry for the inconvenience @mohit-negi πŸ˜….

rickstaa avatar Oct 15 '23 07:10 rickstaa