Scroll to navigation

SATYR-PYTHON(3) satyr-python SATYR-PYTHON(3)

NAME

satyr-python - satyr python API

Contents:

REPORT

A Report object represents a single problem report in the uReport format.

satyr.Report - report containing all data relevant to a software problem

Usage:

satyr.Report() - creates an empty report object

satyr.Report(json_string) - creates a report from its JSON representation

Dictinary of key/value pairs used for authentication

Name of the software component this report pertains to (string)

Operating system (OperatingSystem object)

List of packages (currently a list of RpmPackage objects)

Report type (string)

Version of the report (int)

Name of the reporting software (string)

Version of the reporting software (string)

Problem stacktrace (SingleThreadStacktrace or MultiThreadStacktrace object)

Usage: report.to_json()

Returns: string - the report serialized as JSON


Did the problem originate in a program executed by local user? (bool)

Did the problem originate in a program running as root? (bool)


Operating system

Data about operating system are stored in the OperatingSystem object.

satyr.OperatingSystem - describes an operating system

Usage:

satyr.OperatingSystem() - creates an empty operating system object

satyr.OperatingSystem(name, version, arch) - creates an operating system object with given properties (all arguments are strings or None)

Architecture (string)

Common platform enumeration identifier (string)

Operating system name (string)

Machine uptime (long)

Version (string)


Package

The Report can contain a list of software packages. Currently, only RPM packages are supported.

satyr.RpmPackage - RPM package representation

Usage:

satyr.RpmPackage() - creates an empty RPM package object

satyr.RpmPackage(name, epoch, version, release, arch) - creates RPM package object with given properties

Architecture (string)

Epoch (int)

Time of installation (long)

Package name (string)

Release (string)

Role the package plays in the problem. Currently ROLE_UNKNOWN or ROLE_AFFECTED.

Version (string)


STACKTRACE

Each problem has its own frame, stacktrace and thread type (for problems that can have multiple threads).

WARNING:

The GdbFrame, GdbThread, and GdbStacktrace have rather limited functionality, cannot be used in reports, and will probably be removed in the future.


Frame classes

Stack frame corresponds to a function invocation saved on the stack. All frame types are derived from the BaseFrame.

BaseFrame

satyr.BaseFrame - base class for call frames
Usage: frame.equals(otherframe)

Returns: bool - True if frame has attributes equal to otherframe


Usage: frame.short_string()

Returns: string - brief textual representation of the frame



CoreFrame

satyr.CoreFrame - class representing a frame in a native executable

Usage: satyr.CoreFrame() - creates an empty frame

Address of the machine code in memory (long)

Build ID of the ELF file (string)

Offset of the instruction pointer from the start of the executable segment (long)

Usage: frame.dup()

Returns: satyr.CoreFrame - a new clone of the frame

Clones the frame object. All new structures are independent of the original object.


Name of the executable or shared library (string)

Fingerprint of the current function (string)

True if fingerprint is already hashed (bool)

Function name (string)


JavaFrame

satyr.JavaFrame - class representing a java frame

Usage:

satyr.JavaFrame() - creates an empty frame

satyr.JavaFrame(str) - parses str and fills the frame object

Class path (string)

Usage: frame.dup()

Returns: satyr.JavaFrame - a new clone of frame

Clones the frame object. All new structures are independent of the original object.


File line (positive integer)

File name (string)

True if frame is an exception frame (bool)

True if method is native, always false if frame is an exception (bool)

Exception message (string)

Fully qualified domain name (string)


KerneloopsFrame

satyr.KerneloopsFrame - class representing a frame in a kerneloops

Usage:

satyr.KerneloopsFrame() - creates an empty frame

satyr.KerneloopsFrame(str) - parses str and fills the frame object

Address of the current instruction (long)

Usage: frame.dup()

Returns: satyr.KerneloopsFrame - a new clone of frame

Clones the frame object. All new structures are independent of the original object.


