solarwinds_apm 6.0.0.preV5 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/ext/oboe_metal/extconf.rb +5 -4
  3. data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +1 -1
  4. data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +1 -1
  5. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +1 -1
  6. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +1 -1
  7. data/ext/oboe_metal/src/VERSION +1 -1
  8. data/ext/oboe_metal/src/oboe.h +56 -13
  9. data/ext/oboe_metal/src/oboe_api.cpp +105 -6
  10. data/ext/oboe_metal/src/oboe_api.h +121 -2
  11. data/ext/oboe_metal/src/oboe_debug.h +4 -315
  12. data/ext/oboe_metal/src/oboe_swig_wrap.cc +2987 -549
  13. data/lib/oboe_metal.rb +23 -64
  14. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +1 -1
  15. data/lib/solarwinds_apm/api/current_trace_info.rb +2 -3
  16. data/lib/solarwinds_apm/api/opentelemetry.rb +2 -2
  17. data/lib/solarwinds_apm/api/tracing.rb +1 -1
  18. data/lib/solarwinds_apm/api.rb +1 -1
  19. data/lib/solarwinds_apm/config.rb +56 -17
  20. data/lib/solarwinds_apm/constants.rb +5 -7
  21. data/lib/solarwinds_apm/noop/README.md +1 -1
  22. data/lib/solarwinds_apm/noop/api.rb +83 -0
  23. data/lib/solarwinds_apm/noop/context.rb +13 -2
  24. data/lib/solarwinds_apm/noop/metadata.rb +5 -2
  25. data/lib/solarwinds_apm/{thread_local.rb → noop/span.rb} +14 -20
  26. data/lib/solarwinds_apm/{base.rb → noop.rb} +22 -27
  27. data/lib/solarwinds_apm/oboe_init_options.rb +23 -82
  28. data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +1 -1
  29. data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +2 -2
  30. data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +4 -3
  31. data/lib/solarwinds_apm/opentelemetry.rb +1 -1
  32. data/lib/solarwinds_apm/otel_config.rb +14 -43
  33. data/lib/solarwinds_apm/patch/dummy_patch.rb +12 -0
  34. data/lib/solarwinds_apm/patch.rb +11 -0
  35. data/lib/solarwinds_apm/support/logger_formatter.rb +1 -1
  36. data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +20 -22
  37. data/lib/solarwinds_apm/support/service_key_checker.rb +94 -0
  38. data/lib/solarwinds_apm/{support_report.rb → support/support_report.rb} +11 -8
  39. data/lib/solarwinds_apm/support/swomarginalia/comment.rb +2 -2
  40. data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +1 -1
  41. data/lib/solarwinds_apm/support/transaction_settings.rb +1 -5
  42. data/lib/solarwinds_apm/support.rb +1 -0
  43. data/lib/solarwinds_apm/version.rb +1 -1
  44. data/lib/solarwinds_apm.rb +70 -55
  45. metadata +12 -7
@@ -5,324 +5,13 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
- #include <stdbool.h>
9
- #include <stdio.h>
8
+ typedef void (*OboeDebugLoggerFcn)(void *context, int level, const char *source_name, int source_lineno, const char *msg);
10
9
 
