tracing-layer-discord
tracing-layer-discord
provides a Layer
implementation for sending tracing
events to Discord.
Synopsis
DiscordLayer
sends POST requests via tokio
and reqwest
to a Discord Webhook URL for each new tracing event. The format of the embedded message is statically defined.
This layer also looks for an optional JsonStorageLayer
extension
on the parent span
of each event. This extension may contain additional contextual information for the parent span of an event, which is included into the Discord message.
Installation
Configure the dependencies and pull directly from GitHub:
[]
= "1.0"
= "0.1"
= "0.1"
Examples
See the full list of examples in examples/.
Simple
In this simple example, a layer is created using Discord configuration in the environment. An orphaned event (one with no parent span) and an event occurring within a span are created in three separate futures, and a number of messages are sent quickly to Discord.
Discord Messages
This screenshots shows the first three Discord messages sent while running this example. More messages are sent but were truncated from these images.
Discord Blocks
By default, messages are sent using Discord Blocks. Here's an example:
Code example
Run this example locally using the following commands:
$ git clone https://github.com/seanpianka/tracing-layer-discord.git
$ cd tracing-layer-discord
$ cargo run --example simple
You must have Discord configuration exported in the environment.
Source
use Regex;
use ;
use ;
use ;
pub async
pub async
pub async
async