Address of the caller's instruction (long)

Caller function length (long)

Caller function name (string)

Caller function offset (long)

Module owning the caller function (string)

Function length (long)

Function name (string)

Function offset (long)

Module owning the function (string)

True if the the frame is guaranteed to be real (bool)

Identifier of x86_64 kernel stack (string)


PythonFrame

satyr.PythonFrame - class representing a python frame

Usage:

satyr.PythonFrame() - creates an empty frame

satyr.PythonFrame(str) - parses str and fills the frame object

Usage: frame.dup()

Returns: satyr.PythonFrame - a new clone of frame

Clones the frame object. All new structures are independent of the original object.


Source line number (positive integer)

Source file name (string)

Function name (string)

Remaining line contents (string)

True if the frame is not a real file, like stdin or eval'd string (bool)

True if the frame doesn't belong to a named function, e.g. lambda or a module


GdbFrame

satyr.GdbFrame - class representing a frame in a thread

Usage:

satyr.GdbFrame() - creates an empty frame

satyr.GdbFrame(str) - parses str and fills the frame object

Address of the current instruction (long)

Usage: frame.calls_func(name)

name: string - function name

Returns: integer - 0 = False, 1 = True

Checks whether the frame represents a call to a function with given name.


Usage: frame.calls_func_in_file(name, filename)

name: string - function name

filename: string - file name

Returns: integer - 0 = False, 1 = True

Checks whether the frame represents a call to a function with given name from a given file.


Usage: frame.dup()

Returns: satyr.GdbFrame - a new clone of the frame

Clones the frame object. All new structures are independent of the original object.


Function name (string)

Function type (string)

Executable file name (string)

Frame number (positive integer)

True if the frame is signal handler (bool)

Source file name (string)

Source line number (positive integer)


Thread classes

Thread classes are defined only for problems that can have multiple thread. They all have BaseThread as a base class.

BaseThread

satyr.BaseThread - base class for threads
Usage: thread.distance(other, dist_type=DISTANCE_LEVENSHTEIN)

other: other thread

dist_type (optional): one of DISTANCE_LEVENSHTEIN, DISTANCE_JARO_WINKLER, DISTANCE_JACCARD or DISTANCE_DAMERAU_LEVENSHTEIN

Returns: positive float - distance between the two threads


Usage: frame.equals(otherthread)

Returns: bool - True if thread has attributes equal to otherthread


A list containing objects representing frames in a thread.

Usage: thread.get_duphash(frames=0, flags=DUPHASH_NORMAL, prefix='')

Returns: string - thread's duplication hash

frames: integer - number of frames to use (default 0 means use all)

flags: integer - bitwise sum of flags (DUPHASH_NORMAL, DUPHASH_NOHASH, DUPHASH_NONORMALIZE, DUPHASH_KOOPS_COMPAT)

prefix: string - string to be prepended in front of the text before hashing



CoreThread

satyr.CoreThread - class representing a thread in a stacktrace

Usage: satyr.CoreThread() - creates an empty thread

Usage: thread.dup()

Returns: satyr.CoreThread - a new clone of thread

Clones the thread object. All new structures are independent of the original object.



JavaThread

satyr.JavaThread - class representing a thread in a stacktrace

Usage:

satyr.JavaThread() - creates an empty thread

satyr.JavaThread(str) - parses str and fills the thread object

Usage: thread.dup()

Returns: satyr.JavaThread - a new clone of thread

Clones the thread object. All new structures are independent of the original object.


Usage: thread.format_funs()

Returns: string


Thread name (string)

Usage: thread.quality()

Returns: float - 0..1, thread quality

Computes the ratio #good / #all. See quality_counts method for more.


Usage: thread.quality_counts()

Returns: tuple (ok, all) - ok representing number of 'good' frames, all representing total number of frames

Counts the number of 'good' frames and the number of all frames. 'Good' means the function name is known (not just '??').



GdbThread