11
- /**
12
- * Defined diagnostic log detail levels.
13
- */
14
- enum OBOE_DEBUG_LOG_LEVEL {
15
- OBOE_DEBUG_DISABLED = -1,
16
- OBOE_DEBUG_FATAL = 0,
17
- OBOE_DEBUG_ERROR = 1,
18
- OBOE_DEBUG_WARNING = 2,
19
- OBOE_DEBUG_INFO = 3,
20
- OBOE_DEBUG_LOW = 4,
21
- OBOE_DEBUG_MEDIUM = 5,
22
- OBOE_DEBUG_HIGH = 6
23
- };
24
-
25
- /**
26
- * Defined modules that do diagnostic logging.
27
- */
28
- enum OBOE_DEBUG_MODULE {
29
- OBOE_MODULE_ALL = -1, /*!< Pseudo module to refer to ALL modules - used for configuring generic settings */
30
- OBOE_MODULE_UNDEF = 0, /*!< Generic (undefined) module */
31
- OBOE_MODULE_LIBOBOE, /*!< The core Oboe library */
32
- OBOE_MODULE_SETTINGS, /*!< The Oboe settings functionality */
33
- OBOE_MODULE_REPORTER_FILE, /*!< File reporter */
34
- OBOE_MODULE_REPORTER_UDP, /*!< UDP (Tracelyzer) reporter */
35
- OBOE_MODULE_REPORTER_SSL, /*!< SSL reporter */
36
- OBOE_MODULE_REPORTER_LAMBDA, /*!< lambda wrapper */
37
- OBOE_MODULE_APACHE, /*!< Apache webserver */
38
- OBOE_MODULE_NGINX, /*!< Nginx webserver */
39
- OBOE_MODULE_PHP, /*!< PHP interpreter */
40
- OBOE_MODULE_DOTNET, /*!< dotnet wrapper */
41
- OBOE_MODULE_RUBY, /*!< ruby c++ extension */
42
- OBOE_MODULE_HOST_ID_SERVICE,
43
- OBOE_MODULE_AWS_RESOURCE_PROVIDER,
44
- OBOE_MODULE_AZURE_RESOURCE_PROVIDER,
45
- OBOE_MODULE_UAMSCLIENT_RESOURCE_PROVIDER
46
- };
47
-
48
- /** Compile time debug logging detail level - cannot log more detailed than this. */
49
- #define OBOE_DEBUG_LEVEL OBOE_DEBUG_HIGH
50
-
51
- /**
52
- * Initial debug log detail level.
53
- *
54
- */
55
- #define LOGLEVEL_DEFAULT OBOE_DEBUG_INFO
56
-
57
- /** Limit for number of messages at specified level before demoting to debug MEDIUM. */
58
- #define MAX_DEBUG_MSG_COUNT 1
59
-
60
- void oboe_debug_log_init(FILE* output);
61
-
62
- /**
63
- * Low-level diagnostics logging function.
64
- *
65
- * This is normally used only by the OBOE_DEBUG_LOG_* function macros and not used directly.
66
- *
67
- * This function may be adapted to format and route diagnostic log messages as desired.
68
- *
69
- * @param module One of the numeric module identifiers defined in debug.h - used to control logging detail by module.
70
- * @param level Diagnostic detail level of this message - used to control logging volume by detail level.
71
- * @param source_name Name of the source file, if available, or another useful name, or NULL.
72
- * @param source_lineno Number of the line in the source file where message is logged from, if available, or zero.
73
- * @param format A C language printf format specification string.
74
- * @param args A variable argument list in VA_ARG format containing arguments for each argument specifier in the format.
75
- */
76
- void oboe_debug_logger(int module, int level, const char *source_name, int source_lineno, const char *format, ...);
77
-
78
-
79
- /**
80
- * Prototype for a logger call-back function.
81
- *
82
- * A logging function of this form can be added to the logger chain using
83
- * oboe_debug_log_add().
84
- *
85
- * @param context The context pointer that was registered in the call to
86
- * oboe_debug_log_add(). Use it to pass the pointer-to-self for
87
- * objects (ie. "this" in C++) or just a structure in C, May be
88
- * NULL.
89
- * @param module The module identifier as passed to oboe_debug_logger().
90
- * @param level The diagnostic detail level as passed to oboe_debug_logger().
91
- * @param source_name Name of the source file as passed to oboe_debug_logger().
92
- * @param source_lineno Number of the line in the source file where message is
93
- * logged from as passed to oboe_debug_logger().
94
- * @param msg The formatted message produced from the format string and its
95
- * arguments as passed to oboe_debug_logger().
96
- */
97
- typedef void (*OboeDebugLoggerFcn)(void *context, int module, int level, const char *source_name, int source_lineno, const char *msg);
98
-
99
- /**
100
- * Get a printable name for a diagnostics logging level.
101
- */
102
- const char *oboe_debug_log_level_name(int level);
103
-
104
- /**
105
- * Get a printable name for a diagnostics logging module identifier.
106
- */
107
- const char *oboe_debug_module_name(int module);
108
-
109
- /**
110
- * Get the maximum logging detail level for a module or for all modules.
111
- *
112
- * This level applies to the stderr logger only. Added loggers get all messages
113
- * below their registed detail level and need to do their own module-specific
114
- * filtering.
115
- *
116
- * @param module One of the OBOE_MODULE_* values. Use OBOE_MODULE_ALL (-1) to
117
- * get the overall maximum detail level.
118
- * @return Maximum detail level value for module (or overall) where zero is the
119
- * lowest and higher values generate more detailed log messages.
120
- */
121
- int oboe_debug_log_level_get(int module);
122
-
123
- /**
124
- * Set the maximum logging detail level for a module or for all modules.
125
- *
126
- * This level applies to the stderr logger only. Added loggers get all messages
127
- * below their registered detail level and need to do their own module-specific
128
- * filtering.
129
- *
130
- * @param module One of the OBOE_MODULE_* values. Use OBOE_MODULE_ALL to set
131
- * the overall maximum detail level.
132
- * @param newLevel Maximum detail level value where zero is the lowest and higher
133
- * values generate more detailed log messages.
134
- */
135
- void oboe_debug_log_level_set(FILE* output, int module, int newLevel);
136
-
137
- /**
138
- * Set the output stream for the default logger.
139
- *
140
- * @param newStream A valid, open FILE* stream or NULL to disable the default logger.
141
- * @return Zero on success; otherwise an error code (normally from errno).
142
- */
143
- int oboe_debug_log_to_stream(FILE *newStream);
144
-
145
- /**
146
- * If we're logging to a stream, flush it.
147
- *
148
- * @return Zero on success; otherwise an error code (normally from errno).
149
- */
150
- int oboe_debug_log_flush();
151
-
152
- /**
153
- * Set the default logger to write to the specified file.
154
- *
155
- * A NULL or empty path name will disable the default logger.
156
- *
157
- * If the file exists then it will be opened in append mode.
158
- *
159
- * @param pathname The path name of the
160
- * @return Zero on success; otherwise an error code (normally from errno).
161
- */
162
- int oboe_debug_log_to_file(const char *pathname);
163
-
164
- /**
165
- * Add a logger that takes messages up to a given logging detail level.
166
- *
167
- * This adds the logger to a chain in order of the logging level. Log messages
168
- * are passed to each logger down the chain until the remaining loggers only
169
- * accept messages of a lower detail level.
170
- *
171
- * @return Zero on success, one if re-registered with the new logging level, and
172
- * otherwise a negative value to indicate an error.
173
- */
174
- int oboe_debug_log_add(OboeDebugLoggerFcn newLogger, void *context, int logLevel);
175
-
176
- /**
177
- * Remove a logger.
178
- *
179
- * Remove the logger from the message handling chain.
180
- *
181
- * @return Zero on success, one if it was not found, and otherwise a negative
182
- * value to indicate an error.
183
- */
184
- int oboe_debug_log_remove(OboeDebugLoggerFcn oldLogger, void *context);
185
-
186
- /*
187
- * Log the application's Oboe configuration.
188
- *
189
- * We use this to get a reasonable standard format between apps.
190
- *
191
- * @param module An OBOE_MODULE_* module identifier. Use zero for undefined.
192
- * @param app_name Either NULL or a pointer to a string containing a name for
193
- * the application - will prefix the log entry. Useful when multiple
194
- * apps log to the same destination.
195
- * @param trace_mode A string identifying the configured tracing mode, one of:
196
- * "enabled", "disabled", "unset", or "undef" (for invalid values)
197
- * Use the oboe_tracing_mode_to_string() function to convert from
198
- * numeric values.
199
- * @param sample_rate The configured sampling rate: -1 for unset or a
200
- * integer fraction of 1000000.
201
- * @param reporter_type String identifying the type of reporter configured:
202
- * One of 'udp' (the default), 'ssl', or 'file'.
203
- * @param reporter_args The string of comma-separated key=value settings
204
- * used to initialize the reporter.
205
- * @param extra: Either NULL or a pointer to a string to be appended to
206
- * the log message and designed to include a few other
207
- * configuration parameters of interest.
208
- */
209
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_INFO
210
- # define OBOE_DEBUG_LOG_CONFIG_EX(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) \
211
- { \
212
- oboe_debug_logger(module, OBOE_DEBUG_INFO, __FILE__, __LINE__, \
213
- "%s Oboe config: tracing=%s, sampling=%d, reporter=('%s', '%s') %s", \
214
- (app_name == NULL ? "" : app_name), \
215
- trace_mode, \
216
- sample_rate, \
217
- (reporter_type == NULL ? "?" : reporter_type), \
218
- (reporter_args == NULL ? "?" : reporter_args), \
219
- (extra == NULL ? "" : extra)); \
220
- }
221
- #else
222
- # define OBOE_DEBUG_LOG_CONFIG_EX(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) {}
223
- #endif
224
-
225
- /**
226
- * Log a fatal error.
227
- */
228
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_FATAL
229
- # define OBOE_DEBUG_LOG_FATAL_EX(module, ...) \
230
- { \
231
- oboe_debug_logger(module, OBOE_DEBUG_FATAL, __FILE__, __LINE__, __VA_ARGS__); \
232
- }
233
- #else
234
- # define OBOE_DEBUG_LOG_FATAL_EX(module, ...) {}
235
- #endif
236
-
237
- /**
238
- * Log a recoverable error.
239
- *
240
- * Each message is limited in the number of times that it will be reported at the
241
- * ERROR level after which it will be logged at the debug MEDIUM level.
242
- */
243
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_ERROR
244
- # define OBOE_DEBUG_LOG_ERROR_EX(module, ...) \
245
- { \
246
- static int usage_counter = 0; \
247
- int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_ERROR : OBOE_DEBUG_MEDIUM); \
248
- oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
249
- }
250
- #else
251
- # define OBOE_DEBUG_LOG_ERROR_EX(module, ...) {}
252
- #endif
253
-
254
- /**
255
- * Log a warning.
256
- *
257
- * Each message is limited in the number of times that it will be reported at the
258
- * WARNING level after which it will be logged at the debug MEDIUM level.
259
- */
260
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_WARNING
261
- # define OBOE_DEBUG_LOG_WARNING_EX(module, ...) \
262
- { \
263
- static int usage_counter = 0; \
264
- int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_WARNING : OBOE_DEBUG_MEDIUM); \
265
- oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
266
- }
267
- #else
268
- # define OBOE_DEBUG_LOG_WARNING_EX(module, ...) {}
269
- #endif
270
-
271
- /**
272
- * Log an informative message.
273
- *
274
- * Each message is limited in the number of times that it will be reported at the
275
- * INFO level after which it will be logged at the debug MEDIUM level.
276
- */
277
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_INFO
278
- # define OBOE_DEBUG_LOG_INFO_EX(module, ...) \
279
- { \
280
- static int usage_counter = 0; \
281
- int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_INFO : OBOE_DEBUG_MEDIUM); \
282
- oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
283
- }
284
- #else
285
- # define OBOE_DEBUG_LOG_INFO_EX(module, ...) {}
286
- #endif
287
-
288
- /**
289
- * Log a low-detail diagnostic message.
290
- */
291
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_LOW
292
- # define OBOE_DEBUG_LOG_LOW_EX(module, ...) \
293
- { \
294
- oboe_debug_logger(module, OBOE_DEBUG_LOW, __FILE__, __LINE__, __VA_ARGS__); \
295
- }
296
- #else
297
- # define OBOE_DEBUG_LOG_LOW_EX(module, ...) {}
298
- #endif
299
-
300
- /**
301
- * Log a medium-detail diagnostic message.
302
- */
303
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_MEDIUM
304
- # define OBOE_DEBUG_LOG_MEDIUM_EX(module, ...) \
305
- { \
306
- oboe_debug_logger(module, OBOE_DEBUG_MEDIUM, __FILE__, __LINE__, __VA_ARGS__); \
307
- }
308
- #else
309
- # define OBOE_DEBUG_LOG_MEDIUM_EX(module, ...) {}
310
- #endif
311
-
312
- /**
313
- * Log a high-detail diagnostic message.
314
- */
315
- #if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_HIGH
316
- # define OBOE_DEBUG_LOG_HIGH_EX(module, ...) \
317
- { \
318
- oboe_debug_logger(module, OBOE_DEBUG_HIGH, __FILE__, __LINE__, __VA_ARGS__); \
319
- }
320
- #else
321
- # define OBOE_DEBUG_LOG_HIGH_EX(module, ...) {}
322
- #endif
10
+ // Add or update a callback function to get log details
11
+ int oboe_debug_log_add(OboeDebugLoggerFcn newLogger, void *context);
323
12
 
324
13
  #ifdef __cplusplus
325
14
  } // extern "C"
326
15
  #endif
327
16
 
328
- #endif // _OBOE_DEBUG_H
17
+ #endif // _OBOE_DEBUG_H