MySQL 8.4.2
Source Code Documentation
|
#include "log_service_imp.h"
#include <assert.h>
#include <mysqld_error.h>
#include "my_compiler.h"
#include <mysql/components/services/log_builtins.h>
#include <mysql/components/services/log_builtins_filter.h>
#include <mysql/components/services/log_sink_perfschema.h>
Macros | |
#define | MY_NAME "log_sink_test" |
#define | LOG_COMPONENT_TAG MY_NAME |
#define | LOG_SUBSYSTEM_TAG MY_NAME |
#define | KEY_PRIO_CHANGE "prio_change" |
#define | VAL_PRIO_CHANGE "yes" |
#define | KEY_DEL_ITEM "bark" |
#define | VAL_DEL_ITEM "delete_by_rule" |
#define | KEY_ADD_ITEM "far" |
#define | VAL_ADD_ITEM "added_by_rule" |
#define | KEY_PRS_ITEM "meow" |
Functions | |
REQUIRES_SERVICE_PLACEHOLDER (registry) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_string) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_filter) | |
REQUIRES_SERVICE_PLACEHOLDER (log_builtins_filter_debug) | |
REQUIRES_SERVICE_PLACEHOLDER (log_sink_perfschema) | |
static bool | rule_delete (log_filter_ruleset *rs, log_item_type t, log_item_key key, log_filter_cond cond, log_filter_verb action) |
delete a rule from the given rule-set More... | |
static void | test_add_item_log_me (log_filter_ruleset *rs, const char *label, uint32 orig_count) |
static void | test_if_then_else () |
Show that flow control actually works. More... | |
static int | test_add_item (log_filter_ruleset *rs) |
Show that adding key/value pairs actually works. More... | |
static int | test_builtins () |
Get coverage for some of the built-ins. More... | |
static int | test_throttle (log_filter_ruleset *rs) |
Show that the rate-limiter actually works. More... | |
static void | banner () |
Log a message each from the C and the C++ API to the error logger, showing that we can log from external services! More... | |
mysql_service_status_t | log_service_exit () |
De-initialization method for Component used when unloading the Component. More... | |
mysql_service_status_t | log_service_init () |
Initialization entry method for Component used when loading the Component. More... | |
PROVIDES_SERVICE (log_sink_test, log_service) | |
END_COMPONENT_PROVIDES () | |
REQUIRES_SERVICE (log_builtins) | |
REQUIRES_SERVICE (log_builtins_string) | |
REQUIRES_SERVICE (log_builtins_filter) | |
REQUIRES_SERVICE (log_builtins_filter_debug) | |
REQUIRES_SERVICE (log_sink_perfschema) | |
END_COMPONENT_REQUIRES () | |
METADATA ("mysql.author", "Oracle Corporation") | |
METADATA ("mysql.license", "GPL") | |
METADATA ("log_service_type", "sink") | |
END_COMPONENT_METADATA () | |
Variables | |
const mysql_service_log_builtins_t * | log_bi = nullptr |
accessor built-ins More... | |
const mysql_service_log_builtins_string_t * | log_bs = nullptr |
string built-ins More... | |
const mysql_service_log_builtins_filter_t * | log_bf = nullptr |
const mysql_service_log_builtins_filter_debug_t * | log_fd = nullptr |
const mysql_service_log_sink_perfschema_t * | log_ps = nullptr |
static bool | inited = false |
static bool | failed = false |
static bool | run_tests = true |
const mysql_service_log_service_t | imp_log_sink_test_log_service |
mysql_component_t | mysql_component_log_sink_test |
#define KEY_ADD_ITEM "far" |
#define KEY_DEL_ITEM "bark" |
#define KEY_PRIO_CHANGE "prio_change" |
#define KEY_PRS_ITEM "meow" |
#define LOG_COMPONENT_TAG MY_NAME |
#define LOG_SUBSYSTEM_TAG MY_NAME |
#define MY_NAME "log_sink_test" |
#define VAL_ADD_ITEM "added_by_rule" |
#define VAL_DEL_ITEM "delete_by_rule" |
#define VAL_PRIO_CHANGE "yes" |
|
static |
Log a message each from the C and the C++ API to the error logger, showing that we can log from external services!
END_COMPONENT_METADATA | ( | ) |
END_COMPONENT_PROVIDES | ( | ) |
END_COMPONENT_REQUIRES | ( | ) |
mysql_service_status_t log_service_exit | ( | ) |
De-initialization method for Component used when unloading the Component.
false | success |
true | failure |
mysql_service_status_t log_service_init | ( | ) |
Initialization entry method for Component used when loading the Component.
false | success |
true | failure |
METADATA | ( | "log_service_type" | , |
"sink" | |||
) |
METADATA | ( | "mysql.author" | , |
"Oracle Corporation" | |||
) |
METADATA | ( | "mysql.license" | , |
"GPL" | |||
) |
PROVIDES_SERVICE | ( | log_sink_test | , |
log_service | |||
) |
REQUIRES_SERVICE | ( | log_builtins | ) |
REQUIRES_SERVICE | ( | log_builtins_filter | ) |
REQUIRES_SERVICE | ( | log_builtins_filter_debug | ) |
REQUIRES_SERVICE | ( | log_builtins_string | ) |
REQUIRES_SERVICE | ( | log_sink_perfschema | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_filter | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_filter_debug | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_builtins_string | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | log_sink_perfschema | ) |
REQUIRES_SERVICE_PLACEHOLDER | ( | registry | ) |
|
static |
delete a rule from the given rule-set
rs | the rule-set |
t | type of match-item |
key | key of the match-item if generic (ignored otherwise) |
cond | the condition-code |
action | the action-verb |
false | no problems, rule deleted |
true | error / no rule deleted |
|
static |
Show that adding key/value pairs actually works.
0 | success |
-1 | could not acquire ruleset (to add throttle) |
-2 | could not initialize new rule |
-3 | could not acquire ruleset (to delete throttle) |
-4 | could not delete all rules |
|
static |
|
static |
Get coverage for some of the built-ins.
number | of problems detected |
|
static |
Show that flow control actually works.
This is intended to work in tandem with the log_components_filter.test; the test sets up the filter-rules, and we provided some input to them.
|
static |
Show that the rate-limiter actually works.
0 | success! |
-1 | could not acquire ruleset (to add throttle) |
-2 | could not initialize new rule |
-3 | could not acquire ruleset (to delete throttle) |
|
static |
const mysql_service_log_service_t imp_log_sink_test_log_service |
|
static |
const mysql_service_log_builtins_filter_t* log_bf = nullptr |
const mysql_service_log_builtins_t* log_bi = nullptr |
accessor built-ins
const mysql_service_log_builtins_string_t* log_bs = nullptr |
string built-ins
const mysql_service_log_builtins_filter_debug_t* log_fd = nullptr |
const mysql_service_log_sink_perfschema_t* log_ps = nullptr |
mysql_component_t mysql_component_log_sink_test |
|
static |