MySQL 9.7.0
Source Code Documentation
tm_slot.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2022, 2026, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef TELEMETRY_SLOT_H_INCLUDED
27#define TELEMETRY_SLOT_H_INCLUDED
28
29#include <opentelemetry/nostd/shared_ptr.h>
30#include <opentelemetry/trace/tracer.h>
31#include <opentelemetry/trace/tracer_provider.h>
32
34
35#include <vector>
36
37namespace telemetry {
38
41
43 public:
44 static Session_data *get(MYSQL_THD thd);
45 static void set(MYSQL_THD thd, Session_data *data);
46
47 static Session_data *create(MYSQL_THD thd, bool trace);
48 static void destroy(Session_data *data);
49
50 explicit Session_data(MYSQL_THD thd, bool trace);
51 ~Session_data() = default;
52
53 void close();
54
55 opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer>
57 opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> m_session_span;
58 std::vector<opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span>>
61 size_t m_depth;
65 bool m_trace;
66};
67
68} // namespace telemetry
69
70#endif /* TELEMETRY_SLOT_H_INCLUDED */
#define MYSQL_THD
Definition: backup_page_tracker.h:38
Definition: tm_slot.h:42
bool m_used_in_telemetry
Definition: tm_slot.h:64
static void destroy(Session_data *data)
Definition: tm_slot.cc:82
bool m_closed
Definition: tm_slot.h:63
opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > m_session_span
Definition: tm_slot.h:57
static Session_data * get(MYSQL_THD thd)
Definition: tm_slot.cc:63
void close()
Definition: tm_slot.cc:100
std::vector< opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > > m_stmt_stack
Definition: tm_slot.h:59
size_t m_depth
Definition: tm_slot.h:61
MYSQL_THD m_thd
Definition: tm_slot.h:60
static void set(MYSQL_THD thd, Session_data *data)
Definition: tm_slot.cc:69
static Session_data * create(MYSQL_THD thd, bool trace)
Definition: tm_slot.cc:77
opentelemetry::nostd::shared_ptr< opentelemetry::trace::Tracer > m_session_tracer
Definition: tm_slot.h:56
bool m_query_attributes_seen
Definition: tm_slot.h:62
bool m_trace
Definition: tm_slot.h:65
Session_data(MYSQL_THD thd, bool trace)
Definition: tm_slot.cc:89
Connection event tracking.
Definition: option_usage.cc:40
int register_telemetry_slot()
Definition: tm_slot.cc:40
void unregister_telemetry_slot()
Definition: tm_slot.cc:52