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