-
Notifications
You must be signed in to change notification settings - Fork 160
/
Copy pathphp_molten.h
123 lines (106 loc) · 5.06 KB
/
php_molten.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
/**
* Copyright 2017 chuan-yun silkCutKs <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PHP_MOLTEN_H
#define PHP_MOLTEN_H
#define PHP_MOLTEN_VERSION "0.1.2beta"
extern zend_module_entry molten_module_entry;
#define phpext_trace_ptr &molten_module_entry
#ifdef PHP_WIN32
# define PHP_MOLTEN_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_MOLTEN_API __attribute__ ((visibility("default")))
#else
# define PHP_MOLTEN_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "molten_chain.h"
#include "molten_intercept.h"
#include "molten_span.h"
#include "molten_shm.h"
#include "molten_util.h"
#include "molten_ctrl.h"
#include "molten_status.h"
#include "molten_report.h"
#include "molten_stack.h"
#include "php7_wrapper.h"
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#endif
PHP_MINIT_FUNCTION(molten);
PHP_MSHUTDOWN_FUNCTION(molten);
PHP_RINIT_FUNCTION(molten);
PHP_RSHUTDOWN_FUNCTION(molten);
PHP_MINFO_FUNCTION(molten);
ZEND_BEGIN_MODULE_GLOBALS(molten)
zend_bool enable;
int level;
long sampling_type; /* sampling type */
long sampling_request; /* sampling by request one minute */
long sampling_rate; /* tracing sampling rate */
char *chain_log_path; /* chain log path */
char *service_name; /* service name */
zend_bool tracing_cli; /* enable cli tracing */
char *span_format; /* the span format */
zend_bool open_report; /* open report switch */
long report_interval; /* call ctrl interval */
long report_limit; /* report limit */
char *notify_uri; /* notify uri */
long sink_type; /* log sink type */
long output_type; /* sink spans output type */
char *sink_http_uri; /* sink http uri */
char *sink_kafka_brokers; /* sink kafka brokers */
char *sink_kafka_topic; /* sink kafka topic */
char *sink_syslog_unix_socket; /* sink syslog unix */
smart_string request_uri; /* request url */
mo_chain_t pct; /* chain module */
mo_interceptor_t pit; /* intercept module */
mo_chain_log_t pcl; /* log module */
mo_span_builder psb; /* span builder */
mo_ctrl_t prt; /* control module */
mo_report_t pre; /* report module */
mo_shm_t msm; /* shm module */
mo_stack span_stack; /* span stack */
char ip[INET_ADDRSTRLEN]; /* device ip */
char host_name[HOST_NAME_MAX]; /* host name */
long execute_begin_time; /* execute begin time */
zend_bool enable_sapi; /* enable_sapi */
zend_bool in_request; /* determine in requeset life time */
ZEND_END_MODULE_GLOBALS(molten)
#ifdef ZEND_ENGINE_3
/* Always refer to the globals in your function as TRACE_G(variable). You are
* encouraged to rename these macros something shorter, see examples in any
* other php module directory. */
#define PTG(v) ZEND_MODULE_GLOBALS_ACCESSOR(molten, v)
#if defined(ZTS) && defined(COMPILE_DL_MOLTEN)
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#else
/* In every utility function you add that needs to use variables in
* php_molten_globals, call TSRMLS_FETCH(); after declaring other variables used
* by that function, or better yet, pass in TSRMLS_CC after the last function
* argument and declare your utility function with TSRMLS_DC after the last
* declared argument. Always refer to the globals in your function as
* TRACE_G(variable). You are encouraged to rename these macros something
* shorter, see examples in any other php module directory. */
#ifdef ZTS
#define PTG(v) TSRMG(molten_globals_id, zend_molten_globals *, v)
#else
#define PTG(v) (molten_globals.v)
#endif
#endif
#endif /* PHP_MOLTEN_H */