1
#pragma once
2

            
3
#include "envoy/server/guarddog_config.h"
4
#include "envoy/thread/thread.h"
5
#include "envoy/watchdog/v3/abort_action.pb.h"
6

            
7
namespace Envoy {
8
namespace Watchdog {
9
/**
10
 * A GuardDogAction that will terminate the process by killing the
11
 * stuck thread.
12
 */
13
class AbortAction : public Server::Configuration::GuardDogAction {
14
public:
15
  AbortAction(envoy::watchdog::v3::AbortActionConfig& config,
16
              Server::Configuration::GuardDogActionFactoryContext& context);
17

            
18
  void run(envoy::config::bootstrap::v3::Watchdog::WatchdogAction::WatchdogEvent event,
19
           const std::vector<std::pair<Thread::ThreadId, MonotonicTime>>& thread_last_checkin_pairs,
20
           MonotonicTime now) override;
21

            
22
private:
23
  const absl::Duration wait_duration_;
24
};
25

            
26
using AbortActionPtr = std::unique_ptr<AbortAction>;
27

            
28
} // namespace Watchdog
29
} // namespace Envoy