Extract trace id, entity id and sampling decision from the input entity and inject these information to headers.
- headers (dict) – http headers to inject
- entity (Entity) – trace entity that the trace header value generated from.
calculate_sampling_decision(trace_header, recorder, sampling_req)¶
Return 1 or the matched rule name if should sample and 0 if should not. The sampling decision coming from
trace_headeralways has the highest precedence. If the
trace_headerdoesn’t contain sampling decision then it checks if sampling is enabled or not in the recorder. If not enbaled it returns 1. Otherwise it uses user defined sampling rules to decide.
TraceHeaderobject from dictionary headers of the incoming request. This method should always return a
TraceHeaderobject regardless of tracing header’s presence in the incoming request.
Returns the segment name based on recorder configuration and input host name. This is a helper generally used in web framework middleware where a host name is available from incoming request’s headers.
Prepare a trace header to be inserted into response based on original header and the request segment.
Convert the input string to snake-cased string.
Will generate a valid url string for use as a segment name :param url: url to strip :return: validated url string
Will unwrap a wrapt attribute :param obj: base object :param attr: attribute on obj to unwrap