trazer.export#
- trazer.export.to_tef_event_dict(trace_event: TraceEvent, time_unit: str = 'ms') dict[str, Any]#
Export the attributes of a TraceEvent instance to a dict. All public attributes of TraceEvent are exported. The exported timestamp is converted to the unit specified by
time_unit.- Parameters:
trace_event – Trace event to be exported.
time_unit – Time unit of the exported timestamps. The unit of timestamp for a
TraceEventis in second.
- Returns:
A dict containing the attributes of the provided trace events.
- trazer.export.to_tef_json(trace_or_event: Trace | TraceEvent, *traces_or_events: Trace | TraceEvent, display_time_unit: str = 'ms', file_like: IO[str] | None = None) dict[str, Any] | None#
Export the trace to a JSON corresponding to the Trace Event Format
If more than one traces are provided, the trace events in different traces will be merged and exported as one JSON. If traces and individual trace events are provided, the trace events will be merged into the exported trace.
- Parameters:
trace_or_event – A complete trace or an individual trace event to be exported.
traces_or_events – More traces or trace events.
display_time_unit – Specifies in which unit timestamps should be displayed. This supports values of “ms” or “ns”. Default value is “ms”.
file_like – A file-like object for writing the JSON.
- Returns:
The JSON dict in Trace Event Format or None if
file_pathis provided.