MySQL 9.7.0
Source Code Documentation
tm_notification.cc File Reference
#include "tm_notification.h"
#include "tm_global.h"
#include "tm_log.h"
#include "tm_mysql_metric.h"
#include "tm_propagation.h"
#include "tm_psi.h"
#include "tm_required_services.h"
#include "tm_slot.h"
#include "tm_system_variables.h"
#include <chrono>
#include <map>
#include "opentelemetry/logs/log_record.h"
#include "opentelemetry/metrics/async_instruments.h"
#include "opentelemetry/metrics/observer_result.h"

Namespaces

namespace  telemetry
 

Functions

static const nostd::string_view telemetry::k_session ("session")
 
static const nostd::string_view telemetry::k_stmt ("stmt")
 
static const nostd::string_view telemetry::k_processlist_id ("mysql.processlist_id")
 
static const nostd::string_view telemetry::k_thread_id ("mysql.thread_id")
 
static const nostd::string_view telemetry::k_user ("mysql.user")
 
static const nostd::string_view telemetry::k_host ("mysql.host")
 
static const nostd::string_view telemetry::k_group ("mysql.group")
 
static const nostd::string_view telemetry::k_session_attr_prefix ("mysql.session_attr.")
 
static const nostd::string_view telemetry::k_event_name ("mysql.event_name")
 
static const nostd::string_view telemetry::k_lock_time ("mysql.lock_time")
 
static const nostd::string_view telemetry::k_sql_text ("mysql.sql_text")
 
static const nostd::string_view telemetry::k_digest_text ("mysql.digest_text")
 
static const nostd::string_view telemetry::k_current_schema ("mysql.current_schema")
 
static const nostd::string_view telemetry::k_object_type ("mysql.object_type")
 
static const nostd::string_view telemetry::k_object_schema ("mysql.object_schema")
 
static const nostd::string_view telemetry::k_object_name ("mysql.object_name")
 
static const nostd::string_view telemetry::k_sql_errno ("mysql.sql_errno")
 
static const nostd::string_view telemetry::k_sqlstate ("mysql.sqlstate")
 
static const nostd::string_view telemetry::k_message_text ("mysql.message_text")
 
static const nostd::string_view telemetry::k_error_count ("mysql.error_count")
 
static const nostd::string_view telemetry::k_warning_count ("mysql.warning_count")
 
static const nostd::string_view telemetry::k_rows_affected ("mysql.rows_affected")
 
static const nostd::string_view telemetry::k_rows_sent ("mysql.rows_sent")
 
static const nostd::string_view telemetry::k_rows_examined ("mysql.rows_examined")
 
static const nostd::string_view telemetry::k_created_tmp_disk_tables ("mysql.created_tmp_disk_tables")
 
static const nostd::string_view telemetry::k_created_tmp_tables ("mysql.created_tmp_tables")
 
static const nostd::string_view telemetry::k_select_full_join ("mysql.select_full_join")
 
static const nostd::string_view telemetry::k_select_full_range_join ("mysql.select_full_range_join")
 
static const nostd::string_view telemetry::k_select_range ("mysql.select_range")
 
static const nostd::string_view telemetry::k_select_range_check ("mysql.select_range_check")
 
static const nostd::string_view telemetry::k_select_scan ("mysql.select_scan")
 
static const nostd::string_view telemetry::k_sort_merge_passes ("mysql.sort_merge_passes")
 
static const nostd::string_view telemetry::k_sort_range ("mysql.sort_range")
 
static const nostd::string_view telemetry::k_sort_rows ("mysql.sort_rows")
 
static const nostd::string_view telemetry::k_sort_scan ("mysql.sort_scan")
 
static const nostd::string_view telemetry::k_no_index_used ("mysql.no_index_used")
 
static const nostd::string_view telemetry::k_no_good_index_used ("mysql.no_good_index_used")
 
static const nostd::string_view telemetry::k_max_controlled_memory ("mysql.max_controlled_memory")
 
static const nostd::string_view telemetry::k_max_total_memory ("mysql.max_total_memory")
 
