Merge pull request #7167 from askreet/incl-example-catalog-ts-update

Include example of catalog.ts update for discovery interval change.
This commit is contained in:
Fredrik Adelöw
2021-09-23 17:02:06 +02:00
committed by GitHub
2 changed files with 22 additions and 9 deletions
+18 -7
View File
@@ -49,17 +49,28 @@ When using a custom pattern, the target is composed of three parts:
## GitHub API Rate Limits
GitHub
[rate limits](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting)
API requests to 5,000 per hour (or more for Enterprise accounts). The default
Backstage catalog backend refreshes data every 100 seconds, which issues an API
request for each discovered location.
GitHub [rate limits] API requests to 5,000 per hour (or more for Enterprise
accounts). The default Backstage catalog backend refreshes data every 100
seconds, which issues an API request for each discovered location.
This means if you have more than ~140 catalog entities, you may get throttled by
rate limiting. This will soon be resolved once catalog refreshes make use of
ETags; to work around this in the meantime, you can change the refresh rate of
the catalog in your `packages/backend/src/plugins/catalog.ts` file, or configure
Backstage to use the [github-apps plugin](../../plugins/github-apps.md).
the catalog in your `packages/backend/src/plugins/catalog.ts` file:
```typescript
const builder = await CatalogBuilder.create(env);
// For example, to refresh every 5 minutes (300 seconds).
builder.setRefreshIntervalSeconds(300);
```
Alternatively, or additionally, you can configure [github-apps] authentication
which carries a much higher rate limit at GitHub.
This is true for any method of adding GitHub entities to the catalog, but
especially easy to hit with automatic discovery.
[rate limits]:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
[github-apps]: ../../plugins/github-apps.md
+4 -2
View File
@@ -60,5 +60,7 @@ preferred.
## Authentication with GitHub Apps
Alternatively, Backstage can use GitHub Apps for backend authentication. This
has higher rate limits, and a clearer authorization model. See the
[github-apps plugin](../../plugins/github-apps.md) for how to set this up.
has higher rate limits, and a clearer authorization model. See [github-apps] for
how to set this up.
[github-apps]: ../../plugins/github-apps.md