forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datadog_agent.h
159 lines (136 loc) · 6.68 KB
/
datadog_agent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog
// (https://www.datadoghq.com/).
// Copyright 2019-present Datadog, Inc.
#ifndef DATADOG_AGENT_RTLOADER_DATADOG_AGENT_H
#define DATADOG_AGENT_RTLOADER_DATADOG_AGENT_H
/*! \file datadog_agent.h
\brief RtLoader datadog_agent builtin header file.
The prototypes here defined provide functions to initialize the python datadog_agent
builtin module, and set its relevant callbacks for the rtloader caller.
*/
/*! \fn PyMODINIT_FUNC PyInit_datadog_agent(void)
\brief Initializes the datadog_agent builtin python module.
The datadog_agent python builtin is created and registered here as per the module_def
PyMethodDef definition in `datadog_agent.c` with the corresponding C-implemented python
methods . A fresh reference to the module is created here. This function is
python3 only.
*/
/*! \fn void Py2_init_datadog_agent()
\brief Initializes the datadog_agent builtin python module.
The datadog_agent python builtin is created and registered here as per the module_def
PyMethodDef definition in `datadog_agent.c` with the corresponding C-implemented python
methods . A fresh reference to the module is created here. This function is
python2 only.
*/
/*! \fn void _set_get_version_cb(cb_get_version_t)
\brief Sets a callback to be used by rtloader to collect the agent version.
\param object A function pointer with cb_get_version_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_get_config_cb(cb_get_config_t)
\brief Sets a callback to be used by rtloader to collect the agent configuration.
\param object A function pointer with cb_get_config_t prototype to the
callback function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_headers_cb(cb_headers_t)
\brief Sets a callback to be used by rtloader to collect the typical HTTP headers for
agent requests.
\param object A function pointer with cb_headers_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_get_hostname_cb(cb_get_hostname_t)
\brief Sets a callback to be used by rtloader to collect the canonical hostname from the
agent.
\param object A function pointer with cb_get_hostname_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_get_clustername_cb(cb_get_clustername_t)
\brief Sets a callback to be used by rtloader to collect the K8s clustername from the
agent.
\param object A function pointer with cb_get_clustername_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_log_cb(cb_log_t)
\brief Sets a callback to be used by rtloader to allow using the agent's go-native
logging facilities to log messages.
\param object A function pointer with cb_log_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_set_check_metadata_cb(cb_set_check_metadata_t)
\brief Sets a callback to be used by rtloader to allow setting metadata for a given
check instance.
\param object A function pointer with cb_set_check_metadata_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_set_external_tags_cb(cb_set_external_tags_t)
\brief Sets a callback to be used by rtloader to allow setting external tags for a given
hostname.
\param object A function pointer with cb_set_external_tags_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn PyObject *_public_headers(PyObject *self, PyObject *args, PyObject *kwargs);
\brief Non-static entrypoint to the headers function; providing HTTP headers for agent
requests.
\param self A PyObject* pointer to the `datadog_agent` module.
\param args A PyObject* pointer to the `agentConfig`, but not expected to be used.
\param kwargs A PyObject* pointer to a dictonary. If the `http_host` key is present
it will be added to the headers.
\return a PyObject * pointer to a python dictionary with the expected headers.
The headers python method is duplicated and may be called from the `util` _and_
`datadog_agent` modules. The goal of this wrapper is simply to avoid duplicate code,
allowing us to call the headers function directly.
*/
/*! \fn void _set_write_persistent_cache_cb(cb_write_persistent_cache_t)
\brief Sets a callback to be used by rtloader to allow storing data for a given
check instance.
\param object A function pointer with cb_write_persistent_cache_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
/*! \fn void _set_read_persistent_cache_cb(cb_read_persistent_cache_t)
\brief Sets a callback to be used by rtloader to allow retrieving data for a given
check instance.
\param object A function pointer with cb_read_persistent_cache_t prototype to the callback
function.
The callback is expected to be provided by the rtloader caller - in go-context: CGO.
*/
#include <Python.h>
#include <rtloader_types.h>
#define DATADOG_AGENT_MODULE_NAME "datadog_agent"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DATADOG_AGENT_THREE
PyMODINIT_FUNC PyInit_datadog_agent(void);
#elif defined(DATADOG_AGENT_TWO)
void Py2_init_datadog_agent();
#endif
void _set_get_clustername_cb(cb_get_clustername_t);
void _set_get_config_cb(cb_get_config_t);
void _set_get_hostname_cb(cb_get_hostname_t);
void _set_tracemalloc_enabled_cb(cb_tracemalloc_enabled_t);
void _set_get_version_cb(cb_get_version_t);
void _set_headers_cb(cb_headers_t);
void _set_log_cb(cb_log_t);
void _set_set_check_metadata_cb(cb_set_check_metadata_t);
void _set_set_external_tags_cb(cb_set_external_tags_t);
void _set_write_persistent_cache_cb(cb_write_persistent_cache_t);
void _set_read_persistent_cache_cb(cb_read_persistent_cache_t);
void _set_obfuscate_sql_cb(cb_obfuscate_sql_t);
void _set_obfuscate_sql_exec_plan_cb(cb_obfuscate_sql_exec_plan_t);
void _set_get_process_start_time_cb(cb_get_process_start_time_t);
PyObject *_public_headers(PyObject *self, PyObject *args, PyObject *kwargs);
#ifdef __cplusplus
}
#endif
#endif