Skip to content

Configuration

Authentication

FIXME: add things

Exporters

These configs define on which schedule the exporters will run. Although configurable this is not so influential on the programs performance or latency and should be kept on quite a quick schedule. Most of the schedule executions will only hit the caches. To change how often the Github Api is queried use the enviroment variables listed in the cache eviction section.

datatype default description
Workflow Runs EXPORTERS_SCHEDULING_WORKFLOW_RUNS
java cron string */30 * * * * ? export schedule for workflow runs
Active Workflow Runs EXPORTERS_SCHEDULING_ACTIVE_WORKFLOW_RUNS
java cron string */30 * * * * ? export schedule for active workflow runs
Jobs EXPORTERS_SCHEDULING_JOBS
java cron string */30 * * * * ? export schedule for workflow jobs
Workflow Run Build Times EXPORTERS_SCHEDULING_WORKFLOW_RUN_BUILD_TIMES
java cron string 45 */30 * * * ? export schedule for workflow build times
Pull Requests EXPORTERS_SCHEDULING_PULL_REQUESTS
java cron string 30 */30 * * * ? export schedule for pull requests
Self Hosted Runners EXPORTERS_SCHEDULING_SELF_HOSTED_RUNNERS
java cron string */30 * * * * ? export schedule for self hosted runners
Repository Count EXPORTERS_SCHEDULING_REPOSITORY_COUNT
java cron string */30 * * * * ? export schedule for repository count
Rate Limit State EXPORTERS_SCHEDULING_API_RATELIMIT_STATE
java cron string */15 * * * * ? export schedule for the ratelimiters state

Cache eviction

As mentioned above, this is the important part of the configuration. If you are intending to make the request interval significantly faster or slower change the cron shedule to the corresponding shedule leading to the cache beeing evicted more or less often and new data being fetched more or less frequently.

That said the rate limiter might stop you from making too many requests by setting its status to a specific level. But even here you get to control how this level influences the features. Each feature can set a level at which it will be turned off. The logic works in the following way (as pseudocode):

shouldICacheEvict = if apiRateLimitStatus < configuredValue { yes } else { no }

There is a possibility to also set no value ("") which will lead to the feature always beeing active unless the actual ratelimit is hit in which case all action is ceased. The configured enum string can be one of:

"CRITICAL", "WARNING", "CONCERNING", "GOOD", "OK", ""
datatype default description
Workflow Runs CACHE_EVICTION_SCHEDULING_WORKFLOW_RUNS
java cron string 30 */5 * * * ? schedule on which to evict workflow runs
CACHE_EVICTION_WORKFLOW_RUNS_STOP_EVICTION_STATUS
enum string CONCERNING status on which to stop evicting workflow runs
Active Workflow Runs CACHE_EVICTION_SCHEDULING_ACTIVE_WORKFLOW_RUNS
java cron string 30 * * * * ? schedule on which to evict active workflow runs
CACHE_EVICTION_ACTIVE_WORKFLOW_RUNS_STOP_EVICTION_STATUS
enum string status on which to stop evicting active workflow runs
Jobs CACHE_EVICTION_SCHEDULING_JOBS
java cron string 0 */5 * * * ? schedule on which to evict jobs
CACHE_EVICTION_JOBS_STOP_EVICTION_STATUS
enum string CONCERNING status on which to stop evicting jobs
Workflow Run Build Times CACHE_EVICTION_SCHEDULING_WORKFLOW_RUN_BUILD_TIMES
java cron string 10 0 * * * ? schedule on which to evict workflow build times
CACHE_EVICTION_WORKFLOW_RUN_BUILD_TIMES_STOP_EVICTION_STATUS
enum string CONCERNING status on which to stop evicting workflow build times
Pull Requests CACHE_EVICTION_SCHEDULING_PULL_REQUESTS
java cron string 15 0 * * * ? schedule on which to evict pull requests
CACHE_EVICTION_PULL_REQUESTS_STOP_EVICTION_STATUS
enum string GOOD status on which to stop evicting pull requests
Self Hosted Runners CACHE_EVICTION_SCHEDULING_SELF_HOSTED_RUNNERS
java cron string 20 */5 * * * ? schedule on which to evict self hosted runners
CACHE_EVICTION_SELF_HOSTED_RUNNERS_STOP_EVICTION_STATUS
enum string CONCERNING status on which to stop evicting self hosted runners
Repository Count CACHE_EVICTION_SCHEDULING_REPOSITORY_COUNT
java cron string 0 0 * * * ? schedule on which to evict repository count
CACHE_EVICTION_REPOSITORY_COUNT_STOP_EVICTION_STATUS
enum string GOOD status on which to stop evicting repository count

