Hi!
> 1) query_id added so span to be able to join it with pg_stat_activity and pg_stat_statements;
Sounds good, I've added your changes with my code.
> 2) table for storing spans added, to flush spans buffer
I'm not sure about this. It means that this is something that would only be available on primary as replicas won't be able
to write data in the table. It will also make version updates and migrations much more complex and I haven't seen a similar
pattern on other extensions.
> 3) added setter function for sampling_rate GUC to tweak it on-the-fly without restart
ok, I've added this in my branch.
On my side, I've made the following changes:
1) All spans are now kept in palloced buffers and only added during end_tracing. This way, we limit the shared_spans lock.
2) I've added a pg_tracing.drop_on_full_buffer parameter to drop all spans when the buffer is full. This could be useful to always keep
the latest spans when the consuming app is not fast enough. This is also useful for testing.
3) I'm testing more complex queries. Most of my previous tests were using simple query protocol but extended protocol introduces
differences that break some assumptions I did. For example, with multi statement transaction like
BEGIN;
SELECT 1;
SELECT 2;
The parse of SELECT 2 will happen before the ExecutorEnd (and the end_tracing) of SELECT 1. For now, I'm skipping the post parse
hook if we still have an ongoing tracing.
working to fix those.