static const nostd::string_view telemetry::k_cpu_time ("mysql.cpu_time")
 
void telemetry::inc_session_count ()
 
void telemetry::dec_session_count ()
 
static int64_t telemetry::big_attribute (unsigned long long value)
 
void telemetry::set_span_thread_attr (const opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > &otel_span, const PSI_thread_attrs *thread_attrs)
 
void telemetry::set_span_session_attr (const opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > &otel_span, MYSQL_THD thd)
 
void telemetry::set_span_stmt_aborted (const opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > &otel_span)
 
void telemetry::set_span_stmt_data (const opentelemetry::nostd::shared_ptr< opentelemetry::trace::Span > &otel_span, telemetry_stmt_data_t *stmt_data)
 
void telemetry::tm_thread_create (const PSI_thread_attrs *)
 
void telemetry::tm_thread_destroy (const PSI_thread_attrs *)
 
void telemetry::tm_session_connect (const PSI_thread_attrs *thread_attrs)
 
void telemetry::tm_session_disconnect (const PSI_thread_attrs *thread_attrs)
 
void telemetry::tm_session_change_user (const PSI_thread_attrs *)
 
int telemetry::register_notification_callback ()
 
void telemetry::unregister_notification_callback ()
 
telemetry_session_t * telemetry::tm_session_create ()
 
void telemetry::tm_session_destroy (telemetry_session_t *session)
 
telemetry_locker_t * telemetry::tm_stmt_start (telemetry_session_t *session, uint64_t *flags)
 
void telemetry::tm_set_parent_from_qa (opentelemetry::trace::StartSpanOptions &options, Session_data *data)
 
telemetry_locker_t * telemetry::tm_stmt_notify_qa (telemetry_locker_t *locker, bool with_query_attributes, uint64_t *)
 
void telemetry::tm_stmt_abort (telemetry_locker_t *locker)
 
void telemetry::tm_stmt_end (telemetry_locker_t *locker, telemetry_stmt_data_t *stmt_data)
 
int telemetry::register_telemetry_callback ()
 
void telemetry::unregister_telemetry_callback ()
 
void telemetry::abort_current_session ()
 
void telemetry::wait_for_sessions ()
 
void telemetry::setup_otel_metric (const std::unique_ptr< MySQLMeter > &meter, const char *metric_name, const char *metric_desc, const char *metric_unit, MetricNumType metric_numeric, MetricOTELType metric_type, measurement_callback_t metric_cb, void *metric_cb_context)
 
std::unique_ptr< MySQLMeter > telemetry::do_setup_otel_meter (const char *name, ulong frequency)
 
void telemetry::setup_otel_meter (const char *name, ulong frequency)
 
void telemetry::cleanup_otel_meter (const char *name)
 
void telemetry::tm_meter_change_callback (const char *meter, MeterNotifyType change)
 
void telemetry::setup_otel_meters_notification ()
 
void telemetry::cleanup_otel_meters_notification ()
 
void telemetry::setup_otel_meters ()
 
void telemetry::cleanup_otel_meters ()
 
opentelemetry::logs::Severity telemetry::convert_severity (uint8_t mysql_severity)
 
void telemetry::set_log_record_trace (opentelemetry::logs::LogRecord *record)
 
void telemetry::tm_log_callback (const char *logger_name, OTELLogLevel severity, const char *message, time_t timestamp, const log_attribute_t *attr_array, size_t attr_count)
 
int telemetry::register_telemetry_logger ()
 
void telemetry::unregister_telemetry_logger ()
 

Variables

static bool telemetry::notification_callback_is_registered = false
 
static PSI_notification_v3 telemetry::tm_notif
 
static int telemetry::tm_notification_handle = 0
 
static bool telemetry::telemetry_callback_is_registered = false
 
static telemetry_t telemetry::tm_callback
 
std::map< std::string, std::unique_ptr< MySQLMeter > > telemetry::g_all_meters
 
static bool telemetry::telemetry_logger_is_registered = false