Skip to content

Commit

Permalink
Ignore reporting signon permission token expiry metrics
Browse files Browse the repository at this point in the history
Tokens for the signon permissions users are automatically rotated once
they expire, so we don't need to trigger alerts for them.
  • Loading branch information
theseanything committed Oct 6, 2023
1 parent 4a30c14 commit 5191bda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/collectors/global_prometheus_collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ def metrics
def token_expiry_info
# Cache metric to prevent needless expensive calls to the database
Rails.cache.fetch("token_expiry_info", expires_in: 1.hour) do
ApiUser.all.flat_map do |user|
user.authorisations.where(revoked_at: nil).map do |token|
ApiUser
.where.not(email: SSOPushCredential::USER_EMAIL)
.flat_map do |user|
user.authorisations
.where(revoked_at: nil).map do |token|
{
expires_at: token.expires_at.to_i,
api_user: user.email,
Expand Down

0 comments on commit 5191bda

Please sign in to comment.