micromegas 0.3.0__py3-none-any.whl → 0.3.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.
@@ -253,3 +253,56 @@ class FlightSQLClient:
253
253
  for rb in self.query_stream(sql):
254
254
  for index, row in rb.to_pandas().iterrows():
255
255
  print(row["time"], row["msg"])
256
+
257
+ def find_process(self, process_id):
258
+ sql = """
259
+ SELECT *
260
+ FROM processes
261
+ WHERE process_id='{process_id}';
262
+ """.format(
263
+ process_id=process_id
264
+ )
265
+ return self.query(sql)
266
+
267
+ def query_streams(self, begin, end, limit, process_id=None, tag_filter=None):
268
+ conditions = []
269
+ if process_id is not None:
270
+ conditions.append("process_id='{process_id}'".format(process_id=process_id))
271
+ if tag_filter is not None:
272
+ conditions.append(
273
+ "(array_position(tags, '{tag}') is not NULL)".format(tag=tag_filter)
274
+ )
275
+ where = ""
276
+ if len(conditions) > 0:
277
+ where = "WHERE " + " AND ".join(conditions)
278
+ sql = """
279
+ SELECT *
280
+ FROM streams
281
+ {where}
282
+ LIMIT {limit};
283
+ """.format(
284
+ where=where, limit=limit
285
+ )
286
+ return self.query(sql, begin, end)
287
+
288
+ def query_blocks(self, begin, end, limit, stream_id):
289
+ sql = """
290
+ SELECT *
291
+ FROM blocks
292
+ WHERE stream_id='{stream_id}'
293
+ LIMIT {limit};
294
+ """.format(
295
+ limit=limit,stream_id=stream_id
296
+ )
297
+ return self.query(sql, begin, end)
298
+
299
+ def query_spans(self, begin, end, limit, stream_id):
300
+ sql = """
301
+ SELECT *
302
+ FROM view_instance('thread_spans', '{stream_id}')
303
+ LIMIT {limit};
304
+ """.format(
305
+ limit=limit,stream_id=stream_id
306
+ )
307
+ return self.query(sql, begin, end)
308
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micromegas
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Python analytics client for https://github.com/madesroches/micromegas/
5
5
  Author: Marc-Antoine Desroches
6
6
  Author-email: madesroches@gmail.com
@@ -27,20 +27,22 @@ Python analytics client for https://github.com/madesroches/micromegas/
27
27
 
28
28
  ## Example usage
29
29
 
30
- Query the 2 most recent log entries from the analytics service
30
+ Query the 2 most recent log entries from the flightsql service
31
31
 
32
32
  ```python
33
33
  import datetime
34
34
  import pandas as pd
35
35
  import micromegas
36
+ import grpc
36
37
 
37
- BASE_URL = "http://localhost:8082/"
38
- client = micromegas.client.Client(BASE_URL)
38
+ host_port = "localhost:50051"
39
+ channel_cred = grpc.local_channel_credentials()
40
+ client = micromegas.flightsql.client.FlightSQLClient(host_port, channel_cred)
39
41
  sql = """
40
42
  SELECT time, process_id, level, target, msg
41
43
  FROM log_entries
42
44
  WHERE level <= 4
43
- AND exe LIKE '%analytics%'
45
+ AND exe LIKE '%flight%'
44
46
  ORDER BY time DESC
45
47
  LIMIT 2
46
48
  """
@@ -7,7 +7,7 @@ micromegas/flightsql/Flight_pb2_grpc.py,sha256=mj9Nlla3wpf5xFAGhMZpLDX8vLBClWfZ4
7
7
  micromegas/flightsql/__init__.py,sha256=SRq2X59uKG-iuwFnSyT7wVfiTMSSryAAEWnQVjGWOM8,249
8
8
  micromegas/flightsql/arrow_flatbuffers.py,sha256=egpmS59sNFwWmtG2wMeE92MMIyGyZbsm9o24mUnY1MQ,100142
9
9
  micromegas/flightsql/arrow_ipc_reader.py,sha256=3rxyEgqo5100e0TT9ZKZxNe7lX6Lk0mS6yRoiIJtH6Q,3163
10
- micromegas/flightsql/client.py,sha256=kCjrq_mybF-SKhT5X-v5ey0AXukxcaLNvt4P4Ur2Wz8,9717
10
+ micromegas/flightsql/client.py,sha256=IFSUlf67m_2Pk3aleiL34ZeU7iptnA_-9WZ9yqOxQ9M,11328
11
11
  micromegas/flightsql/time.py,sha256=EH3SUEpFvY0lNMj9mOcvfUJuSgrQ3YX4aJnwteK2qhk,582
12
12
  micromegas/perfetto.py,sha256=yuIe5iKvca61aWMBQNziSGM-DHcOEsiobtKx2SsNQ3E,7829
13
13
  micromegas/request.py,sha256=NV0urom5P3_P2q94gX51hxW_Fnrp_DDRorsP3mUb5NM,941
@@ -217,6 +217,6 @@ micromegas/thirdparty/perfetto/protos/perfetto/trace/translation/translation_tab
217
217
  micromegas/thirdparty/perfetto/protos/perfetto/trace/trigger_pb2.py,sha256=We7Yi8o3cEcrSNxY1zLUUO6tEWnD36C2f3O_s8_qv0I,1435
218
218
  micromegas/thirdparty/perfetto/protos/perfetto/trace/ui_state_pb2.py,sha256=Af-SXwhroNhRXMrtw6e2eU1liCImMRxSdmkt_AuSHf8,1752
219
219
  micromegas/time.py,sha256=eD9fWF2UHxaf-92yd1X2SEgUcpKypqPsvjBosLdpnQA,1026
220
- micromegas-0.3.0.dist-info/METADATA,sha256=E4E7CwE4gz3c7WqCPZugw47d92FksajbSl2U0CBQfak,30555
221
- micromegas-0.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
222
- micromegas-0.3.0.dist-info/RECORD,,
220
+ micromegas-0.3.1.dist-info/METADATA,sha256=O_YfkAcg7sEMv3FeclRmF1t91QQja7C0zz52Q0ilNAs,30640
221
+ micromegas-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
222
+ micromegas-0.3.1.dist-info/RECORD,,