Skip to main content

Telescope

Struct Telescope 

Source
pub struct Telescope { /* private fields */ }
Expand description

The Telescope plugin.

Every setting can come from configuration instead, so a deployment can tune it without recompiling. An explicit builder call always wins over configuration, because a value written in main.rs is a decision and a value in a config file is a default:

Config keyMeaning
telescope.enabledMount at all. Defaults to false in production.
telescope.routeWhere the dashboard is mounted (/telescope).
telescope.limitRing buffer size (500 entries).
telescope.slow_msDuration at which an entry is marked slow (100).
telescope.pathJSON-lines file to persist entries to. Off by default.

Implementations§

Source§

impl Telescope

Source

pub fn new() -> Self

Source

pub fn at(self, mount: impl Into<String>) -> Self

Mount the dashboard somewhere else: .at("/_debug").

Source

pub fn capacity(self, entries: usize) -> Self

How many entries to keep. Memory is the only cost, and an entry is small.

Source

pub fn slow_after_ms(self, millis: f64) -> Self

The threshold above which an entry is highlighted as slow.

Source

pub fn persist_to(self, path: impl Into<PathBuf>) -> Self

Also append entries to a JSON-lines file, and load them back on boot, so a restart does not lose the request you were about to look at.

Source

pub fn ignore(self, kind: impl Into<String>) -> Self

Do not record this kind of event.

Source

pub fn even_in_production(self) -> Self

Mount even in production.

Spelled out in full because of what it means: the dashboard shows SQL, log messages, and every field any package chose to emit. Anyone who can reach the URL can read them. Put it behind authentication middleware before you call this.

Source

pub fn install(self, router: &mut Router, config: &Config) -> Option<Store>

Mount onto a router directly.

Returns the Store when Telescope mounted, and None when the production guard refused. Applications go through Plugin; this is for tests and for an application that builds its own router.

Trait Implementations§

Source§

impl Default for Telescope

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Plugin for Telescope

Source§

fn name(&self) -> &'static str

Shown by rustlavel route:list and in boot logs.
Source§

fn register(self: Box<Self>, setup: &mut Setup<'_>)

Add routes, middleware, and state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.