MySQL 8.3.0
Source Code Documentation
plugin_client_telemetry.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 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#ifndef PLUGIN_CLIENT_TELEMETRY_INCLUDED
24#define PLUGIN_CLIENT_TELEMETRY_INCLUDED
25
26/**
27 @file include/mysql/plugin_client_telemetry.h
28
29 Declarations for client-side plugins of type MYSQL_CLIENT_TELEMETRY_PLUGIN.
30*/
31
32#include <mysql/client_plugin.h>
33
35struct MYSQL;
36
37struct telemetry_span_t;
38
39/**
40 Start an OpenTelemetry trace span.
41 @param [in] name span name
42*/
43typedef telemetry_span_t *(*telemetry_start_span_t)(const char *name);
44
45/**
46 Abstract text map carrier set interface.
47 This is used for propagation, to set a key / value pair inside
48 an arbitrary carrier.
49 @param carrier_data Opaque carrier data to set
50 @param key Key to set
51 @param key_length Length of key
52 @param value Value to set
53 @param value_length Length of value
54*/
55typedef void (*telemetry_text_map_carrier_set_t)(void *carrier_data,
56 const char *key,
57 size_t key_length,
58 const char *value,
59 size_t value_length);
60
61/**
62 Inject an OpenTelemetry trace context into an arbitrary text map carrier.
63 @param [in] span The trace span to inject
64 @param [in] carrier_data text map carrier to set
65 @param [in] carrier Function to use to set the data in the carrier
66*/
67typedef void (*telemetry_injector_t)(telemetry_span_t *span, void *carrier_data,
69
70/**
71 End an OpenTelemetry trace span.
72 @param [in] span Span to end
73*/
74typedef void (*telemetry_end_span_t)(telemetry_span_t *span);
75
81};
82
83/**
84 The global telemetry_plugin pointer.
85*/
87
88#endif /* PLUGIN_CLIENT_TELEMETRY_INCLUDED */
MySQL Client Plugin API.
#define MYSQL_CLIENT_PLUGIN_HEADER
Definition: client_plugin.h:99
span(Container &) -> span< typename Container::value_type >
telemetry_span_t *(* telemetry_start_span_t)(const char *name)
Start an OpenTelemetry trace span.
Definition: plugin_client_telemetry.h:43
void(* telemetry_injector_t)(telemetry_span_t *span, void *carrier_data, telemetry_text_map_carrier_set_t carrier)
Inject an OpenTelemetry trace context into an arbitrary text map carrier.
Definition: plugin_client_telemetry.h:67
void(* telemetry_text_map_carrier_set_t)(void *carrier_data, const char *key, size_t key_length, const char *value, size_t value_length)
Abstract text map carrier set interface.
Definition: plugin_client_telemetry.h:55
struct st_mysql_client_plugin_TELEMETRY * client_telemetry_plugin
The global telemetry_plugin pointer.
Definition: client_plugin.cc:77
void(* telemetry_end_span_t)(telemetry_span_t *span)
End an OpenTelemetry trace span.
Definition: plugin_client_telemetry.h:74
required string key
Definition: replication_asynchronous_connection_failover.proto:59
case opt name
Definition: sslopt-case.h:32
Definition: mysql.h:297
Definition: plugin_client_telemetry.h:76
telemetry_injector_t injector
Definition: plugin_client_telemetry.h:79
telemetry_end_span_t end_span
Definition: plugin_client_telemetry.h:80
MYSQL_CLIENT_PLUGIN_HEADER telemetry_start_span_t start_span
Definition: plugin_client_telemetry.h:78