Skip to content

Commit bc995ef

Browse files
committed
readded metricGitHubAppRateLimit
1 parent 43468a7 commit bc995ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lambdas/functions/control-plane/src/scale-runners/scale-down.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import { bootTimeExceeded, listEC2Runners, tag, untag, terminateRunner } from '.
77
import { RunnerInfo, RunnerList, RunnerState } from './../aws/runners.d';
88
import { GhRunners, githubCache } from './cache';
99
import { ScalingDownConfig, getEvictionStrategy, getIdleRunnerCount } from './scale-down-config';
10+
import { metricGitHubAppRateLimit } from '../github/rate-limit';
1011
import { getGitHubEnterpriseApiUrl } from './scale-up';
1112

1213
const logger = createChildLogger('scale-down');
1314

15+
1416
async function getOrCreateOctokit(runner: RunnerInfo): Promise<Octokit> {
1517
const key = runner.owner;
1618
const cachedOctokit = githubCache.clients.get(key);
@@ -67,6 +69,8 @@ async function getGitHubSelfHostedRunnerState(
6769

6870
async function getGitHubRunnerBusyState(client: Octokit, ec2runner: RunnerInfo, runnerId: number): Promise<boolean> {
6971
const state = await getGitHubSelfHostedRunnerState(client, ec2runner, runnerId);
72+
logger.info(`Runner '${ec2runner.instanceId}' - GitHub Runner ID '${runnerId}' - Busy: ${state.data.busy}`);
73+
metricGitHubAppRateLimit(state.headers);
7074
return state.busy;
7175
}
7276

0 commit comments

Comments
 (0)