MySQL 8.0.40
Source Code Documentation
log_sink_perfschema.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/**
25 This defines functions to let logging services add error log events
26 to performance_schema.error_log.
27
28 For documentation of the individual functions, see log_sink_perfschema.cc
29*/
30
31#ifndef LOG_SINK_PERFSCHEMA_H
32#define LOG_SINK_PERFSCHEMA_H
33
35
36/**
37 Primitives for logging services to add to performance_schema.error_log.
38*/
40
41/**
42 Add a log-event to the ring buffer.
43
44 We require the various pieces of information to be passed individually
45 rather than accepting a log_sink_pfs_event so we can sanity check each
46 part individually and don't have to worry about different components
47 using different versions/sizes of the struct.
48
49 We copy the data as needed, so caller may free their copy once this
50 call returns.
51
52 @param timestamp Timestamp (in microseconds), or
53 0 to have one generated
54 @param thread_id thread_id of the thread that detected
55 the issue
56 @param prio (INFORMATION|WARNING|ERROR|SYSTEM)_LEVEL
57 @param error_code MY-123456
58 @param error_code_length length in bytes of error_code
59 @param subsys Subsystem ("InnoDB", "Server", "Repl")
60 @param subsys_length length in bytes of subsys
61 @param message data field (error message/JSON record/...)
62 @param message_length length of data field
63
64 @retval LOG_SERVICE_SUCCESS success
65 @retval LOG_SERVICE_ARGUMENT_TOO_LONG argument too long
66 @retval LOG_SERVICE_INVALID_ARGUMENT invalid argument
67*/
70 const char *error_code, uint error_code_length,
71 const char *subsys, uint subsys_length, const char *message,
72 uint message_length));
73
75
76#endif
enum enum_log_service_error log_service_error
Error codes.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
static my_thread_id thread_id
Definition: my_thr_init.cc:63
constexpr value_type timestamp
Definition: classic_protocol_constants.h:278
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:103
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
Specifies macros to define Service Implementations.
int log_sink_perfschema(void *instance, log_line *ll)
services: log sinks: logging to performance_schema ring-buffer
Definition: log_sink_perfschema.cc:814
unsigned int uint
Definition: uca9-dump.cc:75