satyr.GdbThread - class representing a thread in a stacktrace

Usage:

satyr.GdbThread() - creates an empty thread

satyr.GdbThread(str) - parses str and fills the thread object

satyr.GdbThread(str, only_funs=True) - parses list of function names

Usage: thread.dup()

Returns: satyr.GdbThread - a new clone of thread

Clones the thread object. All new structures are independent of the original object.


Usage: thread.format_funs()

Returns: string


Thread number (positive integer)

Usage: thread.quality()

Returns: float - 0..1, thread quality

Computes the ratio #good / #all. See quality_counts method for more.


Usage: thread.quality_counts()

Returns: tuple (ok, all) - ok representing number of 'good' frames, all representing total number of frames

Counts the number of 'good' frames and the number of all frames. 'Good' means the function name is known (not just '??').



Stacktrace classes

Single threaded stacktraces have SingleThreadStacktrace as their base class, which is in turn derived from BaseThread. This means that SingleThreadStacktrace can be treated as a thread:

  • Kerneloops
  • PythonStacktrace



Stacktrace types with the possibility of multiple threads are derived from MultiThreadStacktrace:

  • CoreStacktrace
  • JavaStacktrace
  • GdbStacktrace



SingleThreadStacktrace

satyr.SingleThreadStacktrace - base class for stacktrace with single thread
Reference to the thread that caused the crash, if known

Usage: SomeStacktrace.from_json(json_string) (class method)

Returns: stacktrace (of SomeStacktrace class) deserialized from json_string

json_string: string - json input


Usage: stacktrace.get_bthash([flags])

Returns: string - hash of the stacktrace

flags: integer - bitwise sum of flags (BTHASH_NORMAL, BTHASH_NOHASH)


Usage: stacktrace.to_short_text([max_frames])

Returns short text representation of the stacktrace. If max_frames is specified, the result includes only that much topmost frames.



MultiThreadStacktrace

satyr.MultiThreadStacktrace - base class for stacktrace with multiple threads
Reference to the thread that caused the crash, if known

Usage: SomeStacktrace.from_json(json_string) (class method)

Returns: stacktrace (of SomeStacktrace class) deserialized from json_string

json_string: string - json input


Usage: stacktrace.get_bthash([flags])

Returns: string - hash of the stacktrace

flags: integer - bitwise sum of flags (BTHASH_NORMAL, BTHASH_NOHASH)


A list containing the objects representing threads in the stacktrace.

Usage: stacktrace.to_short_text([max_frames])

Returns short text representation of the stacktrace. If max_frames is specified, the result includes only that much topmost frames.



CoreStacktrace

satyr.CoreStacktrace - class representing a core stacktrace

Usage:

satyr.CoreStacktrace() - creates an empty stacktrace

satyr.CoreStacktrace(json) - creates stacktrace object from JSON string

Usage: stacktrace.dup()

Returns: satyr.CoreStacktrace - a new clone of core stacktrace

Clones the stacktrace object. All new structures are independent of the original object.


Name of the executable (string)

Signal number (int)


JavaStacktrace

satyr.JavaStacktrace - class representing a java stacktrace

Usage:

satyr.JavaStacktrace() - creates an empty stacktrace

satyr.JavaStacktrace(str) - parses str and fills the stacktrace object

Usage: stacktrace.dup()

Returns: satyr.JavaStacktrace - a new clone of java stacktrace

Clones the stacktrace object. All new structures are independent of the original object.



Kerneloops

satyr.Kerneloops - class representing a kerneloops stacktrace

Usage:

satyr.Kerneloops() - creates an empty kerneloops stacktrace

satyr.Kerneloops(str) - parses str and fills the kerneloops stacktrace object

Usage: stacktrace.dup()

Returns: satyr.Kerneloops - a new clone of kerneloops stacktrace

Clones the kerneloops object. All new structures are independent of the original object.


Modules loaded at the time of the event (list of strings)

