Skip to content

chore: instrument github oauth2 limits #11532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 10, 2024
Merged

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jan 9, 2024

What this does

The other PR tracks outbound requests, but github tells us our rate limits in all responses. This pr adds some additional rate limit metrics for github.

This should be even more helpful identifying how close we get to our limits.

Example prom metrics

Example

# HELP coderd_oauth2_external_requests_rate_limit_next_reset_unix Unix timestamp of the next interval
# TYPE coderd_oauth2_external_requests_rate_limit_next_reset_unix gauge
coderd_oauth2_external_requests_rate_limit_next_reset_unix{name="primary-github",resource="core"} 1.704835507e+09
coderd_oauth2_external_requests_rate_limit_next_reset_unix{name="secondary-github",resource="core"} 1.704835507e+09
coderd_oauth2_external_requests_rate_limit_next_reset_unix{name="secondary-github",resource="core-unauthorized"} 1.70483538e+09
# HELP coderd_oauth2_external_requests_rate_limit_remaining The remaining number of allowed requests in this interval.
# TYPE coderd_oauth2_external_requests_rate_limit_remaining gauge
coderd_oauth2_external_requests_rate_limit_remaining{name="primary-github",resource="core"} 4894
coderd_oauth2_external_requests_rate_limit_remaining{name="secondary-github",resource="core"} 4890
coderd_oauth2_external_requests_rate_limit_remaining{name="secondary-github",resource="core-unauthorized"} 0
# HELP coderd_oauth2_external_requests_rate_limit_reset_in_seconds Seconds until the next interval
# TYPE coderd_oauth2_external_requests_rate_limit_reset_in_seconds gauge
coderd_oauth2_external_requests_rate_limit_reset_in_seconds{name="primary-github",resource="core"} 193.928881099
coderd_oauth2_external_requests_rate_limit_reset_in_seconds{name="secondary-github",resource="core"} 192.443556963
coderd_oauth2_external_requests_rate_limit_reset_in_seconds{name="secondary-github",resource="core-unauthorized"} 70.670050739
# HELP coderd_oauth2_external_requests_rate_limit_total The total number of allowed requests per interval.
# TYPE coderd_oauth2_external_requests_rate_limit_total gauge
coderd_oauth2_external_requests_rate_limit_total{name="primary-github",resource="core"} 5000
coderd_oauth2_external_requests_rate_limit_total{name="secondary-github",resource="core"} 5000
coderd_oauth2_external_requests_rate_limit_total{name="secondary-github",resource="core-unauthorized"} 60
# HELP coderd_oauth2_external_requests_rate_limit_used The number of requests made in this interval.
# TYPE coderd_oauth2_external_requests_rate_limit_used gauge
coderd_oauth2_external_requests_rate_limit_used{name="primary-github",resource="core"} 106
coderd_oauth2_external_requests_rate_limit_used{name="secondary-github",resource="core"} 110
coderd_oauth2_external_requests_rate_limit_used{name="secondary-github",resource="core-unauthorized"} 108

Copy link
Member Author

Emyrk commented Jan 9, 2024

In this stack: 📊 Improve observability and metrics for OAuth2 integration

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Emyrk and the rest of your teammates on Graphite Graphite

@Emyrk Emyrk force-pushed the stevenmasley/oauth_instrument branch from 1993093 to 5222f66 Compare January 9, 2024 22:31
@Emyrk Emyrk force-pushed the stevenmasley/github_ratelimit branch from d8fda1e to f13df6f Compare January 9, 2024 22:31
@Emyrk Emyrk marked this pull request as ready for review January 9, 2024 22:31
@Emyrk Emyrk requested a review from mafredri January 9, 2024 22:32
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the decoupled comments, Graphite defaults to separate comments instead of review batch. 😅

@Emyrk Emyrk force-pushed the stevenmasley/oauth_instrument branch from e48a44f to 85e2d91 Compare January 10, 2024 14:50
@Emyrk Emyrk force-pushed the stevenmasley/github_ratelimit branch from 36d7d39 to cdc2e07 Compare January 10, 2024 15:00
Base automatically changed from stevenmasley/oauth_instrument to main January 10, 2024 15:13
@Emyrk Emyrk force-pushed the stevenmasley/github_ratelimit branch from cdc2e07 to e7e555e Compare January 10, 2024 15:14
@Emyrk Emyrk enabled auto-merge (squash) January 10, 2024 15:20
@Emyrk Emyrk merged commit 3f9da67 into main Jan 10, 2024
@Emyrk Emyrk deleted the stevenmasley/github_ratelimit branch January 10, 2024 15:29
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants