MySQL 8.1.0
Source Code Documentation
log_sink_perfschema.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23/**
24 This defines functions to let logging services add error log events
25 to performance_schema.error_log.
26
27 For documentation of the individual functions, see log_sink_perfschema.cc
28*/
29
30#ifndef LOG_SINK_PERFSCHEMA_H
31#define LOG_SINK_PERFSCHEMA_H
32
34
35/**
36 Primitives for logging services to add to performance_schema.error_log.
37*/
39
40/**
41 Add a log-event to the ring buffer.
42
43 We require the various pieces of information to be passed individually
44 rather than accepting a log_sink_pfs_event so we can sanity check each
45 part individually and don't have to worry about different components
46 using different versions/sizes of the struct.
47
48 We copy the data as needed, so caller may free their copy once this
49 call returns.
50
51 @param timestamp Timestamp (in microseconds), or
52 0 to have one generated
53 @param thread_id thread_id of the thread that detected
54 the issue
55 @param prio (INFORMATION|WARNING|ERROR|SYSTEM)_LEVEL
56 @param error_code MY-123456
57 @param error_code_length length in bytes of error_code
58 @param subsys Subsystem ("InnoDB", "Server", "Repl")
59 @param subsys_length length in bytes of subsys
60 @param message data field (error message/JSON record/...)
61 @param message_length length of data field
62
63 @retval LOG_SERVICE_SUCCESS success
64 @retval LOG_SERVICE_ARGUMENT_TOO_LONG argument too long
65 @retval LOG_SERVICE_INVALID_ARGUMENT invalid argument
66*/
69 const char *error_code, uint error_code_length,
70 const char *subsys, uint subsys_length, const char *message,
71 uint message_length));
72
74
75#endif
enum enum_log_service_error log_service_error
Error codes.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
static my_thread_id thread_id
Definition: my_thr_init.cc:62
constexpr value_type timestamp
Definition: classic_protocol_constants.h:277
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:102
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
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:813