pg-lock-tracer 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- __version__ = "0.6.0"
1
+ __version__ = "0.6.1"
@@ -207,7 +207,7 @@ class DOTModel:
207
207
  if self.verbose:
208
208
  print(f"Processing {event}")
209
209
 
210
- tablename = event["table"]
210
+ tablename = StringHelper.get_tablename(event)
211
211
  lock_type = event["lock_type"]
212
212
 
213
213
  if not self.graph.vs.select(label_eq=tablename):
@@ -244,7 +244,7 @@ class DOTModel:
244
244
  if self.verbose:
245
245
  print(f"Processing {event}")
246
246
 
247
- tablename = event["table"]
247
+ tablename = StringHelper.get_tablename(event)
248
248
  lock_type = event["lock_type"]
249
249
  lock_numeric_value = PostgreSQLLockHelper.lock_type_to_int(lock_type)
250
250
 
@@ -383,6 +383,16 @@ class StringHelper:
383
383
 
384
384
  return result
385
385
 
386
+ @staticmethod
387
+ def get_tablename(event):
388
+ """
389
+ Get the tablename or the Oid of the event.
390
+ """
391
+ if "table" in event:
392
+ return event["table"]
393
+
394
+ return f"Oid {event['oid']}"
395
+
386
396
 
387
397
  def main():
388
398
  """
pg_lock_tracer/helper.py CHANGED
@@ -10,7 +10,6 @@ from bcc import BPF
10
10
 
11
11
 
12
12
  class PostgreSQLLockHelper:
13
-
14
13
  """
15
14
  # Defines taken from: src/include/storage/lockdefs.h
16
15
  #
@@ -1,4 +1,5 @@
1
1
  """Resolve PostgreSQL OIDs to names and cache the result"""
2
+
2
3
  import sys
3
4
 
4
5
  from urllib.parse import urlparse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pg_lock_tracer
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A BPF based lock tracer for the PostgreSQL database
5
5
  Home-page: https://github.com/jnidzwetzki/pg-lock-tracer
6
6
  Author: Jan Nidzwetzki
@@ -74,8 +74,13 @@ pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -
74
74
  # Show statistics about locks
75
75
  pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 --statistics
76
76
 
77
- # Create an animated lock graph
78
- animate_lock_graph -i create_table_trace.json -o create_table_trace.html
77
+ # Create an animated lock graph (with Oids)
78
+ pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -j -o locks.json
79
+ animate_lock_graph -i lock -o locks.html
80
+
81
+ # Create an animated lock graph (with table names)
82
+ pg_lock_tracer -x /home/jan/postgresql-sandbox/bin/REL_15_1_DEBUG/bin/postgres -p 1234 -j -r 1234:psql://jan@localhost/test2 -o locks.json
83
+ animate_lock_graph -i lock -o locks.html
79
84
  ```
80
85
 
81
86
  ## Example Output
@@ -1,7 +1,7 @@
1
- pg_lock_tracer/__init__.py,sha256=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,22
2
- pg_lock_tracer/animate_lock_graph.py,sha256=ohRKBlKILx7f2I0sBC26UYEG7mIbrNcDttmIwR8Aokk,12033
3
- pg_lock_tracer/helper.py,sha256=4l_H6rCXShPu-snBA_OqCgKTzHUYEbgWK3zhmi6WJ9M,5271
4
- pg_lock_tracer/oid_resolver.py,sha256=K0oF7SRZfqm092Tc_pZ-RlCpfHtnspwhjX1meTsU8Fk,3534
1
+ pg_lock_tracer/__init__.py,sha256=baAcEjLSYFIeNZF51tOMmA_zAMhN8HvKael-UU-Ruec,22
2
+ pg_lock_tracer/animate_lock_graph.py,sha256=J8b57ySVq_6QeL6_IJyycYzQK0CBkOcdGdicdJOa3Mc,12296
3
+ pg_lock_tracer/helper.py,sha256=1RnApDu4u3tzyy2fh3aIfNTPToZTUOVZvzpYvNFGvvA,5270
4
+ pg_lock_tracer/oid_resolver.py,sha256=B9kAqNzrFPP3UdstpUXkKR_No9EKLD_5nsd9ERH8vKI,3535
5
5
  pg_lock_tracer/pg_lock_tracer.py,sha256=OohbLE1xSUbHiU3lSGJYACUgAVtVoK1V0Ew7kD_smlQ,30060
6
6
  pg_lock_tracer/pg_lw_lock_tracer.py,sha256=Jgsr9ArWQigj-ndeAKEObVIYyNIaTKNGIkDrtA8sj9w,13204
7
7
  pg_lock_tracer/pg_row_lock_tracer.py,sha256=duQalO2vf-QX4WRFd6K0WRunFlZbTHZeVkeWkr35zbo,10405
@@ -9,9 +9,9 @@ pg_lock_tracer/bpf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
9
9
  pg_lock_tracer/bpf/pg_lock_tracer.c,sha256=EM9gFZtkeBROIM692s-DrD-xlW0khFRNLXPN5_nBFBg,14003
10
10
  pg_lock_tracer/bpf/pg_lw_lock_tracer.c,sha256=BxEpEOCo7hLJSOjcsKkng3kZhYJ80A_6k-9nxaJ6e2A,4916
11
11
  pg_lock_tracer/bpf/pg_row_lock_tracer.c,sha256=U2Uqtv68qi72bJCVNHdpO68QTVJzhUFRATHX4hCWzDY,3344
12
- pg_lock_tracer-0.6.0.dist-info/LICENSE,sha256=opL3U54Vdmg02lhP1XzHATC9Fyy393DcZBi-HqotSlQ,11348
13
- pg_lock_tracer-0.6.0.dist-info/METADATA,sha256=1Hc_aUDwBCatzVTNJVBsev9FAmSPN1pkQrFkMrbNatE,73024
14
- pg_lock_tracer-0.6.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
15
- pg_lock_tracer-0.6.0.dist-info/entry_points.txt,sha256=kCKw8Zbn3YXKdu8mBeVzIzOmGoLjD-5D40CZg8-_W9c,248
16
- pg_lock_tracer-0.6.0.dist-info/top_level.txt,sha256=nRoLeqWT0GSR4-JDcVRuI5ltF69rs7ftfkvImNbiR1Q,15
17
- pg_lock_tracer-0.6.0.dist-info/RECORD,,
12
+ pg_lock_tracer-0.6.1.dist-info/LICENSE,sha256=opL3U54Vdmg02lhP1XzHATC9Fyy393DcZBi-HqotSlQ,11348
13
+ pg_lock_tracer-0.6.1.dist-info/METADATA,sha256=0O5dWAfbpoFbdQWVTPwMksJ-EZTZkn-giCB5kOzyjDA,73340
14
+ pg_lock_tracer-0.6.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
15
+ pg_lock_tracer-0.6.1.dist-info/entry_points.txt,sha256=kCKw8Zbn3YXKdu8mBeVzIzOmGoLjD-5D40CZg8-_W9c,248
16
+ pg_lock_tracer-0.6.1.dist-info/top_level.txt,sha256=nRoLeqWT0GSR4-JDcVRuI5ltF69rs7ftfkvImNbiR1Q,15
17
+ pg_lock_tracer-0.6.1.dist-info/RECORD,,