Usage: stacktrace.normalize()

Normalizes the stacktrace.


Original text of the kerneloops (string)

Dictionary of kernel taint flags. Keys are the flag names, values are booleans indicating whether the flag is set.

Kernel version (string)


PythonStacktrace

satyr.PythonStacktrace - class representing a python stacktrace

Usage:

satyr.PythonStacktrace() - creates an empty python stacktrace

satyr.PythonStacktrace(str) - parses str and fills the python stacktrace object

Usage: stacktrace.dup()

Returns: satyr.PythonStacktrace - a new clone of python stacktrace

Clones the PythonStacktrace object. All new structures are independent of the original object.


Exception type (string)


GdbStacktrace

satyr.GdbStacktrace - class representing a stacktrace

Usage:

satyr.GdbStacktrace() - creates an empty stacktrace

satyr.GdbStacktrace(str) - parses str and fills the stacktrace object

Readonly. By default the field contains None. After calling the find_crash_frame method, a reference to satyr.Frame object is stored into the field.

Usage: stacktrace.dup()

Returns: satyr.GdbStacktrace - a new clone of stacktrace

Clones the stacktrace object. All new structures are independent of the original object.


Usage: stacktrace.find_address(address)

address: long - address to find

Returns: satyr.Sharedlib object or None if not found

Looks whether the given address belongs to a shared library.


Usage: stacktrace.find_crash_frame()

Returns: satyr.Frame - crash frame

Finds crash frame in the stacktrace. Also sets the stacktrace.crashframe field.


A list containing the satyr.Sharedlib objects representing shared libraries loaded at the moment of crash.

Usage: stacktrace.limit_frame_depth(N)

N: positive integer - frame depth

Crops all threads to only contain first N frames.


Usage: stacktrace.normalize()

Normalizes all threads in the stacktrace.


Usage: stacktrace.quality_complex()

Returns: float - 0..1, stacktrace quality

Computes the quality from stacktrace, crash thread and frames around the crash.


Usage: stacktrace.quality_simple()

Returns: float - 0..1, stacktrace quality

Computes the quality from stacktrace itself.


Usage: stacktrace.set_libnames()

Sets library names according to sharedlibs data.


Usage: stacktrace.to_short_text([max_frames])

Returns short text representation of the crash thread. If max_frames is specified, the result includes only that much topmost frames.



CLUSTERING

Distance matrix

satyr.Distances - class representing distances between objects

Usage:

satyr.Distances(m, n) - creates an m-by-n distance matrix

satyr.Distances([threads], m, dist_type=DISTANCE_LEVENSHTEIN) - compares first m threads with others

dist_type (optional): DISTANCE_LEVENSHTEIN, DISTANCE_JACCARD or DISTANCE_DAMERAU_LEVENSHTEIN

Usage: distances.dup()

Returns: satyr.Distances - a new clone of the distances

Clones the distances object. All new structures are independent of the original object.


Usage: distances.get_distance(i, j)

Returns: positive float - distance between objects i and j


Usage: distances.get_size()

Returns: (m, n) - size of the distance matrix


Usage: distances.set_distance(i, j, d)

Sets distance between objects i and j to d



Dendrogram

satyr.Dendrogram - a dendrogram created by clustering algorithm

Usage: satyr.Dendrogram(distances) - creates new dendrogram from a distance matrix

Usage: dendrogram.cut(level, min_size)

Returns: list of clusters (lists of objects) which have at least min_size objects and which were merged at most at the specified distance


Usage: dendrogram.get_merge_level(i)

Returns: float - merge level between clusters at positions i and i + 1


Usage: dendrogram.get_object(i)

Returns: integer - index of the object at position i


Usage: dendrogram.get_size()

Returns: integer - number of objects in the dendrogram



  • genindex
  • modindex
  • search

AUTHOR

Red Hat, Inc

COPYRIGHT

2013, Red Hat, Inc

November 1, 2018 satyr 0.13