solarwinds_apm 5.0.0 → 5.1.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/workflows/build_and_release_gem.yml +23 -27
  4. data/.github/workflows/build_for_packagecloud.yml +7 -18
  5. data/.github/workflows/docker-images.yml +23 -17
  6. data/.github/workflows/run_cpluplus_tests.yml +1 -1
  7. data/.github/workflows/run_tests.yml +5 -6
  8. data/.github/workflows/scripts/test_install.rb +14 -9
  9. data/.github/workflows/test_on_4_linux.yml +3 -3
  10. data/.gitignore +5 -1
  11. data/.whitesource +22 -0
  12. data/CHANGELOG-appoptics.md +766 -0
  13. data/CHANGELOG.md +9 -753
  14. data/Gemfile +1 -0
  15. data/README.md +3 -3
  16. data/ext/oboe_metal/extconf.rb +5 -5
  17. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -1
  18. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -1
  19. data/ext/oboe_metal/src/README.md +1 -1
  20. data/ext/oboe_metal/src/VERSION +1 -1
  21. data/ext/oboe_metal/src/frames.h +1 -1
  22. data/ext/oboe_metal/src/init_solarwinds_apm.cc +4 -1
  23. data/ext/oboe_metal/src/logging.h +1 -1
  24. data/ext/oboe_metal/src/oboe.h +29 -45
  25. data/ext/oboe_metal/src/oboe_api.cpp +75 -26
  26. data/ext/oboe_metal/src/{oboe_api.hpp → oboe_api.h} +38 -7
  27. data/ext/oboe_metal/src/oboe_swig_wrap.cc +674 -84
  28. data/ext/oboe_metal/src/profiling.cc +1 -1
  29. data/ext/oboe_metal/src/profiling.h +1 -1
  30. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +1 -21
  31. data/lib/solarwinds_apm/config.rb +9 -0
  32. data/lib/solarwinds_apm/inst/rack.rb +7 -1
  33. data/lib/solarwinds_apm/oboe_init_options.rb +12 -1
  34. data/lib/solarwinds_apm/support/profiling.rb +3 -0
  35. data/lib/solarwinds_apm/support.rb +1 -0
  36. data/lib/solarwinds_apm/version.rb +3 -4
  37. data/lib/solarwinds_apm.rb +1 -1
  38. data/solarwinds_apm.gemspec +6 -6
  39. metadata +13 -9
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ group :development, :test do
9
9
  gem 'byebug', '>= 8.0.0'
10
10
  gem 'irb', '>= 1.0.0' # if RUBY_VERSION >= '2.6.0'
11
11
  gem 'memory_profiler'
12
+ gem 'package_cloud'
12
13
  end
13
14
 
14
15
  gemspec
data/README.md CHANGED
@@ -362,9 +362,9 @@ manually build this C extension for the gem to function.
362
362
  To make this simpler, we've included a few rake tasks to automate this process:
363
363
 
364
364
  ```bash
365
- rake clean # make sure no old stuff is around
366
- rake fetch_ext_deps # download c-files
367
- rake compile # Build the gem's c extension
365
+ rake clean # make sure no old stuff is around
366
+ rake fetch_oboe_file_from_staging # download c-files from staging
367
+ rake compile # Build the gem's c extension
368
368
  ```
369
369
 
370
370
  To see the code related to the C extension, take a look at `ext/oboe_metal/extconf.rb` for details.
@@ -25,13 +25,13 @@ ext_dir = File.expand_path(File.dirname(__FILE__))
25
25
  ao_lib_dir = File.join(ext_dir, 'lib')
26
26
  ao_include = File.join(ext_dir, 'src')
27
27
 
28
- # Download the appropriate liboboe from S3(via rake for testing) or files.appoptics.com (production)
28
+ # Download the appropriate liboboe from Staging or Production
29
29
  version = File.read(File.join(ao_include, 'VERSION')).strip
