pub struct EntryPoint { /* private fields */ }Expand description
What started the work that a report, log or trace belongs to: a web request, a command, or a queued job. Flare requires an entry point, and groups and filters by it.
§Where the entry point comes from
The Flare client looks for the entry point of a piece of work in four places, in this order. The first place that has an entry point wins.
- The innermost nested scope that has an entry point. A nested scope is the
scope that
with_scopeorScopeFutureExt::with_flare_scopeadds for one piece of work. Set the entry point there withScope::set_entry_point. The web integrations do this for each request. - The closest
tracingspan around the work that has an entry point: theserverspan of a request, theconsumerspan of a job, or a span withflare.span_type = "command". Thetracingintegration reads the entry point from the fields of the span. - The app-wide scope, set with
configure_scopeoutside a nested scope. - The command line of the process, from
EntryPoint::current_process.
The app-wide scope comes after the spans on purpose. A worker command can set its own entry point in the app-wide scope. Each job that the worker runs still gets the entry point of its job span.
Implementations§
Source§impl EntryPoint
impl EntryPoint
Sourcepub fn web<S: Into<String>>(url: S) -> Self
pub fn web<S: Into<String>>(url: S) -> Self
Creates a web request entry point. url is the full URL of the request.
Sourcepub fn cli<S: Into<String>>(command_line: S) -> Self
pub fn cli<S: Into<String>>(command_line: S) -> Self
Creates a command entry point. command_line is the command with its
arguments.
Sourcepub fn queue<S: Into<String>>(job: S) -> Self
pub fn queue<S: Into<String>>(job: S) -> Self
Creates a queued job entry point. job is the name of the job.
Sourcepub fn current_process() -> Self
pub fn current_process() -> Self
Creates a command entry point with the command line of this process. The Flare client uses this entry point for work outside a request, job or command.
§Examples
When your app cannot use a command span, name the command on the app-wide scope, for example after it reads the name of a subcommand:
use flareapp_core::EntryPoint;
flareapp_core::configure_scope(|scope| {
scope.set_entry_point(EntryPoint::current_process().handler_identifier("import"));
});Sourcepub fn handler_identifier<S: Into<String>>(self, identifier: S) -> Self
pub fn handler_identifier<S: Into<String>>(self, identifier: S) -> Self
Sets the identifier Flare groups by, like the route GET /users/{id}, a
command name, or a job name.
Sourcepub fn handler_name<S: Into<String>>(self, name: S) -> Self
pub fn handler_name<S: Into<String>>(self, name: S) -> Self
Sets the code that handles the work, like a controller or a job type.
Sourcepub fn handler_type<S: Into<String>>(self, handler_type: S) -> Self
pub fn handler_type<S: Into<String>>(self, handler_type: S) -> Self
Sets the kind of handler, prefixed with the framework, like axum_route.