1SATYR-PYTHON(3) satyr-python SATYR-PYTHON(3)
2
3
4
6 satyr-python - satyr python API
7
8 Contents:
9
11 A Report object represents a single problem report in the uReport for‐
12 mat.
13
14 class satyr.Report
15 satyr.Report - report containing all data relevant to a software
16 problem
17
18 Usage:
19
20 satyr.Report() - creates an empty report object
21
22 satyr.Report(json_string) - creates a report from its JSON rep‐
23 resentation
24
25 auth Dictinary of key/value pairs used for authentication
26
27 component_name
28 Name of the software component this report pertains to
29 (string)
30
31 operating_system
32 Operating system (OperatingSystem object)
33
34 packages
35 List of packages (currently a list of RpmPackage objects)
36
37 report_type
38 Report type (string)
39
40 report_version
41 Version of the report (int)
42
43 reporter_name
44 Name of the reporting software (string)
45
46 reporter_version
47 Version of the reporting software (string)
48
49 stacktrace
50 Problem stacktrace (SingleThreadStacktrace or Multi‐
51 ThreadStacktrace object)
52
53 to_json()
54 Usage: report.to_json()
55
56 Returns: string - the report serialized as JSON
57
58 user_local
59 Did the problem originate in a program executed by local
60 user? (bool)
61
62 user_root
63 Did the problem originate in a program running as root?
64 (bool)
65
66 Operating system
67 Data about operating system are stored in the OperatingSystem object.
68
69 class satyr.OperatingSystem
70 satyr.OperatingSystem - describes an operating system
71
72 Usage:
73
74 satyr.OperatingSystem() - creates an empty operating system
75 object
76
77 satyr.OperatingSystem(name, version, arch) - creates an operat‐
78 ing system object with given properties (all arguments are
79 strings or None)
80
81 architecture
82 Architecture (string)
83
84 cpe Common platform enumeration identifier (string)
85
86 name Operating system name (string)
87
88 uptime Machine uptime (long)
89
90 version
91 Version (string)
92
93 Package
94 The Report can contain a list of software packages. Currently, only RPM
95 packages are supported.
96
97 class satyr.RpmPackage
98 satyr.RpmPackage - RPM package representation
99
100 Usage:
101
102 satyr.RpmPackage() - creates an empty RPM package object
103
104 satyr.RpmPackage(name, epoch, version, release, arch) - creates
105 RPM package object with given properties
106
107 architecture
108 Architecture (string)
109
110 epoch Epoch (int)
111
112 install_time
113 Time of installation (long)
114
115 name Package name (string)
116
117 release
118 Release (string)
119
120 role Role the package plays in the problem. Currently
121 ROLE_UNKNOWN or ROLE_AFFECTED.
122
123 version
124 Version (string)
125
127 Each problem has its own frame, stacktrace and thread type (for prob‐
128 lems that can have multiple threads).
129
130 WARNING:
131 The GdbFrame, GdbThread, and GdbStacktrace have rather limited func‐
132 tionality, cannot be used in reports, and will probably be removed
133 in the future.
134
135 Frame classes
136 Stack frame corresponds to a function invocation saved on the stack.
137 All frame types are derived from the BaseFrame.
138
139 BaseFrame
140 class satyr.BaseFrame
141 satyr.BaseFrame - base class for call frames
142
143 equals()
144 Usage: frame.equals(otherframe)
145
146 Returns: bool - True if frame has attributes equal to
147 otherframe
148
149 short_string()
150 Usage: frame.short_string()
151
152 Returns: string - brief textual representation of the
153 frame
154
155 CoreFrame
156 class satyr.CoreFrame
157 satyr.CoreFrame - class representing a frame in a native exe‐
158 cutable
159
160 Usage: satyr.CoreFrame() - creates an empty frame
161
162 address
163 Address of the machine code in memory (long)
164
165 build_id
166 Build ID of the ELF file (string)
167
168 build_id_offset
169 Offset of the instruction pointer from the start of the
170 executable segment (long)
171
172 dup() Usage: frame.dup()
173
174 Returns: satyr.CoreFrame - a new clone of the frame
175
176 Clones the frame object. All new structures are indepen‐
177 dent of the original object.
178
179 file_name
180 Name of the executable or shared library (string)
181
182 fingerprint
183 Fingerprint of the current function (string)
184
185 fingerprint_hashed
186 True if fingerprint is already hashed (bool)
187
188 function_name
189 Function name (string)
190
191 JavaFrame
192 class satyr.JavaFrame
193 satyr.JavaFrame - class representing a java frame
194
195 Usage:
196
197 satyr.JavaFrame() - creates an empty frame
198
199 satyr.JavaFrame(str) - parses str and fills the frame object
200
201 class_path
202 Class path (string)
203
204 dup() Usage: frame.dup()
205
206 Returns: satyr.JavaFrame - a new clone of frame
207
208 Clones the frame object. All new structures are indepen‐
209 dent of the original object.
210
211 file_line
212 File line (positive integer)
213
214 file_name
215 File name (string)
216
217 is_exception
218 True if frame is an exception frame (bool)
219
220 is_native
221 True if method is native, always false if frame is an
222 exception (bool)
223
224 message
225 Exception message (string)
226
227 name Fully qualified domain name (string)
228
229 KerneloopsFrame
230 class satyr.KerneloopsFrame
231 satyr.KerneloopsFrame - class representing a frame in a ker‐
232 neloops
233
234 Usage:
235
236 satyr.KerneloopsFrame() - creates an empty frame
237
238 satyr.KerneloopsFrame(str) - parses str and fills the frame
239 object
240
241 address
242 Address of the current instruction (long)
243
244 dup() Usage: frame.dup()
245
246 Returns: satyr.KerneloopsFrame - a new clone of frame
247
248 Clones the frame object. All new structures are indepen‐
249 dent of the original object.
250
251 from_address
252 Address of the caller's instruction (long)
253
254 from_function_length
255 Caller function length (long)
256
257 from_function_name
258 Caller function name (string)
259
260 from_function_offset
261 Caller function offset (long)
262
263 from_module_name
264 Module owning the caller function (string)
265
266 function_length
267 Function length (long)
268
269 function_name
270 Function name (string)
271
272 function_offset
273 Function offset (long)
274
275 module_name
276 Module owning the function (string)
277
278 reliable
279 True if the the frame is guaranteed to be real (bool)
280
281 special_stack
282 Identifier of x86_64 kernel stack (string)
283
284 PythonFrame
285 class satyr.PythonFrame
286 satyr.PythonFrame - class representing a python frame
287
288 Usage:
289
290 satyr.PythonFrame() - creates an empty frame
291
292 satyr.PythonFrame(str) - parses str and fills the frame object
293
294 dup() Usage: frame.dup()
295
296 Returns: satyr.PythonFrame - a new clone of frame
297
298 Clones the frame object. All new structures are indepen‐
299 dent of the original object.
300
301 file_line
302 Source line number (positive integer)
303
304 file_name
305 Source file name (string)
306
307 function_name
308 Function name (string)
309
310 line_contents
311 Remaining line contents (string)
312
313 special_file
314 True if the frame is not a real file, like stdin or
315 eval'd string (bool)
316
317 special_function
318 True if the frame doesn't belong to a named function,
319 e.g. lambda or a module
320
321 GdbFrame
322 class satyr.GdbFrame
323 satyr.GdbFrame - class representing a frame in a thread
324
325 Usage:
326
327 satyr.GdbFrame() - creates an empty frame
328
329 satyr.GdbFrame(str) - parses str and fills the frame object
330
331 address
332 Address of the current instruction (long)
333
334 calls_func()
335 Usage: frame.calls_func(name)
336
337 name: string - function name
338
339 Returns: integer - 0 = False, 1 = True
340
341 Checks whether the frame represents a call to a function
342 with given name.
343
344 calls_func_in_file()
345 Usage: frame.calls_func_in_file(name, filename)
346
347 name: string - function name
348
349 filename: string - file name
350
351 Returns: integer - 0 = False, 1 = True
352
353 Checks whether the frame represents a call to a function
354 with given name from a given file.
355
356 dup() Usage: frame.dup()
357
358 Returns: satyr.GdbFrame - a new clone of the frame
359
360 Clones the frame object. All new structures are indepen‐
361 dent of the original object.
362
363 function_name
364 Function name (string)
365
366 function_type
367 Function type (string)
368
369 library_name
370 Executable file name (string)
371
372 number Frame number (positive integer)
373
374 signal_handler_called
375 True if the frame is signal handler (bool)
376
377 source_file
378 Source file name (string)
379
380 source_line
381 Source line number (positive integer)
382
383 Thread classes
384 Thread classes are defined only for problems that can have multiple
385 thread. They all have BaseThread as a base class.
386
387 BaseThread
388 class satyr.BaseThread
389 satyr.BaseThread - base class for threads
390
391 distance()
392 Usage: thread.distance(other, dist_type=DISTANCE_LEVEN‐
393 SHTEIN)
394
395 other: other thread
396
397 dist_type (optional): one of DISTANCE_LEVENSHTEIN, DIS‐
398 TANCE_JARO_WINKLER, DISTANCE_JACCARD or DISTANCE_DAM‐
399 ERAU_LEVENSHTEIN
400
401 Returns: positive float - distance between the two
402 threads
403
404 equals()
405 Usage: frame.equals(otherthread)
406
407 Returns: bool - True if thread has attributes equal to
408 otherthread
409
410 frames A list containing objects representing frames in a
411 thread.
412
413 get_duphash()
414 Usage: thread.get_duphash(frames=0, flags=DUPHASH_NORMAL,
415 prefix='')
416
417 Returns: string - thread's duplication hash
418
419 frames: integer - number of frames to use (default 0
420 means use all)
421
422 flags: integer - bitwise sum of flags (DUPHASH_NORMAL,
423 DUPHASH_NOHASH, DUPHASH_NONORMALIZE, DUPHASH_KOOPS_COM‐
424 PAT)
425
426 prefix: string - string to be prepended in front of the
427 text before hashing
428
429 CoreThread
430 class satyr.CoreThread
431 satyr.CoreThread - class representing a thread in a stacktrace
432
433 Usage: satyr.CoreThread() - creates an empty thread
434
435 dup() Usage: thread.dup()
436
437 Returns: satyr.CoreThread - a new clone of thread
438
439 Clones the thread object. All new structures are indepen‐
440 dent of the original object.
441
442 JavaThread
443 class satyr.JavaThread
444 satyr.JavaThread - class representing a thread in a stacktrace
445
446 Usage:
447
448 satyr.JavaThread() - creates an empty thread
449
450 satyr.JavaThread(str) - parses str and fills the thread object
451
452 dup() Usage: thread.dup()
453
454 Returns: satyr.JavaThread - a new clone of thread
455
456 Clones the thread object. All new structures are indepen‐
457 dent of the original object.
458
459 format_funs()
460 Usage: thread.format_funs()
461
462 Returns: string
463
464 name Thread name (string)
465
466 quality()
467 Usage: thread.quality()
468
469 Returns: float - 0..1, thread quality
470
471 Computes the ratio #good / #all. See quality_counts
472 method for more.
473
474 quality_counts()
475 Usage: thread.quality_counts()
476
477 Returns: tuple (ok, all) - ok representing number of
478 'good' frames, all representing total number of frames
479
480 Counts the number of 'good' frames and the number of all
481 frames. 'Good' means the function name is known (not just
482 '??').
483
484 GdbThread
485 class satyr.GdbThread
486 satyr.GdbThread - class representing a thread in a stacktrace
487
488 Usage:
489
490 satyr.GdbThread() - creates an empty thread
491
492 satyr.GdbThread(str) - parses str and fills the thread object
493
494 satyr.GdbThread(str, only_funs=True) - parses list of function
495 names
496
497 dup() Usage: thread.dup()
498
499 Returns: satyr.GdbThread - a new clone of thread
500
501 Clones the thread object. All new structures are indepen‐
502 dent of the original object.
503
504 format_funs()
505 Usage: thread.format_funs()
506
507 Returns: string
508
509 number Thread number (positive integer)
510
511 quality()
512 Usage: thread.quality()
513
514 Returns: float - 0..1, thread quality
515
516 Computes the ratio #good / #all. See quality_counts
517 method for more.
518
519 quality_counts()
520 Usage: thread.quality_counts()
521
522 Returns: tuple (ok, all) - ok representing number of
523 'good' frames, all representing total number of frames
524
525 Counts the number of 'good' frames and the number of all
526 frames. 'Good' means the function name is known (not just
527 '??').
528
529 Stacktrace classes
530 Single threaded stacktraces have SingleThreadStacktrace as their base
531 class, which is in turn derived from BaseThread. This means that Sin‐
532 gleThreadStacktrace can be treated as a thread:
533
534 · Kerneloops
535
536 · PythonStacktrace
537
538 Stacktrace types with the possibility of multiple threads are derived
539 from MultiThreadStacktrace:
540
541 · CoreStacktrace
542
543 · JavaStacktrace
544
545 · GdbStacktrace
546
547 SingleThreadStacktrace
548 class satyr.SingleThreadStacktrace
549 satyr.SingleThreadStacktrace - base class for stacktrace with
550 single thread
551
552 crash_thread
553 Reference to the thread that caused the crash, if known
554
555 static from_json()
556 Usage: SomeStacktrace.from_json(json_string) (class
557 method)
558
559 Returns: stacktrace (of SomeStacktrace class) deserial‐
560 ized from json_string
561
562 json_string: string - json input
563
564 get_bthash()
565 Usage: stacktrace.get_bthash([flags])
566
567 Returns: string - hash of the stacktrace
568
569 flags: integer - bitwise sum of flags (BTHASH_NORMAL,
570 BTHASH_NOHASH)
571
572 to_short_text()
573 Usage: stacktrace.to_short_text([max_frames])
574
575 Returns short text representation of the stacktrace. If
576 max_frames is specified, the result includes only that
577 much topmost frames.
578
579 MultiThreadStacktrace
580 class satyr.MultiThreadStacktrace
581 satyr.MultiThreadStacktrace - base class for stacktrace with
582 multiple threads
583
584 crash_thread
585 Reference to the thread that caused the crash, if known
586
587 static from_json()
588 Usage: SomeStacktrace.from_json(json_string) (class
589 method)
590
591 Returns: stacktrace (of SomeStacktrace class) deserial‐
592 ized from json_string
593
594 json_string: string - json input
595
596 get_bthash()
597 Usage: stacktrace.get_bthash([flags])
598
599 Returns: string - hash of the stacktrace
600
601 flags: integer - bitwise sum of flags (BTHASH_NORMAL,
602 BTHASH_NOHASH)
603
604 threads
605 A list containing the objects representing threads in the
606 stacktrace.
607
608 to_short_text()
609 Usage: stacktrace.to_short_text([max_frames])
610
611 Returns short text representation of the stacktrace. If
612 max_frames is specified, the result includes only that
613 much topmost frames.
614
615 CoreStacktrace
616 class satyr.CoreStacktrace
617 satyr.CoreStacktrace - class representing a core stacktrace
618
619 Usage:
620
621 satyr.CoreStacktrace() - creates an empty stacktrace
622
623 satyr.CoreStacktrace(json) - creates stacktrace object from JSON
624 string
625
626 dup() Usage: stacktrace.dup()
627
628 Returns: satyr.CoreStacktrace - a new clone of core
629 stacktrace
630
631 Clones the stacktrace object. All new structures are
632 independent of the original object.
633
634 executable
635 Name of the executable (string)
636
637 signal Signal number (int)
638
639 JavaStacktrace
640 class satyr.JavaStacktrace
641 satyr.JavaStacktrace - class representing a java stacktrace
642
643 Usage:
644
645 satyr.JavaStacktrace() - creates an empty stacktrace
646
647 satyr.JavaStacktrace(str) - parses str and fills the stacktrace
648 object
649
650 dup() Usage: stacktrace.dup()
651
652 Returns: satyr.JavaStacktrace - a new clone of java
653 stacktrace
654
655 Clones the stacktrace object. All new structures are
656 independent of the original object.
657
658 Kerneloops
659 class satyr.Kerneloops
660 satyr.Kerneloops - class representing a kerneloops stacktrace
661
662 Usage:
663
664 satyr.Kerneloops() - creates an empty kerneloops stacktrace
665
666 satyr.Kerneloops(str) - parses str and fills the kerneloops
667 stacktrace object
668
669 dup() Usage: stacktrace.dup()
670
671 Returns: satyr.Kerneloops - a new clone of kerneloops
672 stacktrace
673
674 Clones the kerneloops object. All new structures are
675 independent of the original object.
676
677 modules
678 Modules loaded at the time of the event (list of strings)
679
680 normalize()
681 Usage: stacktrace.normalize()
682
683 Normalizes the stacktrace.
684
685 raw_oops
686 Original text of the kerneloops (string)
687
688 taint_flags
689 Dictionary of kernel taint flags. Keys are the flag
690 names, values are booleans indicating whether the flag is
691 set.
692
693 version
694 Kernel version (string)
695
696 PythonStacktrace
697 class satyr.PythonStacktrace
698 satyr.PythonStacktrace - class representing a python stacktrace
699
700 Usage:
701
702 satyr.PythonStacktrace() - creates an empty python stacktrace
703
704 satyr.PythonStacktrace(str) - parses str and fills the python
705 stacktrace object
706
707 dup() Usage: stacktrace.dup()
708
709 Returns: satyr.PythonStacktrace - a new clone of python
710 stacktrace
711
712 Clones the PythonStacktrace object. All new structures
713 are independent of the original object.
714
715 exception_name
716 Exception type (string)
717
718 GdbStacktrace
719 class satyr.GdbStacktrace
720 satyr.GdbStacktrace - class representing a stacktrace
721
722 Usage:
723
724 satyr.GdbStacktrace() - creates an empty stacktrace
725
726 satyr.GdbStacktrace(str) - parses str and fills the stacktrace
727 object
728
729 crashframe
730 Readonly. By default the field contains None. After call‐
731 ing the find_crash_frame method, a reference to
732 satyr.Frame object is stored into the field.
733
734 dup() Usage: stacktrace.dup()
735
736 Returns: satyr.GdbStacktrace - a new clone of stacktrace
737
738 Clones the stacktrace object. All new structures are
739 independent of the original object.
740
741 find_address()
742 Usage: stacktrace.find_address(address)
743
744 address: long - address to find
745
746 Returns: satyr.Sharedlib object or None if not found
747
748 Looks whether the given address belongs to a shared
749 library.
750
751 find_crash_frame()
752 Usage: stacktrace.find_crash_frame()
753
754 Returns: satyr.Frame - crash frame
755
756 Finds crash frame in the stacktrace. Also sets the stack‐
757 trace.crashframe field.
758
759 libs A list containing the satyr.Sharedlib objects represent‐
760 ing shared libraries loaded at the moment of crash.
761
762 limit_frame_depth()
763 Usage: stacktrace.limit_frame_depth(N)
764
765 N: positive integer - frame depth
766
767 Crops all threads to only contain first N frames.
768
769 normalize()
770 Usage: stacktrace.normalize()
771
772 Normalizes all threads in the stacktrace.
773
774 quality_complex()
775 Usage: stacktrace.quality_complex()
776
777 Returns: float - 0..1, stacktrace quality
778
779 Computes the quality from stacktrace, crash thread and
780 frames around the crash.
781
782 quality_simple()
783 Usage: stacktrace.quality_simple()
784
785 Returns: float - 0..1, stacktrace quality
786
787 Computes the quality from stacktrace itself.
788
789 set_libnames()
790 Usage: stacktrace.set_libnames()
791
792 Sets library names according to sharedlibs data.
793
794 to_short_text()
795 Usage: stacktrace.to_short_text([max_frames])
796
797 Returns short text representation of the crash thread. If
798 max_frames is specified, the result includes only that
799 much topmost frames.
800
802 Distance matrix
803 class satyr.Distances
804 satyr.Distances - class representing distances between objects
805
806 Usage:
807
808 satyr.Distances(m, n) - creates an m-by-n distance matrix
809
810 satyr.Distances([threads], m, dist_type=DISTANCE_LEVENSHTEIN) -
811 compares first m threads with others
812
813 dist_type (optional): DISTANCE_LEVENSHTEIN, DISTANCE_JACCARD or
814 DISTANCE_DAMERAU_LEVENSHTEIN
815
816 dup() Usage: distances.dup()
817
818 Returns: satyr.Distances - a new clone of the distances
819
820 Clones the distances object. All new structures are inde‐
821 pendent of the original object.
822
823 get_distance()
824 Usage: distances.get_distance(i, j)
825
826 Returns: positive float - distance between objects i and
827 j
828
829 get_size()
830 Usage: distances.get_size()
831
832 Returns: (m, n) - size of the distance matrix
833
834 set_distance()
835 Usage: distances.set_distance(i, j, d)
836
837 Sets distance between objects i and j to d
838
839 Dendrogram
840 class satyr.Dendrogram
841 satyr.Dendrogram - a dendrogram created by clustering algorithm
842
843 Usage: satyr.Dendrogram(distances) - creates new dendrogram from
844 a distance matrix
845
846 cut() Usage: dendrogram.cut(level, min_size)
847
848 Returns: list of clusters (lists of objects) which have
849 at least min_size objects and which were merged at most
850 at the specified distance
851
852 get_merge_level()
853 Usage: dendrogram.get_merge_level(i)
854
855 Returns: float - merge level between clusters at posi‐
856 tions i and i + 1
857
858 get_object()
859 Usage: dendrogram.get_object(i)
860
861 Returns: integer - index of the object at position i
862
863 get_size()
864 Usage: dendrogram.get_size()
865
866 Returns: integer - number of objects in the dendrogram
867
868 · genindex
869
870 · modindex
871
872 · search
873
875 Red Hat, Inc
876
878 2013, Red Hat, Inc
879
880
881
882
883satyr 0.13 October 30, 2018 SATYR-PYTHON(3)