Skip to content
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

Add Token Expiration gauge metric #164

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

leklund
Copy link
Member

@leklund leklund commented Apr 18, 2024

New gauge metric: fastly_rt_token_expiration

Returns the expires_at timestamp of the FASTLY_API_TOKEN.

This addresses part of #146.

If the the metric is not in the blocklist, it will create a a TokenRecorder that has two methods: Gatherer() and Set()

  • Gatherer() returns the registry with the new gauge metric that is appended to the default gatherers
  • Set() fetches token data from api.fastly.com/tokens/self and sets the expiration timestamp (if it exists)
  • The metric is labeled with the token_id and the user_id to help in finding the token in the Fastly UI.

Sample:

# HELP fastly_rt_token_expiration Unix timestamp of the expiration time of the Fastly API Token
# TYPE fastly_rt_token_expiration gauge
fastly_rt_token_expiration{token_id="token_id_1234",user_id="user_id_5678"} 1.721232155e+09

@leklund leklund force-pushed the token_expiration branch 2 times, most recently from 5770756 to a3c274f Compare April 18, 2024 17:30
* New TokenRecorder with Gatherer and Set methods
* New gauge metric: fastly_rt_token_expiration

also: go mod tidy
@leklund leklund added the enhancement New feature or request label Apr 18, 2024
@leklund leklund merged commit a5061dc into extend-metric-blocklist Apr 18, 2024
12 checks passed
@leklund leklund deleted the token_expiration branch April 18, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant