Skip to main content

Telemetry

Struct Telemetry 

Source
pub struct Telemetry {
    pub test_id: String,
    pub spans: Vec<Span>,
    pub logs: Vec<Log>,
    pub strays: Vec<Span>,
    pub recording: String,
}
Expand description

What a test session recorded for one test.

Fields§

§test_id: String

The test’s id.

§spans: Vec<Span>

Every span of every trace the test caused, by start: the test’s own trace, and that of each delivery of a message published for it.

§logs: Vec<Log>

The lines the services logged in those traces, and what Encore captured of their requests, by time.

§strays: Vec<Span>

The calls between services made while the test ran that carried no test, and no trace of their request’s to place them by: each the request Encore handed the service called. A service that calls another without its request’s context loses the test with it, and what the service called then does is done on the data the services share, not on the test’s. Any of these may be this test’s doing, or that of another running beside it.

§recording: String

The file the recording of the test’s browser is written to when the test ends, for a test that has a browser whose recording is kept: one HTML file that plays its pages back beside what the test and the app did. Empty otherwise.

Implementations§

Source§

impl Telemetry

Source

pub fn decode( test_id: &str, spans: &[u8], logs: &[u8], own: Option<OwnSpan<'_>>, ) -> Result<Telemetry, Error>

Reads what the session answered a telemetry request with: spans, an encoded ExportTraceServiceRequest, and logs, an encoded ExportLogsServiceRequest. own is the test’s span, added where the session does not have it.

Source

pub fn requests(&self) -> Requests<'_> ⓘ

The requests services were handed, and gateways took, in order. Narrowed by Requests::service, Requests::endpoint and Requests::caller:

ⓘ
assert_eq!(recorded.requests().service("catalog").caller("test").count(), 1);
Source

pub fn queries(&self) -> Queries<'_> ⓘ

The queries run on the app’s databases, in order. Narrowed by Queries::database.

Source

pub fn publishes(&self) -> Publishes<'_> ⓘ

The messages published, in order. Narrowed by Publishes::topic.

Source

pub fn deliveries(&self) -> Deliveries<'_> ⓘ

The deliveries of messages to subscriptions, an attempt each, in order. Narrowed by Deliveries::topic and Deliveries::subscription.

Source

pub fn errors(&self) -> Vec<String>

What went wrong in what the test caused, a line each: requests answered with a server error, spans that failed, deliveries the handler did not handle, calls between services that lost their request’s context, and lines logged as errors.

Source

pub fn lost_context(&self) -> Vec<LostContext>

The calls between services that lost their request’s context, and with it the test: those in the test’s own traces (of_test), which a service made for the test, then those that are only known to have been made while it ran (strays), each kind of call once.

What a service does for a call that carries no test it does on the data the services share: a test that finds its own data without what it expected finds why here.

Source

pub fn with_strays(self, strays: &[u8]) -> Telemetry

With the spans of the calls that carried no test while the test ran, as the session answers them: an encoded OTLP ExportTraceServiceRequest. What cannot be read is none.

Source

pub fn with_recording(self, recording: String) -> Telemetry

With where the recording of the test’s browser will be, as the session answers it: empty for a test with none.

Source

pub fn render(&self) -> String

What the test caused, as a tree: each request and what the service did for it, then each delivery, with statuses and how long each took. Under it, the calls between services that lost the test (lost_context). What a failed test prints.

Source

pub fn shape(&self) -> String

render without what differs between runs — ids, times, how long anything took, cold starts — for a snapshot of which services a flow touches, and in what order. Spans beside each other that overlap in time are listed by name, so concurrent calls give one shape.

Source

pub fn to_json(&self) -> String

The telemetry as JSON, for an SDK to hand a test in its own types: the spans and lines, with render, shape and errors worked out.

Trait Implementations§

Source§

impl Clone for Telemetry

Source§

fn clone(&self) -> Telemetry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Telemetry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Serialize for Telemetry

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToDebugString for T
where T: Debug,

Source§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U