pub struct RemoteAgent<R, S = Unstarted>where
R: RemoteAgentSpecification,
S: Stage,{ /* private fields */ }Expand description
The remote agent startup sequence.
R is the binary’s RemoteAgentSpecification, and S is the current stage, which determines the methods
available.
Implementations§
Source§impl<R> RemoteAgent<R, Unstarted>where
R: RemoteAgentSpecification,
impl<R> RemoteAgent<R, Unstarted>where
R: RemoteAgentSpecification,
Sourcepub fn new(local: R::LocalConfiguration, translator: LoggingTranslator) -> Self
pub fn new(local: R::LocalConfiguration, translator: LoggingTranslator) -> Self
Creates a new RemoteAgent from its local configuration.
translator translates the authoritative logging settings once they’re known.
Sourcepub fn with_start_time(self, start_time: Instant) -> Self
pub fn with_start_time(self, start_time: Instant) -> Self
Sets the time the process started, which is used to report how long the topology took to become healthy.
Defaults to the time the RemoteAgent was created.
Sourcepub async fn start(
self,
bootstrap_guard: &mut BootstrapGuard,
bootstrap_supervisor: Supervisor,
) -> Result<RemoteAgent<R, Started>, GenericError>
pub async fn start( self, bootstrap_guard: &mut BootstrapGuard, bootstrap_supervisor: Supervisor, ) -> Result<RemoteAgent<R, Started>, GenericError>
Selects the configuration authority and reloads logging to match it.
In connected mode, this registers with the Datadog Agent and waits for its initial configuration. In standalone mode, the local configuration becomes authoritative.
bootstrap_supervisor is the supervisor returned by the process bootstrap, which runs as the first child of the
root supervisor.
§Errors
If registration fails, or the configuration can’t be loaded, an error is returned.
Source§impl<R> RemoteAgent<R, Started>where
R: RemoteAgentSpecification,
impl<R> RemoteAgent<R, Started>where
R: RemoteAgentSpecification,
Sourcepub fn config(&self) -> &R::AuthoritativeConfiguration
pub fn config(&self) -> &R::AuthoritativeConfiguration
Returns the authoritative configuration.
Sourcepub fn is_standalone(&self) -> bool
pub fn is_standalone(&self) -> bool
Returns true if the remote agent runs without the Datadog Agent.
Sourcepub async fn initialize(
self,
) -> Result<RemoteAgent<R, Initialized>, GenericError>
pub async fn initialize( self, ) -> Result<RemoteAgent<R, Initialized>, GenericError>
Creates the registries and the environment provider.
In connected mode, the environment provider connects to the Datadog Agent for the hostname, autodiscovery, and workload metadata. In standalone mode, it reports the configured hostname, and nothing else.
§Errors
If the environment provider can’t be created, an error is returned.
Source§impl<R> RemoteAgent<R, Initialized>where
R: RemoteAgentSpecification,
impl<R> RemoteAgent<R, Initialized>where
R: RemoteAgentSpecification,
Sourcepub fn config(&self) -> &R::AuthoritativeConfiguration
pub fn config(&self) -> &R::AuthoritativeConfiguration
Returns the authoritative configuration.
Sourcepub fn is_standalone(&self) -> bool
pub fn is_standalone(&self) -> bool
Returns true if the remote agent runs without the Datadog Agent.
Sourcepub fn env_provider(&self) -> &RemoteAgentEnvironmentProvider
pub fn env_provider(&self) -> &RemoteAgentEnvironmentProvider
Returns the environment provider.
Sourcepub fn component_registry(&self) -> &ComponentRegistry
pub fn component_registry(&self) -> &ComponentRegistry
Returns the component registry, which the topology registers its components and memory bounds with.
Sourcepub fn health_registry(&self) -> &HealthRegistry
pub fn health_registry(&self) -> &HealthRegistry
Returns the health registry.
Sourcepub fn client_configuration(&self) -> Option<&RemoteAgentClientConfiguration>
pub fn client_configuration(&self) -> Option<&RemoteAgentClientConfiguration>
Returns the configuration for connecting to the Datadog Agent, or None in standalone mode.
Sourcepub async fn remote_config_client(
&mut self,
) -> Result<Option<RemoteConfigurationClient>, GenericError>
pub async fn remote_config_client( &mut self, ) -> Result<Option<RemoteConfigurationClient>, GenericError>
Returns the Remote Configuration client, connecting to the Datadog Agent on the first call.
The polling worker runs under the internal supervisor once the remote agent runs, so subscriptions made before then are all included in its first poll. Binaries should only call this when they have products to subscribe to, since connecting starts the worker polling.
Returns None in standalone mode, or if Remote Configuration is turned off.
§Errors
If the client can’t connect to the Datadog Agent, an error is returned.
Sourcepub fn create_remote_agent_supervisor(
&self,
status_sections: Vec<Arc<dyn StatusSectionProvider>>,
telemetry_rules: Vec<RemapperRule>,
) -> Result<Supervisor, GenericError>
pub fn create_remote_agent_supervisor( &self, status_sections: Vec<Arc<dyn StatusSectionProvider>>, telemetry_rules: Vec<RemapperRule>, ) -> Result<Supervisor, GenericError>
Creates the supervisor for the parts of the control plane that only the facade can build.
The supervisor is named remote-agent, and must be added to the binary’s control plane supervisor. It serves the
supervision tree on the privileged API endpoint and, in connected mode, runs the remote agent workers from
RemoteAgentBootstrap: it serves the status, flare, and telemetry services, and reports diagnostic events to
the Datadog Agent.
status_sections and telemetry_rules are passed to RemoteAgentBootstrap::create_services_worker.
§Errors
If the supervisor can’t be created, an error is returned.
Sourcepub async fn run(
self,
blueprint: TopologyBlueprint,
control_plane: Supervisor,
) -> Result<(), GenericError>
pub async fn run( self, blueprint: TopologyBlueprint, control_plane: Supervisor, ) -> Result<(), GenericError>
Sourcepub async fn run_until<F>(
self,
blueprint: TopologyBlueprint,
control_plane: Supervisor,
shutdown: F,
) -> Result<(), GenericError>
pub async fn run_until<F>( self, blueprint: TopologyBlueprint, control_plane: Supervisor, shutdown: F, ) -> Result<(), GenericError>
Runs the remote agent until shutdown resolves.
This creates the internal supervisor around control_plane, validates the memory bounds, and then runs the
supervision tree with blueprint as the topology.
control_plane is the binary’s control plane supervisor, which must include the supervisor from
create_remote_agent_supervisor. The memory bounds cover every
component registered with the component registry, so blueprint must be fully built.
A shutdown in which some components had to be stopped forcefully, after exceeding their shutdown timeout, is logged as a warning rather than returned as an error, since the process did stop.
§Errors
If the internal supervisor can’t be created, the memory bounds can’t be validated, or the supervision tree fails, an error is returned.
Auto Trait Implementations§
impl<R, S> Freeze for RemoteAgent<R, S>
impl<R, S> RefUnwindSafe for RemoteAgent<R, S>
impl<R, S> Send for RemoteAgent<R, S>
impl<R, S> Sync for RemoteAgent<R, S>
impl<R, S> Unpin for RemoteAgent<R, S>
impl<R, S> UnsafeUnpin for RemoteAgent<R, S>
impl<R, S> UnwindSafe for RemoteAgent<R, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read moreSource§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more