Getting the number of Flood events within threshold?
The only way to do that with the default FloodInterface would be to use the isAllowed method and adjust the threshold to the number of allowed attempts.

From a hook_form_alter() you could do something similar to this, where 'my_trigger' is the name of the event that is registered, such as 'contact' for the contact form or 'user.failed_login_ip' and 'user.failed_login_user' for user login. 5 would be the maximum number of times the event could have been registered in 3600 seconds.

&lt;?php

function hook_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // Hide element if over the number of allowed attempts
  if (!\Drupal::flood()-&gt;isAllowed('my_trigger', 5, 3600)) {
    $form['my_element']['#access'] = FALSE;
  }
}