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 key | Meaning |
|---|---|
telescope.enabled | Mount at all. Defaults to false in production. |
telescope.route | Where the dashboard is mounted (/telescope). |
telescope.limit | Ring buffer size (500 entries). |
telescope.slow_ms | Duration at which an entry is marked slow (100). |
telescope.path | JSON-lines file to persist entries to. Off by default. |
Implementations§
Source§impl Telescope
impl Telescope
pub fn new() -> Self
Sourcepub fn at(self, mount: impl Into<String>) -> Self
pub fn at(self, mount: impl Into<String>) -> Self
Mount the dashboard somewhere else: .at("/_debug").
Sourcepub fn capacity(self, entries: usize) -> Self
pub fn capacity(self, entries: usize) -> Self
How many entries to keep. Memory is the only cost, and an entry is small.
Sourcepub fn slow_after_ms(self, millis: f64) -> Self
pub fn slow_after_ms(self, millis: f64) -> Self
The threshold above which an entry is highlighted as slow.
Sourcepub fn persist_to(self, path: impl Into<PathBuf>) -> Self
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.
Sourcepub fn even_in_production(self) -> Self
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.