MySQL 9.1.0
Source Code Documentation
server_logs_component.cc File Reference
#include "server_logs_component.h"
#include <chrono>
#include <map>
#include "mysqld_error.h"
#include "server_logs_helpers.h"

Functions

 REQUIRES_SERVICE_PLACEHOLDER (log_builtins)
 
 REQUIRES_SERVICE_PLACEHOLDER (log_builtins_string)
 
 REQUIRES_SERVICE_PLACEHOLDER_AS (mysql_server_telemetry_logs, telemetry_logs_srv)
 
 REQUIRES_SERVICE_PLACEHOLDER_AS (component_sys_variable_register, sysvar_register_srv)
 
 REQUIRES_SERVICE_PLACEHOLDER_AS (component_sys_variable_unregister, sysvar_unregister_srv)
 
 REQUIRES_SERVICE_PLACEHOLDER_AS (udf_registration, udf_registration_srv)
 
void dummy_log_cb (const char *logger_name, OTELLogLevel severity, const char *message, time_t timestamp, const log_attribute_t *attr_array, size_t attr_count)
 
void telemetry_log_cb (const char *logger_name, OTELLogLevel severity, const char *message, time_t timestamp, const log_attribute_t *attr_array, size_t attr_count)
 
static bool register_telemetry_callback ()
 
static bool unregister_telemetry_callback ()
 
static int register_system_variables ()
 
static void unregister_system_variables ()
 
static bool log_service_init ()
 logger services initialization method for Component used when loading the Component. More...
 
static bool log_service_deinit ()
 logger services de-initialization method for Component used when unloading the Component. More...
 
static long long test_unregister_callback (UDF_INIT *init, UDF_ARGS *args, unsigned char *null_value, unsigned char *error)
 Unregister telemetry callback, used for benchmarking comparisons. More...
 
static long long test_invalid_operations (UDF_INIT *init, UDF_ARGS *args, unsigned char *null_value, unsigned char *error)
 Test error handling by triggering some invalid API calls. More...
 
static void unregister_udf ()
 
static bool register_udf ()
 
mysql_service_status_t test_server_telemetry_logs_component_init ()
 Initialize the test_server_telemetry_logs component at server start or component installation: More...
 
mysql_service_status_t test_server_telemetry_logs_component_deinit ()
 Terminate the test_server_telemetry_logs_component at server shutdown or component deinstallation: More...
 
 END_COMPONENT_PROVIDES ()
 
 REQUIRES_SERVICE (log_builtins)
 
 REQUIRES_SERVICE (log_builtins_string)
 
 REQUIRES_SERVICE_AS (mysql_server_telemetry_logs, telemetry_logs_srv)
 
 REQUIRES_SERVICE_AS (component_sys_variable_register, sysvar_register_srv)
 
 REQUIRES_SERVICE_AS (component_sys_variable_unregister, sysvar_unregister_srv)
 
 REQUIRES_SERVICE_AS (udf_registration, udf_registration_srv)
 
 END_COMPONENT_REQUIRES ()
 
 METADATA ("mysql.author", "Oracle Corporation")
 
 METADATA ("mysql.license", "GPL")
 
 METADATA ("test_property", "1")
 
 END_COMPONENT_METADATA ()
 

Variables

static FileLogger g_log ("test_server_telemetry_logs_component.log")
 
static int filter_severity_value = 9999
 
const mysql_service_log_builtins_tlog_bi
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs
 string built-ins More...
 
mysql_component_t mysql_component_test_server_telemetry_logs_export
 

Function Documentation

◆ dummy_log_cb()

void dummy_log_cb ( const char *  logger_name,
OTELLogLevel  severity,
const char *  message,
time_t  timestamp,
const log_attribute_t attr_array,
size_t  attr_count 
)

◆ END_COMPONENT_METADATA()

END_COMPONENT_METADATA ( )

◆ END_COMPONENT_PROVIDES()

END_COMPONENT_PROVIDES ( )

◆ END_COMPONENT_REQUIRES()

END_COMPONENT_REQUIRES ( )

◆ log_service_deinit()

static bool log_service_deinit ( )
static

logger services de-initialization method for Component used when unloading the Component.

Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ log_service_init()

static bool log_service_init ( )
static

logger services initialization method for Component used when loading the Component.

Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ METADATA() [1/3]

METADATA ( "mysql.author"  ,
"Oracle Corporation"   
)

◆ METADATA() [2/3]

METADATA ( "mysql.license"  ,
"GPL"   
)

◆ METADATA() [3/3]

METADATA ( "test_property"  ,
"1"   
)

◆ register_system_variables()

static int register_system_variables ( )
static

◆ register_telemetry_callback()

static bool register_telemetry_callback ( )
static

◆ register_udf()

static bool register_udf ( )
static

◆ REQUIRES_SERVICE() [1/2]

REQUIRES_SERVICE ( log_builtins  )

◆ REQUIRES_SERVICE() [2/2]

