ThundraSpanListener
abstract base class, and that have on_span_started(span)
and on_span_finished(span)
methods. When you register a span listener to Thundra, Thundra calls this span listener’s on_span_started(span)
and on_span_finished(span)
methods whenever a span is started and finished. This enables you to perform custom operations using a span listener during the life cycle of a span.“Error injected by Thundra!”
.False
.True
.0
.distribution
parameter is set to uniform
, the variation
parameter decides the range from which the injected latency value will be sampled. For example, if the delay
is 500 and the variation
is 150, then the amount of latency that will be injected to the span will be a uniform random variable between the values [500-150, 500+150] = [350, 650]
. The default value is 0
.distribution
parameter is set to normal
, the sigma
(standard deviation) parameter decides the range from which the injected latency value will be sampled. If the distribution parameter is normal
, the amount of latency that will be injected to the span will be a normally distributed random variable with a standard deviation equal to the sigma
parameter and a mean value equal to the delay
parameter. The default value is 0
.distribution
parameter decides which distribution to use when sampling the amount of latency injected. If it is set to uniform
value, then the span listener will use the variation
and delay
parameters to decide the amount of the latency. If it is set to normal
, then the span listener will use the sigma
parameter and the delay
parameter to decide the amount of the latency. If it is set to a value other than uniform
and normal
, the span listener will behave like it is set to uniform
and decide the amount of latency accordingly. The default value is uniform
.FilteringSpanListener
, then it is sent to the span listener given by the listener
parameter. The default value is None
.listener
parameter, meaning it is basically an object that has an accept method. Before delegating the given span to the listener
parameter, FilteringSpanListener
first passes the given span to the filterer
object if the filterer’s accept method returns True
. If it does, then the given span is passed to the listener
parameter; if it does not, the given span is not passed to the listener. The default value is None
.thundra_agent_lambda_trace_span_listener
environment variable. The basic structure is similar to the following:listener=LatencyInjectorSpanListener
, we state the type of listener that FilteringSpanListener
is going to use. You can also use ErrorInjectorSpanListener
when you need to inject an error.config
. prefix is going to be passed to the listener
parameter (which in this case is LatencyInjectorSpanListener
) as parameters. It has a structure like this: config.parameterName
. Note that we are using camel case whenever we need it. For example, if you used ErrorInjectorSpanListener
as the listener argument, then you would pass the error_message
parameter like this: config.errorMessage=”Hello world!”
filter
keyword creates a filter. Any other character that follows the filter
keyword is basically the id of that filter.filter1.className=AWS-Lambda
, filter1.tag.aws.lambda.name=upstream-lambda
correspond to the following filter:class_name
and the tags
of the spans. If the given span has a different class_name
than “AWS-Lambda”
or the given span does not have the tag aws.lambda.name
with the value “upstream-lambda”
, then the span will be rejected and won’t be sent to the listener
. If it does have both properties, then the filterer accepts the span and FilteringSpanListener
propagates the span to its listener
parameter (which in this case is a LatencyInjectorSpanListener
).FilteringSpanListener
calls the ThundraSpanFilterer
’s accept method to decide whether or not to accept the given span, ThundraSpanFilterer
internally calls the accept(span)
method of each of the filters in the span_filters
. If at least one of the filters in the span_filters
accepts the span, or if the span_filters
list is empty, then the given span is accepted and returned True
. Otherwise, ThundraSpanFilterer
’s accept method returns False
. The default value is []
.None
.None
.None
.ThundraSpanFilter
checks to ensure that each of the key-value pairs in this dictionary also exists in the given span’s tags. If at least one of the key-value pairs does not exist in the span’s tags or exists with a different value, then the ThundraSpanFilter
rejects the span. The default value is None
.