diff --git a/lib/collectors/global_prometheus_collector.rb b/lib/collectors/global_prometheus_collector.rb index ff2f9065a6..318b85e76a 100644 --- a/lib/collectors/global_prometheus_collector.rb +++ b/lib/collectors/global_prometheus_collector.rb @@ -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,