Rate Limiter

First we have some basic variables that allow for some minor configurations. If you are not intending to get really into optimizing the service there should be no need to touch these.

datatype default description
State Control Schedule APP_GITHUB_RATELIMITING_STATE_CONTROL_CHECK_SCHEDULE
java cron string 0 */5 * * * ? how often the rate limiter will check if it can start making requests again if it happens to have gotten itself stuck
State Recalculation Timing APP_GITHUB_RATELIMITING_SECONDS_BETWEEN_STATE_RECALCULATIONS
integer (seconds) 60 Time that passes between each re-evaluation of how many requests are being made, shorter time will make the rate limiter more sensitive to bursts and longer the inverse
Ratelimit Buffer APP_GHITHUB_RATELIMIT_BUFFER
float 0.9 Percentage of the total limit that will be used. Allows for a bit of a buffer in case other applications are also using the same rate limit.

Status Limits

If you want to change at which point the rate limiter changes to which status change these values. The rate limiter waits a number of seconds specified by APP_GITHUB_RATELIMITING_SECONDS_BETWEEN_STATE_RECALCULATIONS after which it calculates how many requests per second (req/s) have been made in that time. This number is then compared to a ideal req/s, calculate through rate limiting headers which then in turn determines the status.

if (ideal * GOOD_LIMIT >= actual) {
    "OK"
} else if ...
...
} else {
    "CRITICAL"
}
datatype default description
GOOD APP_GITHUB_RATELIMITING_GOOD_LIMIT
float 0.5 Percentage of the ideal req/s that need to be used for the status to minimally turn to "GOOD"
CONCERNING APP_GITHUB_RATELIMITING_CONCERNING_LIMIT
float 0.7 Percentage of the ideal req/s that need to be used for the status to minimally turn to "CONCERNING"
WARNING APP_GITHUB_RATELIMITING_WARNING_LIMIT
float 0.9 Percentage of the ideal req/s that need to be used for the status to minimally turn to "WARNING"
CRITICAL APP_GITHUB_RATELIMITING_CRITICAL_LIMIT
float 1.2 Percentage of the ideal req/s that need to be used for the status to minimally turn to "CONCERNING"

Feature Toggles

With these toggles you can decide what metrics will be exported by Github Metrics. Although turning off features will reduce the number of requests made the relationship is not linear. The feature toggles will not directly stop certain endpoints from being requested they will just stop the exporter from asking for that data. As an example, Repositories will always be requested if any other feature is active since for exaples to fetch WorkflowRuns we need to know what repositories are available.

datatype default description
Workflow Runs EXPORTER_WORKFLOW_RUNS_FEATURE
boolean true Collects data on all workflow runs of the last 24 hours, this includes workflow-runs of all statuses.
Active Workflow Runs EXPORTER_ACTIVE_WORKFLOW_RUNS_FEATURE
boolean false Collects data only the the currently active workflow-runs, meaning any workflow-run that has not failed or completed.
Jobs EXPORTER_JOBS_FEATURE
boolean false Collects data on all jobs of all the workflow-runs started in the last 24 hours.
Repository Count EXPORTER_REPOSITORIES_FEATURE
boolean true Collects data on the number of repositories in the organization.
Workflow Run Build Times EXPORTER_WORKFLOW_RUN_BUILD_TIMES_FEATURE
boolean false Aggregates workflow-run build-times to both a total count as well as a average for all workflow-runs created since yesterday 00:00.
Self Hosted Runners EXPORTER_SELF_HOSTED_RUNNERS_FEATURE
boolean false Collects data on all self-hosted runners present on the organization as well as any repository that the token has access to.
Pull Requests EXPORTER_PULL_REQUESTS_FEATURE
boolean false Aggregates status counts of pull requests over the last few days.