-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WatchDog Extension hook #12416
WatchDog Extension hook #12416
Changes from 12 commits
a8807be
87b3504
5f622bc
ace255c
ce6b715
693be5c
204b09f
60014d8
e9d0238
c5574a9
7d8ae02
e6eea37
9a0079d
54fb656
9de27b0
7f4866e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,11 @@ types including: | |
* :ref:`Stat sinks <arch_overview_statistics>` | ||
* :ref:`Tracers <arch_overview_tracing>` | ||
* :ref:`Request ID <arch_overview_tracing>` | ||
* Transport sockets | ||
* BoringSSL private key methods | ||
* :ref:`Transport sockets <envoy_v3_api_field_extensions.transport_sockets.tls.v3.CommonTlsContext.CertificateProvider.typed_config>` | ||
* :ref:`BoringSSL FIPS <arch_overview_ssl_fips>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an extension point? Did you mean to ref link to the private key methods or have a different title? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will revert the BoringSSL FIPs since I'm not entirely sure. I was basing this on pr #6326 but might be missing some context. |
||
* :ref:`Watchdog action <envoy_v3_api_msg_config.bootstrap.v3.Watchdog.WatchdogAction>` | ||
* :ref:`HTTP internal redirects <arch_overview_internal_redirects>` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an extension point? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was based off of pr #10908. In https://github.com/envoyproxy/envoy/blob/master/api/envoy/config/route/v3/route_components.proto#L1722 there's a I will revert here, but if you think this makes sense I'm happy to add this in another PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, OK. I guess I would mildly prefer that we ref link directly to the TypedExtensionConfig field to make it more obvious along with any arch docs. In any case, I don't want to hold up your PR, but any follow ups to improve the docs would be appreciated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a separate PR for this: #12620 |
||
|
||
|
||
As of this writing there is no high level extension developer documentation. The | ||
:repo:`existing extensions <source/extensions>` are a good way to learn what is possible. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "envoy/api/api.h" | ||
#include "envoy/common/pure.h" | ||
#include "envoy/config/bootstrap/v3/bootstrap.pb.h" | ||
#include "envoy/config/typed_config.h" | ||
#include "envoy/event/dispatcher.h" | ||
#include "envoy/protobuf/message_validator.h" | ||
#include "envoy/server/guarddog.h" | ||
|
||
#include "common/protobuf/protobuf.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
namespace Configuration { | ||
|
||
struct GuardDogActionFactoryContext { | ||
Api::Api& api_; | ||
Event::Dispatcher& dispatcher_; // not owned (this is the guard dog's dispatcher) | ||
}; | ||
|
||
class GuardDogAction { | ||
public: | ||
virtual ~GuardDogAction() = default; | ||
/** | ||
* Callback function for when the GuardDog observes an event. | ||
* @param event the event the GuardDog observes. | ||
* @param thread_ltt_pairs pairs of the relevant thread to the event, and the | ||
* last time touched (LTT) of those threads with their watchdog. | ||
* @param now the current time. | ||
*/ | ||
virtual void run(envoy::config::bootstrap::v3::Watchdog::WatchdogAction::WatchdogEvent event, | ||
std::vector<std::pair<Thread::ThreadId, MonotonicTime>> thread_ltt_pairs, | ||
MonotonicTime now) PURE; | ||
}; | ||
|
||
using GuardDogActionPtr = std::unique_ptr<GuardDogAction>; | ||
|
||
/** | ||
* Implemented by each custom GuardDogAction and registered via Registry::registerFactory() | ||
* or the convenience class RegisterFactory. | ||
*/ | ||
class GuardDogActionFactory : public Config::TypedFactory { | ||
public: | ||
~GuardDogActionFactory() override = default; | ||
|
||
/** | ||
* Creates a particular GuardDog Action factory implementation. | ||
* | ||
* @param config supplies the configuration for the action. | ||
* @param context supplies the GuardDog Action's context. | ||
* @return GuardDogActionPtr the GuardDogAction object. | ||
*/ | ||
virtual GuardDogActionPtr createGuardDogActionFromProto( | ||
const envoy::config::bootstrap::v3::Watchdog::WatchdogAction& config, | ||
mattklein123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
GuardDogActionFactoryContext& context) PURE; | ||
|
||
std::string category() const override { return "envoy.guarddog_actions"; } | ||
}; | ||
|
||
} // namespace Configuration | ||
} // namespace Server | ||
} // namespace Envoy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry can you clarify this a bit? Does specifying any config for KILL/MULTIKILL override the default PANIC action? It's not clear from the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to specify the PANIC() call runs after the registered actions for that case if the process wasn't yet killed.