30
- if ENV['OBOE_FROM_S3'].to_s.downcase == 'true'
31
- ao_path = File.join('https://rc-files-t2.s3-us-west-2.amazonaws.com/c-lib/', version)
32
- puts 'Fetching c-lib from S3'
30
+ if ENV['OBOE_STAGING'].to_s.downcase == 'true'
31
+ ao_path = File.join('https://agent-binaries.global.st-ssp.solarwinds.com/apm/c-lib/', version)
32
+ puts 'Fetching c-lib from STAGING'
33
33
  else
34
- ao_path = File.join('https://files.appoptics.com/c-lib', version)
34
+ ao_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
35
35
  end
36
36
 
37
37
  ao_arch = 'x86_64'
@@ -1 +1 @@
1
- 32deed8447ef3b97ed92efe062c2c2c609458978ce8760b29e343cc60c3f93e6
1
+ e1a52a84efc7019c06af710313235a7063f2f73e00ae66e3a4cae9e86f6f03cb
@@ -1 +1 @@
1
- 34b3413d417ff9c6c9b19b77cf335294a8cd04132d224651aba2706bdd6dff2f
1
+ 662fccb7d38fbc159cdd31a9fc1b7066e6c9c799dda524b1db5508cdab20274b
@@ -1,5 +1,5 @@
1
1
 
2
- oboe_api.hpp and oboe_api.cpp are copied here from the oboe repo during install
2
+ oboe_api.h and oboe_api.cpp are copied here from the oboe repo during install
3
3
 
4
4
  it is best to edit these file in the oboe codebase and use the OBOE_WIP=true env
5
5
  var to include the local development version while the changes aren't deployed to s3.
@@ -1,2 +1,2 @@
1
- 10.3.3
1
+ 10.6.1
2
2
 
@@ -13,7 +13,7 @@
13
13
  #include <ruby/debug.h>
14
14
 
15
15
  #include "profiling.h"
16
- #include "oboe_api.hpp"
16
+ #include "oboe_api.h"
17
17
 
18
18
  using namespace std;
19
19
 
@@ -13,7 +13,10 @@ void Init_profiling(void);
13
13
 
14
14
  void Init_libsolarwinds_apm() {
15
15
  Init_oboe_metal();
16
- Init_profiling();
16
+
17
+ // * create SolarWindsAPM::CProfiler module for enabling SolarWindsAPM::Profiling
18
+ // * see lib/solarwinds_apm/support.rb
19
+ // Init_profiling();
17
20
  }
18
21
 
19
22
  #ifdef __cplusplus
@@ -4,7 +4,7 @@
4
4
  #ifndef LOGGING_H
5
5
  #define LOGGING_H
6
6
 
7
- #include "oboe_api.hpp"
7
+ #include "oboe_api.h"
8
8
 
9
9
  using namespace std;
10
10
 
