mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
tracing: one_session_records: keep local tracing ptr
Similar to trace_state keep shared_ptr<tracing> _local_tracing_ptr
in one_session_records when constructed so it can be used
during shutdown.
Fixes #5243
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
(cherry picked from commit 7aef39e400)
This commit is contained in:
@@ -206,8 +206,9 @@ void tracing::set_trace_probability(double p) {
|
||||
}
|
||||
|
||||
one_session_records::one_session_records()
|
||||
: backend_state_ptr(tracing::get_local_tracing_instance().allocate_backend_session_state())
|
||||
, budget_ptr(tracing::get_local_tracing_instance().get_cached_records_ptr()) {}
|
||||
: _local_tracing_ptr(tracing::get_local_tracing_instance().shared_from_this())
|
||||
, backend_state_ptr(_local_tracing_ptr->allocate_backend_session_state())
|
||||
, budget_ptr(_local_tracing_ptr->get_cached_records_ptr()) {}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const span_id& id) {
|
||||
return os << id.get_id();
|
||||
|
||||
@@ -240,6 +240,8 @@ public:
|
||||
};
|
||||
|
||||
class one_session_records {
|
||||
private:
|
||||
shared_ptr<tracing> _local_tracing_ptr;
|
||||
public:
|
||||
utils::UUID session_id;
|
||||
session_record session_rec;
|
||||
@@ -665,7 +667,7 @@ private:
|
||||
|
||||
void one_session_records::set_pending_for_write() {
|
||||
_is_pending_for_write = true;
|
||||
budget_ptr = tracing::get_local_tracing_instance().get_pending_records_ptr();
|
||||
budget_ptr = _local_tracing_ptr->get_pending_records_ptr();
|
||||
}
|
||||
|
||||
void one_session_records::data_consumed() {
|
||||
@@ -674,7 +676,7 @@ void one_session_records::data_consumed() {
|
||||
}
|
||||
|
||||
_is_pending_for_write = false;
|
||||
budget_ptr = tracing::get_local_tracing_instance().get_cached_records_ptr();
|
||||
budget_ptr = _local_tracing_ptr->get_cached_records_ptr();
|
||||
}
|
||||
|
||||
inline span_id span_id::make_span_id() {
|
||||
|
||||
Reference in New Issue
Block a user