REQUIRES_SERVICE ( log_builtins_string  )

◆ REQUIRES_SERVICE_AS() [1/4]

REQUIRES_SERVICE_AS ( component_sys_variable_register  ,
sysvar_register_srv   
)

◆ REQUIRES_SERVICE_AS() [2/4]

REQUIRES_SERVICE_AS ( component_sys_variable_unregister  ,
sysvar_unregister_srv   
)

◆ REQUIRES_SERVICE_AS() [3/4]

REQUIRES_SERVICE_AS ( mysql_server_telemetry_logs  ,
telemetry_logs_srv   
)

◆ REQUIRES_SERVICE_AS() [4/4]

REQUIRES_SERVICE_AS ( udf_registration  ,
udf_registration_srv   
)

◆ REQUIRES_SERVICE_PLACEHOLDER() [1/2]

REQUIRES_SERVICE_PLACEHOLDER ( log_builtins  )

◆ REQUIRES_SERVICE_PLACEHOLDER() [2/2]

REQUIRES_SERVICE_PLACEHOLDER ( log_builtins_string  )

◆ REQUIRES_SERVICE_PLACEHOLDER_AS() [1/4]

REQUIRES_SERVICE_PLACEHOLDER_AS ( component_sys_variable_register  ,
sysvar_register_srv   
)

◆ REQUIRES_SERVICE_PLACEHOLDER_AS() [2/4]

REQUIRES_SERVICE_PLACEHOLDER_AS ( component_sys_variable_unregister  ,
sysvar_unregister_srv   
)

◆ REQUIRES_SERVICE_PLACEHOLDER_AS() [3/4]

REQUIRES_SERVICE_PLACEHOLDER_AS ( mysql_server_telemetry_logs  ,
telemetry_logs_srv   
)

◆ REQUIRES_SERVICE_PLACEHOLDER_AS() [4/4]

REQUIRES_SERVICE_PLACEHOLDER_AS ( udf_registration  ,
udf_registration_srv   
)

◆ telemetry_log_cb()

void telemetry_log_cb ( const char *  logger_name,
OTELLogLevel  severity,
const char *  message,
time_t  timestamp,
const log_attribute_t attr_array,
size_t  attr_count 
)

◆ test_invalid_operations()

static long long test_invalid_operations ( UDF_INIT init,
UDF_ARGS args,
unsigned char *  null_value,
unsigned char *  error 
)
static

Test error handling by triggering some invalid API calls.

The call of this function also increases code coverage.

Parameters
initUnused.
argsUnused.
null_valueUnused.
errorUnused.
Return values
0This function always returns 0.

◆ test_server_telemetry_logs_component_deinit()

mysql_service_status_t test_server_telemetry_logs_component_deinit ( )

Terminate the test_server_telemetry_logs_component at server shutdown or component deinstallation:

  • Unregister telemetry logs callback
  • Unregister system variables
  • Unregister UDFs
  • Deinitialize log service
Return values
0success
non-zerofailure

◆ test_server_telemetry_logs_component_init()

mysql_service_status_t test_server_telemetry_logs_component_init ( )

Initialize the test_server_telemetry_logs component at server start or component installation:

  • Initialize log service
  • Register system variables
  • Register telemetry logs callback
  • Register UDFs
Return values
0success
non-zerofailure

◆ test_unregister_callback()

static long long test_unregister_callback ( UDF_INIT init,
UDF_ARGS args,
unsigned char *  null_value,
unsigned char *  error 
)
static

Unregister telemetry callback, used for benchmarking comparisons.

Parameters
initUnused.
argsUnused.
null_valueUnused.
errorUnused.
Return values
0This function always returns 0.

◆ unregister_system_variables()

static void unregister_system_variables ( )
static

◆ unregister_telemetry_callback()

static bool unregister_telemetry_callback ( )
static

◆ unregister_udf()

static void unregister_udf ( )
static

Variable Documentation

◆ filter_severity_value

int filter_severity_value = 9999
static

◆ g_log

FileLogger g_log("test_server_telemetry_logs_component.log") ( "test_server_telemetry_logs_component.log"  )
static

◆ log_bi

accessor built-ins

accessor built-ins

◆ log_bs

string built-ins

◆ mysql_component_test_server_telemetry_logs_export

mysql_component_t mysql_component_test_server_telemetry_logs_export
Initial value:
= { "mysql:test_server_telemetry_logs_export" , __test_server_telemetry_logs_export_provides, __test_server_telemetry_logs_export_requires, __test_server_telemetry_logs_export_metadata,
mysql_service_status_t test_server_telemetry_logs_component_deinit()
Terminate the test_server_telemetry_logs_component at server shutdown or component deinstallation:
Definition: server_logs_component.cc:483
mysql_service_status_t test_server_telemetry_logs_component_init()
Initialize the test_server_telemetry_logs component at server start or component installation:
Definition: server_logs_component.cc:444