@@ -94,9 +94,6 @@ extern "C" {
94
94
  #define OBOE_MAX_OP_ID_LEN 8
95
95
  #define OBOE_MAX_METADATA_PACK_LEN 512
96
96
 
97
- #define OBOE_METAFORMAT_XTRACE 0
98
- #define OBOE_METAFORMAT_TRACEPARENT 1
99
-
100
97
  #define TRACEPARENT_CURRENT_VERSION 0
101
98
 
102
99
  #define XTR_CURRENT_VERSION 2
@@ -132,6 +129,10 @@ extern "C" {
132
129
  #endif
133
130
  #endif
134
131
 
132
+ #if !defined(PID_T_DEF)
133
+ #define PID_T_DEF
134
+ typedef int pid_t;
135
+ #endif //PID_T_DEF
135
136
 
136
137
  // structs
137
138
 
@@ -141,7 +142,6 @@ typedef struct oboe_ids {
141
142
  } oboe_ids_t;
142
143
 
143
144
  typedef struct oboe_metadata {
144
- uint8_t type;
145
145
  uint8_t version;
146
146
  oboe_ids_t ids;
147
147
  size_t task_len;
@@ -169,7 +169,7 @@ typedef struct oboe_metric_tag {
169
169
  } oboe_metric_tag_t;
170
170
 
171
171
  typedef struct oboe_init_options {
172
- int version; // the version of this structure (currently on version 12 and 13 (adds w3c mode))
172
+ int version; // the version of this structure (currently on version 14)
173
173
  const char *hostname_alias; // optional hostname alias
174
174
  int log_level; // level at which log messages will be written to log file (0-6)
175
175
  // use LOGLEVEL_DEFAULT for default log level
@@ -195,7 +195,8 @@ typedef struct oboe_init_options {
195
195
  int stdout_clear_nonblocking; // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
196
196
  // only used in lambda reporter (off=0, on=1, default off)
197
197
  int is_grpc_clean_hack_enabled; // flag indicating if custom grpc clean hack enabled (default 0)
198
- int mode; // flag indicating Solarwinds backend (0 = AppOptics; 1 = Nighthawk, default = 0)
198
+ int mode; // depreciated; value is ignored
199
+ int metric_format; // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
199
200
  } oboe_init_options_t;
200
201
 
201
202
  typedef struct oboe_span_params {
@@ -301,7 +302,6 @@ int oboe_event_init (oboe_event_t *, const oboe_metadata_t *, const uint8_t*
301
302
  int oboe_event_destroy (oboe_event_t *);
302
303
 
303
304
  int oboe_event_add_info (oboe_event_t *, const char *, const char *);
304
- int oboe_event_add_info_binary (oboe_event_t *, const char *, const char *, size_t);
305
305
  int oboe_event_add_info_int64 (oboe_event_t *, const char *, const int64_t);
306
306
  int oboe_event_add_info_double (oboe_event_t *, const char *, const double);
307
307
  int oboe_event_add_info_bool (oboe_event_t *, const char *, const int);
@@ -310,6 +310,7 @@ int oboe_event_add_edge (oboe_event_t *, const oboe_metadata_t *);
310
310
  int oboe_event_add_edge_fromstr(oboe_event_t *, const char *, size_t);
311
311
 
312
312
  int oboe_event_add_timestamp(oboe_event_t *evt);
313
+ int oboe_event_add_tid(oboe_event_t* evt);
313
314
  int oboe_event_add_hostname(oboe_event_t *evt);
314
315
 
315
316
  /**
@@ -322,6 +323,15 @@ int oboe_event_add_hostname(oboe_event_t *evt);
322
323
  */
323
324
  int oboe_event_send(int channel, oboe_event_t *evt, oboe_metadata_t *md);
324
325
 
326
+ /**
327
+ * Send event message using the default reporter. (Only for python otel exporter)
328
+ * This function won't add Timestamp_u by default
329
+ * @param channel the channel to send out this message (OBOE_SEND_EVENT or OBOE_SEND_STATUS)
330
+ * @param evt The event message.
331
+ * @param md The X-Trace metadata.
332
+ * @return Length of message sent in bytes on success; otherwise -1.
333
+ */
334
+ int oboe_event_send_without_timestamp(int channel, oboe_event_t *evt, oboe_metadata_t *md);
325
335
 
326
336
  // oboe_context
327
337
 
@@ -390,7 +400,6 @@ int oboe_reporter_destroy(oboe_reporter_t *rep); /* DEPRECATE: Use oboe_shutd
390
400
 
391
401
  ssize_t oboe_reporter_udp_send(void *desc, const char *data, size_t len); /* DEPRECATE - Use oboe_event_send() */
392
402
 
393
-
394
403
  /* Oboe initialization and reporter management */
395
404
 
396
405
  /**
@@ -451,6 +460,14 @@ int oboe_reporter_flush();
451
460
  */
452
461
  const char* oboe_get_reporter_type();
453
462
 
463
+ /**
464
+ * Get reporter default_endpoint
465
+ * It returns static information from each reporter class and doesn't require oboe_init before calling it
466
+ * @param reporter_type const char* e.g. SSL, UDP, FILE, ...
467
+ * @param default_endpoint const char* <empty> means no default endpoint
468
+ */
469
+ const char* oboe_get_reporter_default_endpoint(const char* reporter_type);
470
+
454
471
  /**
455
472
  * Check if system is AWS Lambda
456
473
  */
@@ -511,7 +528,6 @@ void oboe_shutdown();
511
528
 
512
529
  // Value for "SampleSource" info key
513
530
  // where was the sample rate specified? (oboe settings, config file, hard-coded default, etc)
514
- #define OBOE_SAMPLE_RATE_SOURCE_CONTINUED -1
515
531
  #define OBOE_SAMPLE_RATE_SOURCE_FILE 1
516
532
  #define OBOE_SAMPLE_RATE_SOURCE_DEFAULT 2
517
533
  #define OBOE_SAMPLE_RATE_SOURCE_OBOE 3
@@ -527,6 +543,8 @@ void oboe_shutdown();
527
543
  #define OBOE_TRACE_ALWAYS 1 // deprecated: do not use, only here for backward compatibility
528
544
  #define OBOE_TRACE_DISABLED 0
529
545
  #define OBOE_TRACE_ENABLED 1
546
+ #define OBOE_TRIGGER_DISABLED 0
547
+ #define OBOE_TRIGGER_ENABLED 1
530
548
 
531
549
  #define OBOE_SEND_EVENT 0
532
550
  #define OBOE_SEND_STATUS 1
@@ -604,36 +622,6 @@ const char* oboe_get_tracing_decisions_auth_message (int code);
604
622
  #define OBOE_INIT_SSL_LOAD_CERT 9
605
623
  #define OBOE_INIT_SSL_REPORTER_CREATE 10
606
624
  #define OBOE_INIT_SSL_MISSING_KEY 11
607
- #define OBOE_INIT_INVALID_BACKEND 12
608
-
609
- //
610
- // these codes are returned by oboe_notifier_status()
611
- //
612
- #define OBOE_NOTIFIER_SHUTTING_DOWN -3
613
- #define OBOE_NOTIFIER_INITIALIZING -2
614
- #define OBOE_NOTIFIER_DISABLED -1
615
- #define OBOE_NOTIFIER_OK 0
616
- #define OBOE_NOTIFIER_SOCKET_PATH_TOO_LONG 1
617
- #define OBOE_NOTIFIER_SOCKET_CREATE 2
618
- #define OBOE_NOTIFIER_SOCKET_CONNECT 3
619
- #define OBOE_NOTIFIER_SOCKET_WRITE_FULL 4
620
- #define OBOE_NOTIFIER_SOCKET_WRITE_ERROR 5
621
- #define OBOE_NOTIFIER_SHUTDOWN_TIMED_OUT 6
622
-
623
- //
624
- // these codes are used for testing the notifier using oboe_notifier_test()
625
- //
626
- #define OBOE_NOTIFIER_TEST_KEEPALIVE 0
627
- #define OBOE_NOTIFIER_TEST_LOG 1
628
- #define OBOE_NOTIFIER_TEST_REMOTE_WARNING 2
629
- #define OBOE_NOTIFIER_TEST_REMOTE_CONFIG 3
630
-
631
- //
632
- // interval (in seconds) at which the notifier sends a keep-alive msg,
633
- // note that a keep-alive is only sent if no other message made it through
634
- // within the interval time
635
- //
636
- #define OBOE_NOTIFIER_KEEP_ALIVE_INTERVAL_SEC 10
637
625
 
638
626
  //
639
627
  // these codes are returned by oboe_custom_metric_summary() and oboe_custom_metric_increment()
@@ -1155,12 +1143,8 @@ int oboe_regex_match(const char* string, void* expression);
1155
1143
  /* oboe internal stats for agents to consume */
1156
1144
  oboe_internal_stats_t* oboe_get_internal_stats();
1157
1145
 
1158
- /* notifier related functions */
1159
- int oboe_notifier_init(const char *socket_path);
1160
- int oboe_notifier_stop(int blocking);
1161
- int oboe_notifier_status();
1162
- int oboe_notifier_test(int test_case, const char *test_str);
1163
-
1146
+ // Random
1147
+ void oboe_random_bytes(uint8_t bytes[], size_t sz);
1164
1148
 
1165
1149
  #ifdef __cplusplus
1166
1150
  } // extern "C"
@@ -6,7 +6,7 @@
6
6
  * This API should follow https://github.com/tracelytics/tracelons/wiki/Instrumentation-API
7
7
  **/
8
8
 
9
- #include "oboe_api.hpp"
9
+ #include "oboe_api.h"
10
10
 
11
11
  /////// Metatdata ///////
12
12
 
@@ -77,6 +77,10 @@ void Context::setTracingMode(int newMode) {
77
77
  oboe_settings_mode_set(newMode);
78
78
  }
79
79
 
80
+ void Context::setTriggerMode(int newMode) {
81
+ oboe_settings_trigger_set(newMode);
82
+ }
83
+
80
84
  void Context::setDefaultSampleRate(int newRate) {
81
85
  oboe_settings_rate_set(newRate);
82
86
  }
@@ -243,6 +247,39 @@ Event *Context::startTrace() {
243
247
  return new Event();
244
248
  }
245
249
 
250
+ Event* Context::createEntry(const oboe_metadata_t *md, int64_t timestamp, const oboe_metadata_t *parent_md) {
251
+ /**
252
+ * As liboboe assumed to manage metadata, liboboe needs to make sure all events are from the same trace.
253
+ * While Otel doesn't require liboboe to manage metadata,
254
+ * we need to set the thread local metadata the same task id as input parameter md but a different op_id.
255
+ */
256
+ auto thread_local_md = Context::get();
257
+ oboe_metadata_copy(thread_local_md, md);
258
+ // reset op_id to zeros
259
+ memset(thread_local_md->ids.op_id, 0, OBOE_MAX_OP_ID_LEN);
260
+
261
+ auto event = new Event();
262
+ oboe_event_init(event, md, md->ids.op_id);
263
+ oboe_event_add_info(event, "Label", "entry");
264
+ oboe_event_add_info_int64(event, "Timestamp_u", timestamp);
265
+ if (parent_md) {
266
+ oboe_event_add_edge(event, parent_md);
267
+ }
268
+ return event;
269
+ }
270
+
271
+ Event* Context::createEvent(int64_t timestamp) {
272
+ auto event = new Event(Context::get());
273
+ oboe_event_add_info_int64(event, "Timestamp_u", timestamp);
274
+ return event;
275
+ }
276
+
277
+ Event* Context::createExit(int64_t timestamp) {
278
+ auto event = createEvent(timestamp);
279
+ oboe_event_add_info(event, "Label", "exit");
280
+ return event;
281
+ }
282
+
246
283
  /////// Event ///////
247
284
 
248
285
  Event::Event() {
@@ -277,11 +314,7 @@ bool Event::addInfo(char *key, void *val) {
277
314
  }
278
315
 
279
316
  bool Event::addInfo(char *key, const std::string &val) {
280
- if (memchr(val.data(), '\0', val.size())) {
281
- return oboe_event_add_info_binary(this, key, val.data(), val.size()) == 0;
282
- } else {
283
- return oboe_event_add_info(this, key, val.data()) == 0;
284
- }
317
+ return oboe_event_add_info(this, key, val.data()) == 0;
285
318
  }
286
319
 
287
320
  bool Event::addInfo(char *key, long val) {
@@ -391,14 +424,8 @@ Metadata *Event::getMetadata() {
391
424
  std::string Event::opIdString() {
392
425
  char buf[OBOE_MAX_METADATA_PACK_LEN]; // Flawfinder: ignore
393
426
  oboe_metadata_tostr(&this->metadata, buf, OBOE_MAX_METADATA_PACK_LEN);
394
-
395
- if ((&this->metadata)->type == OBOE_METAFORMAT_TRACEPARENT) {
396
- buf[52] = '\0';
397
- return std::string(&buf[36]);
398
- } else {
399
- buf[58] = '\0';
400
- return std::string(&buf[42]);
401
- }
427
+ buf[52] = '\0';
428
+ return std::string(&buf[36]);
402
429
  }
403
430
 
404
431
  std::string Event::metadataString() {
@@ -419,8 +446,12 @@ std::string Event::metadataString() {
419
446
  *
420
447
  * @return True on success; otherwise an error message is logged.
421
448
  */
422
- bool Event::send() {
423
- return (oboe_event_send(OBOE_SEND_EVENT, this, Context::get()) >= 0);
449
+ bool Event::send(bool with_system_timestamp) {
450
+ if (with_system_timestamp) {
451
+ return (oboe_event_send(OBOE_SEND_EVENT, this, Context::get()) >= 0);
452
+ } else {
453
+ return (oboe_event_send_without_timestamp(OBOE_SEND_EVENT, this, Context::get()) >= 0);
454
+ }
424
455
  }
425
456
 
426
457
  /**
@@ -574,11 +605,12 @@ Reporter::Reporter(
574
605
  int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
575
606
  // only used in lambda reporter (off=0, on=1, default off)
576
607
  int is_grpc_clean_hack_enabled, // flag indicating if custom grpc clean hack enabled (default 0)
577
- int w3c_trace_format // tag indicating trace id format (0 - legacy Xtrace, 1 - w3c)
608
+ int w3c_trace_format, // tag indicating trace id format (0 - legacy Xtrace, 1 - w3c)
609
+ int metric_format // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
578
610
  ) {
579
611
  oboe_init_options_t options;
580
612
  memset(&options, 0, sizeof(options));
581
- options.version = 13;
613
+ options.version = 14;
582
614
  oboe_init_options_set_defaults(&options);
583
615
 
584
616
  if (hostname_alias != "") {
@@ -615,6 +647,7 @@ Reporter::Reporter(
615
647
  options.stdout_clear_nonblocking = stdout_clear_nonblocking;
616
648
  options.is_grpc_clean_hack_enabled = is_grpc_clean_hack_enabled;
617
649
  options.mode = w3c_trace_format;
650
+ options.metric_format = metric_format;
618
651
  init_status = oboe_init(&options);
619
652
  }
620
653
 
@@ -622,20 +655,36 @@ Reporter::~Reporter() {
622
655
  oboe_reporter_destroy(this);
623
656
  }
624
657
 
625
- bool Reporter::sendReport(Event *evt) {
626
- return oboe_event_send(OBOE_SEND_EVENT, evt, Context::get()) >= 0;
658
+ bool Reporter::sendReport(Event *evt, bool with_system_timestamp) {
659
+ if (with_system_timestamp) {
660
+ return oboe_event_send(OBOE_SEND_EVENT, evt, Context::get()) >= 0;
661
+ } else {
662
+ return oboe_event_send_without_timestamp(OBOE_SEND_EVENT, evt, Context::get()) >= 0;
663
+ }
627
664
  }
628
665
 
629
- bool Reporter::sendReport(Event *evt, oboe_metadata_t *md) {
630
- return oboe_event_send(OBOE_SEND_EVENT, evt, md) >= 0;
666
+ bool Reporter::sendReport(Event *evt, oboe_metadata_t *md, bool with_system_timestamp) {
667
+ if (with_system_timestamp) {
668
+ return oboe_event_send(OBOE_SEND_EVENT, evt, md) >= 0;
669
+ } else {
670
+ return oboe_event_send_without_timestamp(OBOE_SEND_EVENT, evt, md) >= 0;
671
+ }
631
672
  }
632
673
 
633
- bool Reporter::sendStatus(Event *evt) {
634
- return oboe_event_send(OBOE_SEND_STATUS, evt, Context::get()) >= 0;
674
+ bool Reporter::sendStatus(Event *evt, bool with_system_timestamp) {
675
+ if (with_system_timestamp) {
676
+ return oboe_event_send(OBOE_SEND_STATUS, evt, Context::get()) >= 0;
677
+ } else {
678
+ return oboe_event_send_without_timestamp(OBOE_SEND_STATUS, evt, Context::get()) >= 0;
679
+ }
635
680
  }
636
681
 
637
- bool Reporter::sendStatus(Event *evt, oboe_metadata_t *md) {
638
- return oboe_event_send(OBOE_SEND_STATUS, evt, md) >= 0;
682
+ bool Reporter::sendStatus(Event *evt, oboe_metadata_t *md, bool with_system_timestamp) {
683
+ if (with_system_timestamp) {
684
+ return oboe_event_send(OBOE_SEND_STATUS, evt, md) >= 0;
685
+ } else {
686
+ return oboe_event_send_without_timestamp(OBOE_SEND_STATUS, evt, md) >= 0;
687
+ }
639
688
  }
640
689
 
641
690
  void Reporter::flush() {
@@ -92,6 +92,15 @@ class Context {
92
92
  */
93
93
  static void setTracingMode(int newMode);
94
94
 
95
+ /**
96
+ * Set the trigger tracing mode.
97
+ *
98
+ * @param newMode One of
99
+ * - OBOE_TRIGGER_DISABLED(0) to disable tracing, or
100
+ * - OBOE_TRIGGER_ENABLED(1) to start a new trace if needed
101
+ */
102
+ static void setTriggerMode(int newMode);
103
+
95
104
  /**
96
105
  * Set the default sample rate.
97
106
  *
@@ -234,6 +243,27 @@ class Context {
234
243
  */
235
244
  static Event *createEvent();
236
245
  static Event *startTrace();
246
+
247
+ /**
248
+ * Create entry event with user-defined metadata and timestamp
249
+ * @param md const oboe_metadata_t *
250
+ * @param timestamp int64_t
251
+ * @param parent_md const oboe_metadata_t *
252
+ * @return Event*
253
+ */
254
+ static Event* createEntry(const oboe_metadata_t *md, int64_t timestamp, const oboe_metadata_t *parent_md = nullptr);
255
+ /**
256
+ * Create an continuous event with user-defined timestamp
257
+ * @param timestamp int64_t
258
+ * @return Event*
259
+ */
260
+ static Event* createEvent(int64_t timestamp);
261
+ /**
262
+ * Create exit event with user-defined timestamp
263
+ * @param timestamp int64_t
264
+ * @return Event*
265
+ */
266
+ static Event* createExit(int64_t timestamp);
237
267
  };
238
268
 
239
269
  class Event : private oboe_event_t {
@@ -278,10 +308,10 @@ class Event : private oboe_event_t {
278
308
  * Report this event.
279
309
  *
280
310
  * This sends the event using the default reporter.
281
- *
311
+ * @param with_system_timestamp bool True means system timestamp 'Timestamp_u' will be added to event
282
312
  * @return True on success; otherwise an error message is logged.
283
313
  */
284
- bool send();
314
+ bool send(bool with_system_timestamp = true);
285
315
 
286
316
  /**
287
317
  * Report a profiling event
@@ -395,15 +425,16 @@ class Reporter : private oboe_reporter_t {
395
425
  int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
396
426
  // only used in lambda reporter (off=0, on=1, default off)
397
427
  int is_grpc_clean_hack_enabled, // flag indicating if custom grpc clean hack enabled (default 0)
398
- int w3c_trace_format // tag indicating trace id format (0 - legacy Xtrace, 1 - w3c)
428
+ int w3c_trace_format, // depreciated; value is ignored
429
+ int metric_format // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
399
430
  );
400
431
 
401
432
  ~Reporter();
402
433
 
403
- bool sendReport(Event *evt);
404
- bool sendReport(Event *evt, oboe_metadata_t *md);
405
- bool sendStatus(Event *evt);
406
- bool sendStatus(Event *evt, oboe_metadata_t *md);
434
+ bool sendReport(Event *evt, bool with_system_timestamp = true);
435
+ bool sendReport(Event *evt, oboe_metadata_t *md, bool with_system_timestamp = true);
436
+ bool sendStatus(Event *evt, bool with_system_timestamp = true);
437
+ bool sendStatus(Event *evt, oboe_metadata_t *md, bool with_system_timestamp = true);
407
438
  void flush();
408
439
  std::string getType();
409
440
  };