ddtrace 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -1
  3. data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time.c +10 -10
  4. data/ext/ddtrace_profiling_native_extension/collectors_stack.c +32 -32
  5. data/ext/ddtrace_profiling_native_extension/collectors_stack.h +2 -2
  6. data/ext/ddtrace_profiling_native_extension/http_transport.c +50 -49
  7. data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +5 -1
  8. data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +34 -12
  9. data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +10 -0
  10. data/ext/ddtrace_profiling_native_extension/stack_recorder.c +32 -32
  11. data/ext/ddtrace_profiling_native_extension/stack_recorder.h +4 -4
  12. data/lib/datadog/appsec/assets/waf_rules/recommended.json +75 -8
  13. data/lib/datadog/appsec/assets/waf_rules/risky.json +1 -1
  14. data/lib/datadog/appsec/assets/waf_rules/strict.json +1 -1
  15. data/lib/datadog/appsec/assets.rb +1 -1
  16. data/lib/datadog/appsec/configuration/settings.rb +35 -22
  17. data/lib/datadog/appsec/configuration.rb +4 -2
  18. data/lib/datadog/appsec/contrib/auto_instrument.rb +1 -1
  19. data/lib/datadog/appsec/contrib/configuration/settings.rb +1 -1
  20. data/lib/datadog/appsec/contrib/integration.rb +1 -1
  21. data/lib/datadog/appsec/contrib/patcher.rb +1 -1
  22. data/lib/datadog/appsec/contrib/rack/configuration/settings.rb +1 -1
  23. data/lib/datadog/appsec/contrib/rack/ext.rb +1 -1
  24. data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +1 -1
  25. data/lib/datadog/appsec/contrib/rack/reactive/request.rb +1 -1
  26. data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +1 -1
  27. data/lib/datadog/appsec/contrib/rack/reactive/response.rb +1 -1
  28. data/lib/datadog/appsec/contrib/rack/request.rb +1 -1
  29. data/lib/datadog/appsec/contrib/rack/response.rb +1 -1
  30. data/lib/datadog/appsec/contrib/rails/configuration/settings.rb +1 -1
  31. data/lib/datadog/appsec/contrib/rails/ext.rb +1 -1
  32. data/lib/datadog/appsec/contrib/rails/framework.rb +1 -1
  33. data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +1 -1
  34. data/lib/datadog/appsec/contrib/rails/reactive/action.rb +1 -1
  35. data/lib/datadog/appsec/contrib/rails/request.rb +1 -1
  36. data/lib/datadog/appsec/contrib/rails/request_middleware.rb +1 -1
  37. data/lib/datadog/appsec/contrib/sinatra/configuration/settings.rb +1 -1
  38. data/lib/datadog/appsec/contrib/sinatra/ext.rb +1 -1
  39. data/lib/datadog/appsec/contrib/sinatra/framework.rb +1 -1
  40. data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +1 -1
  41. data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +1 -1
  42. data/lib/datadog/appsec/contrib/sinatra/request_middleware.rb +1 -1
  43. data/lib/datadog/appsec/event.rb +1 -1
  44. data/lib/datadog/appsec/extensions.rb +36 -26
  45. data/lib/datadog/appsec/instrumentation/gateway.rb +3 -3
  46. data/lib/datadog/appsec/processor.rb +15 -19
  47. data/lib/datadog/appsec/rate_limiter.rb +1 -1
  48. data/lib/datadog/appsec/reactive/address_hash.rb +1 -1
  49. data/lib/datadog/appsec/reactive/engine.rb +1 -1
  50. data/lib/datadog/appsec/reactive/operation.rb +2 -2
  51. data/lib/datadog/appsec/reactive/subscriber.rb +1 -1
  52. data/lib/datadog/appsec/response.rb +18 -9
  53. data/lib/datadog/appsec/utils/http/media_range.rb +201 -0
  54. data/lib/datadog/appsec/utils/http/media_type.rb +87 -0
  55. data/lib/datadog/appsec/utils/http.rb +9 -0
  56. data/lib/datadog/appsec/utils.rb +7 -0
  57. data/lib/datadog/appsec.rb +1 -1
  58. data/lib/datadog/ci/ext/environment.rb +57 -13
  59. data/lib/datadog/core/configuration/agent_settings_resolver.rb +2 -2
  60. data/lib/datadog/core/configuration/base.rb +3 -0
  61. data/lib/datadog/core/configuration/ext.rb +8 -0
  62. data/lib/datadog/core/configuration/option_definition.rb +11 -2
  63. data/lib/datadog/core/configuration/settings.rb +6 -4
  64. data/lib/datadog/core/diagnostics/environment_logger.rb +4 -3
  65. data/lib/datadog/core/metrics/client.rb +3 -2
  66. data/lib/datadog/core/metrics/ext.rb +0 -2
  67. data/lib/datadog/core/telemetry/collector.rb +1 -0
  68. data/lib/datadog/kit/appsec/events.rb +75 -0
  69. data/lib/datadog/kit/enable_core_dumps.rb +1 -0
  70. data/lib/datadog/kit/identity.rb +8 -7
  71. data/lib/datadog/opentelemetry/api/context.rb +187 -0
  72. data/lib/datadog/opentelemetry/api/trace/span.rb +15 -0
  73. data/lib/datadog/opentelemetry/sdk/configurator.rb +38 -0
  74. data/lib/datadog/opentelemetry/sdk/id_generator.rb +27 -0
  75. data/lib/datadog/opentelemetry/sdk/propagator.rb +91 -0
  76. data/lib/datadog/opentelemetry/sdk/span_processor.rb +92 -0
  77. data/lib/datadog/opentelemetry.rb +48 -0
  78. data/lib/datadog/tracing/configuration/ext.rb +1 -2
  79. data/lib/datadog/tracing/contrib/http/configuration/settings.rb +5 -0
  80. data/lib/datadog/tracing/contrib/http/distributed/fetcher.rb +10 -3
  81. data/lib/datadog/tracing/contrib/http/ext.rb +1 -0
  82. data/lib/datadog/tracing/contrib/http/instrumentation.rb +3 -6
  83. data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +5 -0
  84. data/lib/datadog/tracing/contrib/httpclient/ext.rb +1 -0
  85. data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +3 -4
  86. data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +5 -0
  87. data/lib/datadog/tracing/contrib/httprb/ext.rb +1 -0
  88. data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +3 -4
  89. data/lib/datadog/tracing/contrib/pg/instrumentation.rb +44 -31
  90. data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +33 -0
  91. data/lib/datadog/tracing/contrib/stripe/ext.rb +26 -0
  92. data/lib/datadog/tracing/contrib/stripe/integration.rb +43 -0
  93. data/lib/datadog/tracing/contrib/stripe/patcher.rb +29 -0
  94. data/lib/datadog/tracing/contrib/stripe/request.rb +67 -0
  95. data/lib/datadog/tracing/contrib.rb +1 -0
  96. data/lib/datadog/tracing/distributed/trace_context.rb +16 -7
  97. data/lib/datadog/tracing/metadata/tagging.rb +6 -0
  98. data/lib/datadog/tracing/trace_digest.rb +17 -7
  99. data/lib/datadog/tracing/trace_operation.rb +8 -0
  100. data/lib/ddtrace/version.rb +1 -1
  101. metadata +23 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '02285d37473e8fe6c731e55ae7864860a311e2b6d509f56a41f31094cd198f09'
4
- data.tar.gz: 8857a0f43f96fef23309cd7fced88b846d5ad48834b6c87d0f40181cc3bd5dd9
3
+ metadata.gz: 1ba4a81593411a12abfa1665b3910e49e35429b1b266779e93accb0f84a478d2
4
+ data.tar.gz: e72362dc1a1e682a3c52b8af8017fcd12e60d353843cdd129f65a55dbb0c312d
5
5
  SHA512:
6
- metadata.gz: afcde0e01258f5ab997fa6bcfa51c29a82f0e730258056a9efae86130445dbd63471269c047878b1ee554cc4ec956fe6e95a597ce65930e73549b0e32cbec50c
7
- data.tar.gz: 292867c7c22146d0bd3147bb8863dd51fc89200a08efe640f05ae053fb93bdaeb068eefb6c89466b40ebbe749174844aa6b874c5a2b6aae30cb5055c9f2dc3cd
6
+ metadata.gz: a083b23cfadccc78e67a5aa2a3ae067bc868e4721d92d1fb9fcbadc7536332fabd20f6638fb157712e5e909afd3e3e505a2011838a4f0e98dbebaa64a38f7db6
7
+ data.tar.gz: 81b27dbbf685c01ee99ab79a8774aefca4a2feb93363a41e1a3465b01b1b07f571d5bdd75a73880658ae05254a3d742651bdf8df98fd48c040f73bb6a16702d0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.9.0] - 2023-01-30
6
+
7
+ As of ddtrace 1.9.0, CPU Profiling 2.0 is now in opt-in (that is, disabled by default) public beta. For more details, check the release notes.
8
+
9
+ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v1.9.0
10
+
11
+ ### Added
12
+
13
+ * Tracing: Add `Stripe` instrumentation ([#2557][])
14
+ * Tracing: Add configurable response codes considered as errors for `Net/HTTP`, `httprb` and `httpclient` ([#2501][], [#2576][])([@caramcc][])
15
+ * Tracing: Flexible header matching for HTTP propagator ([#2504][])
16
+ * Tracing: `OpenTelemetry` Traces support ([#2496][])
17
+ * Tracing: W3C: Propagate unknown values as-is ([#2485][])
18
+ * Appsec: Add event kit API ([#2512][])
19
+ * Profiling: Allow profiler development on arm64 macOS ([#2573][])
20
+ * Core: Add `profiling_enabled` state to environment logger output ([#2541][])
21
+ * Core: Add 'type' to `OptionDefinition` ([#2493][])
22
+ * Allow `debase-ruby_core_source` 3.2.0 to be used ([#2526][])
23
+
24
+ ### Changed
25
+
26
+ * Profiling: Upgrade to `libdatadog` to `1.0.1.1.0` ([#2530][])
27
+ * Appsec: Update appsec rules `1.4.3` ([#2580][])
28
+ * Ci: Update CI Visibility metadata extraction ([#2586][])
29
+
30
+ ### Fixed
31
+
32
+ * Profiling: Fix wrong `libdatadog` version being picked during profiler build ([#2531][])
33
+ * Tracing: Support `PG` calls with a block ([#2522][])
34
+ * Ci: Fix error in `teamcity` env vars ([#2562][])
35
+
5
36
  ## [1.8.0] - 2022-12-14
6
37
 
7
38
  Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v1.8.0
@@ -2250,7 +2281,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
2250
2281
 
2251
2282
  Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
2252
2283
 
2253
- [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.8.0...master
2284
+ [Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.9.0...master
2285
+ [1.9.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.8.0...v1.9.0
2254
2286
  [1.8.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.7.0...v1.8.0
2255
2287
  [1.7.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.6.1...v1.7.0
2256
2288
  [1.6.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.6.0...v1.6.1
@@ -3210,7 +3242,24 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3210
3242
  [#2469]: https://github.com/DataDog/dd-trace-rb/issues/2469
3211
3243
  [#2470]: https://github.com/DataDog/dd-trace-rb/issues/2470
3212
3244
  [#2473]: https://github.com/DataDog/dd-trace-rb/issues/2473
3245
+ [#2485]: https://github.com/DataDog/dd-trace-rb/issues/2485
3213
3246
  [#2489]: https://github.com/DataDog/dd-trace-rb/issues/2489
3247
+ [#2493]: https://github.com/DataDog/dd-trace-rb/issues/2493
3248
+ [#2496]: https://github.com/DataDog/dd-trace-rb/issues/2496
3249
+ [#2501]: https://github.com/DataDog/dd-trace-rb/issues/2501
3250
+ [#2504]: https://github.com/DataDog/dd-trace-rb/issues/2504
3251
+ [#2512]: https://github.com/DataDog/dd-trace-rb/issues/2512
3252
+ [#2522]: https://github.com/DataDog/dd-trace-rb/issues/2522
3253
+ [#2526]: https://github.com/DataDog/dd-trace-rb/issues/2526
3254
+ [#2530]: https://github.com/DataDog/dd-trace-rb/issues/2530
3255
+ [#2531]: https://github.com/DataDog/dd-trace-rb/issues/2531
3256
+ [#2541]: https://github.com/DataDog/dd-trace-rb/issues/2541
3257
+ [#2557]: https://github.com/DataDog/dd-trace-rb/issues/2557
3258
+ [#2562]: https://github.com/DataDog/dd-trace-rb/issues/2562
3259
+ [#2573]: https://github.com/DataDog/dd-trace-rb/issues/2573
3260
+ [#2576]: https://github.com/DataDog/dd-trace-rb/issues/2576
3261
+ [#2580]: https://github.com/DataDog/dd-trace-rb/issues/2580
3262
+ [#2586]: https://github.com/DataDog/dd-trace-rb/issues/2586
3214
3263
  [@AdrianLC]: https://github.com/AdrianLC
3215
3264
  [@Azure7111]: https://github.com/Azure7111
3216
3265
  [@BabyGroot]: https://github.com/BabyGroot
@@ -3249,6 +3298,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
3249
3298
  [@brafales]: https://github.com/brafales
3250
3299
  [@bzf]: https://github.com/bzf
3251
3300
  [@callumj]: https://github.com/callumj
3301
+ [@caramcc]: https://github.com/caramcc
3252
3302
  [@carlallen]: https://github.com/carlallen
3253
3303
  [@chychkan]: https://github.com/chychkan
3254
3304
  [@cjford]: https://github.com/cjford
@@ -147,7 +147,7 @@ static void trigger_sample_for_thread(
147
147
  struct cpu_and_wall_time_collector_state *state,
148
148
  VALUE thread,
149
149
  struct per_thread_context *thread_context,
150
- ddog_Slice_i64 metric_values_slice,
150
+ ddog_Slice_I64 metric_values_slice,
151
151
  sample_type type
152
152
  );
153
153
  static VALUE _native_thread_list(VALUE self);
@@ -366,7 +366,7 @@ void cpu_and_wall_time_collector_sample(VALUE self_instance, long current_monoto
366
366
  state,
367
367
  thread,
368
368
  thread_context,
369
- (ddog_Slice_i64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
369
+ (ddog_Slice_I64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
370
370
  SAMPLE_REGULAR
371
371
  );
372
372
  }
@@ -520,7 +520,7 @@ VALUE cpu_and_wall_time_collector_sample_after_gc(VALUE self_instance) {
520
520
  state,
521
521
  thread,
522
522
  thread_context,
523
- (ddog_Slice_i64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
523
+ (ddog_Slice_I64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
524
524
  SAMPLE_IN_GC
525
525
  );
526
526
 
@@ -549,24 +549,24 @@ static void trigger_sample_for_thread(
549
549
  struct cpu_and_wall_time_collector_state *state,
550
550
  VALUE thread,
551
551
  struct per_thread_context *thread_context,
552
- ddog_Slice_i64 metric_values_slice,
552
+ ddog_Slice_I64 metric_values_slice,
553
553
  sample_type type
554
554
  ) {
555
555
  int max_label_count =
556
556
  1 + // thread id
557
557
  1 + // thread name
558
558
  2; // local root span id and span id
559
- ddog_Label labels[max_label_count];
559
+ ddog_prof_Label labels[max_label_count];
560
560
  int label_pos = 0;
561
561
 
562
- labels[label_pos++] = (ddog_Label) {
562
+ labels[label_pos++] = (ddog_prof_Label) {
563
563
  .key = DDOG_CHARSLICE_C("thread id"),
564
564
  .str = thread_context->thread_id_char_slice
565
565
  };
566
566
 
567
567
  VALUE thread_name = thread_name_for(thread);
568
568
  if (thread_name != Qnil) {
569
- labels[label_pos++] = (ddog_Label) {
569
+ labels[label_pos++] = (ddog_prof_Label) {
570
570
  .key = DDOG_CHARSLICE_C("thread name"),
571
571
  .str = char_slice_from_ruby_string(thread_name)
572
572
  };
@@ -576,8 +576,8 @@ static void trigger_sample_for_thread(
576
576
  trace_identifiers_for(state, thread, &trace_identifiers_result);
577
577
 
578
578
  if (trace_identifiers_result.valid) {
579
- labels[label_pos++] = (ddog_Label) {.key = DDOG_CHARSLICE_C("local root span id"), .str = trace_identifiers_result.local_root_span_id};
580
- labels[label_pos++] = (ddog_Label) {.key = DDOG_CHARSLICE_C("span id"), .num = trace_identifiers_result.span_id};
579
+ labels[label_pos++] = (ddog_prof_Label) {.key = DDOG_CHARSLICE_C("local root span id"), .str = trace_identifiers_result.local_root_span_id};
580
+ labels[label_pos++] = (ddog_prof_Label) {.key = DDOG_CHARSLICE_C("span id"), .num = trace_identifiers_result.span_id};
581
581
 
582
582
  if (trace_identifiers_result.trace_endpoint != Qnil) {
583
583
  // The endpoint gets recorded in a different way because it is mutable in the tracer and can change during a
@@ -610,7 +610,7 @@ static void trigger_sample_for_thread(
610
610
  state->sampling_buffer,
611
611
  state->recorder_instance,
612
612
  metric_values_slice,
613
- (ddog_Slice_label) {.ptr = labels, .len = label_pos},
613
+ (ddog_prof_Slice_Label) {.ptr = labels, .len = label_pos},
614
614
  type
615
615
  );
616
616
  }
@@ -22,8 +22,8 @@ struct sampling_buffer {
22
22
  VALUE *stack_buffer;
23
23
  int *lines_buffer;
24
24
  bool *is_ruby_frame;
25
- ddog_Location *locations;
26
- ddog_Line *lines;
25
+ ddog_prof_Location *locations;
26
+ ddog_prof_Line *lines;
27
27
  }; // Note: typedef'd in the header to sampling_buffer
28
28
 
29
29
  static VALUE _native_sample(
@@ -39,8 +39,8 @@ static void maybe_add_placeholder_frames_omitted(VALUE thread, sampling_buffer*
39
39
  static void record_placeholder_stack_in_native_code(
40
40
  sampling_buffer* buffer,
41
41
  VALUE recorder_instance,
42
- ddog_Slice_i64 metric_values,
43
- ddog_Slice_label labels,
42
+ ddog_Slice_I64 metric_values,
43
+ ddog_prof_Slice_Label labels,
44
44
  sampling_buffer *record_buffer,
45
45
  int extra_frames_in_record_buffer
46
46
  );
@@ -48,8 +48,8 @@ static void sample_thread_internal(
48
48
  VALUE thread,
49
49
  sampling_buffer* buffer,
50
50
  VALUE recorder_instance,
51
- ddog_Slice_i64 metric_values,
52
- ddog_Slice_label labels,
51
+ ddog_Slice_I64 metric_values,
52
+ ddog_prof_Slice_Label labels,
53
53
  sampling_buffer *record_buffer,
54
54
  int extra_frames_in_record_buffer
55
55
  );
@@ -96,12 +96,12 @@ static VALUE _native_sample(
96
96
  }
97
97
 
98
98
  long labels_count = RARRAY_LEN(labels_array);
99
- ddog_Label labels[labels_count];
99
+ ddog_prof_Label labels[labels_count];
100
100
 
101
101
  for (int i = 0; i < labels_count; i++) {
102
102
  VALUE key_str_pair = rb_ary_entry(labels_array, i);
103
103
 
104
- labels[i] = (ddog_Label) {
104
+ labels[i] = (ddog_prof_Label) {
105
105
  .key = char_slice_from_ruby_string(rb_ary_entry(key_str_pair, 0)),
106
106
  .str = char_slice_from_ruby_string(rb_ary_entry(key_str_pair, 1))
107
107
  };
@@ -116,8 +116,8 @@ static VALUE _native_sample(
116
116
  thread,
117
117
  buffer,
118
118
  recorder_instance,
119
- (ddog_Slice_i64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
120
- (ddog_Slice_label) {.ptr = labels, .len = labels_count},
119
+ (ddog_Slice_I64) {.ptr = metric_values, .len = ENABLED_VALUE_TYPES_COUNT},
120
+ (ddog_prof_Slice_Label) {.ptr = labels, .len = labels_count},
121
121
  RTEST(in_gc) ? SAMPLE_IN_GC : SAMPLE_REGULAR
122
122
  );
123
123
 
@@ -130,8 +130,8 @@ void sample_thread(
130
130
  VALUE thread,
131
131
  sampling_buffer* buffer,
132
132
  VALUE recorder_instance,
133
- ddog_Slice_i64 metric_values,
134
- ddog_Slice_label labels,
133
+ ddog_Slice_I64 metric_values,
134
+ ddog_prof_Slice_Label labels,
135
135
  sample_type type
136
136
  ) {
137
137
  // Samples thread into recorder
@@ -146,8 +146,8 @@ void sample_thread(
146
146
  if (type == SAMPLE_IN_GC) {
147
147
  ddog_CharSlice function_name = DDOG_CHARSLICE_C("");
148
148
  ddog_CharSlice function_filename = DDOG_CHARSLICE_C("Garbage Collection");
149
- buffer->lines[0] = (ddog_Line) {
150
- .function = (ddog_Function) {.name = function_name, .filename = function_filename},
149
+ buffer->lines[0] = (ddog_prof_Line) {
150
+ .function = (ddog_prof_Function) {.name = function_name, .filename = function_filename},
151
151
  .line = 0
152
152
  };
153
153
  // To avoid changing sample_thread_internal, we just prepare a new buffer struct that uses the same underlying storage as the
@@ -192,8 +192,8 @@ static void sample_thread_internal(
192
192
  VALUE thread,
193
193
  sampling_buffer* buffer,
194
194
  VALUE recorder_instance,
195
- ddog_Slice_i64 metric_values,
196
- ddog_Slice_label labels,
195
+ ddog_Slice_I64 metric_values,
196
+ ddog_prof_Slice_Label labels,
197
197
  sampling_buffer *record_buffer,
198
198
  int extra_frames_in_record_buffer
199
199
  ) {
@@ -257,8 +257,8 @@ static void sample_thread_internal(
257
257
  name = NIL_P(name) ? missing_string : name;
258
258
  filename = NIL_P(filename) ? missing_string : filename;
259
259
 
260
- buffer->lines[i] = (ddog_Line) {
261
- .function = (ddog_Function) {
260
+ buffer->lines[i] = (ddog_prof_Line) {
261
+ .function = (ddog_prof_Function) {
262
262
  .name = char_slice_from_ruby_string(name),
263
263
  .filename = char_slice_from_ruby_string(filename)
264
264
  },
@@ -278,8 +278,8 @@ static void sample_thread_internal(
278
278
 
279
279
  record_sample(
280
280
  recorder_instance,
281
- (ddog_Sample) {
282
- .locations = (ddog_Slice_location) {.ptr = record_buffer->locations, .len = captured_frames + extra_frames_in_record_buffer},
281
+ (ddog_prof_Sample) {
282
+ .locations = (ddog_prof_Slice_Location) {.ptr = record_buffer->locations, .len = captured_frames + extra_frames_in_record_buffer},
283
283
  .values = metric_values,
284
284
  .labels = labels,
285
285
  }
@@ -301,8 +301,8 @@ static void maybe_add_placeholder_frames_omitted(VALUE thread, sampling_buffer*
301
301
  // `record_sample`. So be careful where it gets allocated. (We do have tests for this, at least!)
302
302
  ddog_CharSlice function_name = DDOG_CHARSLICE_C("");
303
303
  ddog_CharSlice function_filename = {.ptr = frames_omitted_message, .len = strlen(frames_omitted_message)};
304
- buffer->lines[buffer->max_frames - 1] = (ddog_Line) {
305
- .function = (ddog_Function) {.name = function_name, .filename = function_filename},
304
+ buffer->lines[buffer->max_frames - 1] = (ddog_prof_Line) {
305
+ .function = (ddog_prof_Function) {.name = function_name, .filename = function_filename},
306
306
  .line = 0,
307
307
  };
308
308
  }
@@ -330,22 +330,22 @@ static void maybe_add_placeholder_frames_omitted(VALUE thread, sampling_buffer*
330
330
  static void record_placeholder_stack_in_native_code(
331
331
  sampling_buffer* buffer,
332
332
  VALUE recorder_instance,
333
- ddog_Slice_i64 metric_values,
334
- ddog_Slice_label labels,
333
+ ddog_Slice_I64 metric_values,
334
+ ddog_prof_Slice_Label labels,
335
335
  sampling_buffer *record_buffer,
336
336
  int extra_frames_in_record_buffer
337
337
  ) {
338
338
  ddog_CharSlice function_name = DDOG_CHARSLICE_C("");
339
339
  ddog_CharSlice function_filename = DDOG_CHARSLICE_C("In native code");
340
- buffer->lines[0] = (ddog_Line) {
341
- .function = (ddog_Function) {.name = function_name, .filename = function_filename},
340
+ buffer->lines[0] = (ddog_prof_Line) {
341
+ .function = (ddog_prof_Function) {.name = function_name, .filename = function_filename},
342
342
  .line = 0
343
343
  };
344
344
 
345
345
  record_sample(
346
346
  recorder_instance,
347
- (ddog_Sample) {
348
- .locations = (ddog_Slice_location) {.ptr = record_buffer->locations, .len = 1 + extra_frames_in_record_buffer},
347
+ (ddog_prof_Sample) {
348
+ .locations = (ddog_prof_Slice_Location) {.ptr = record_buffer->locations, .len = 1 + extra_frames_in_record_buffer},
349
349
  .values = metric_values,
350
350
  .labels = labels,
351
351
  }
@@ -364,14 +364,14 @@ sampling_buffer *sampling_buffer_new(unsigned int max_frames) {
364
364
  buffer->stack_buffer = ruby_xcalloc(max_frames, sizeof(VALUE));
365
365
  buffer->lines_buffer = ruby_xcalloc(max_frames, sizeof(int));
366
366
  buffer->is_ruby_frame = ruby_xcalloc(max_frames, sizeof(bool));
367
- buffer->locations = ruby_xcalloc(max_frames, sizeof(ddog_Location));
368
- buffer->lines = ruby_xcalloc(max_frames, sizeof(ddog_Line));
367
+ buffer->locations = ruby_xcalloc(max_frames, sizeof(ddog_prof_Location));
368
+ buffer->lines = ruby_xcalloc(max_frames, sizeof(ddog_prof_Line));
369
369
 
370
370
  // Currently we have a 1-to-1 correspondence between lines and locations, so we just initialize the locations once
371
371
  // here and then only mutate the contents of the lines.
372
372
  for (unsigned int i = 0; i < max_frames; i++) {
373
- ddog_Slice_line lines = (ddog_Slice_line) {.ptr = &buffer->lines[i], .len = 1};
374
- buffer->locations[i] = (ddog_Location) {.lines = lines};
373
+ ddog_prof_Slice_Line lines = (ddog_prof_Slice_Line) {.ptr = &buffer->lines[i], .len = 1};
374
+ buffer->locations[i] = (ddog_prof_Location) {.lines = lines};
375
375
  }
376
376
 
377
377
  return buffer;
@@ -10,8 +10,8 @@ void sample_thread(
10
10
  VALUE thread,
11
11
  sampling_buffer* buffer,
12
12
  VALUE recorder_instance,
13
- ddog_Slice_i64 metric_values,
14
- ddog_Slice_label labels,
13
+ ddog_Slice_I64 metric_values,
14
+ ddog_prof_Slice_Label labels,
15
15
  sample_type type
16
16
  );
17
17
  sampling_buffer *sampling_buffer_new(unsigned int max_frames);
@@ -20,20 +20,20 @@ static VALUE http_transport_class = Qnil;
20
20
  static VALUE library_version_string = Qnil;
21
21
 
22
22
  struct call_exporter_without_gvl_arguments {
23
- ddog_ProfileExporter *exporter;
24
- ddog_Request *request;
23
+ ddog_prof_Exporter *exporter;
24
+ ddog_prof_Exporter_Request *request;
25
25
  ddog_CancellationToken *cancel_token;
26
- ddog_SendResult result;
26
+ ddog_prof_Exporter_SendResult result;
27
27
  bool send_ran;
28
28
  };
29
29
 
30
30
  inline static ddog_ByteSlice byte_slice_from_ruby_string(VALUE string);
31
31
  static VALUE _native_validate_exporter(VALUE self, VALUE exporter_configuration);
32
- static ddog_NewProfileExporterResult create_exporter(VALUE exporter_configuration, VALUE tags_as_array);
33
- static VALUE handle_exporter_failure(ddog_NewProfileExporterResult exporter_result);
32
+ static ddog_prof_Exporter_NewResult create_exporter(VALUE exporter_configuration, VALUE tags_as_array);
33
+ static VALUE handle_exporter_failure(ddog_prof_Exporter_NewResult exporter_result);
34
34
  static ddog_Endpoint endpoint_from(VALUE exporter_configuration);
35
- static ddog_Vec_tag convert_tags(VALUE tags_as_array);
36
- static void safely_log_failure_to_process_tag(ddog_Vec_tag tags, VALUE err_details);
35
+ static ddog_Vec_Tag convert_tags(VALUE tags_as_array);
36
+ static void safely_log_failure_to_process_tag(ddog_Vec_Tag tags, VALUE err_details);
37
37
  static VALUE _native_do_export(
38
38
  VALUE self,
39
39
  VALUE exporter_configuration,
@@ -76,46 +76,46 @@ inline static ddog_ByteSlice byte_slice_from_ruby_string(VALUE string) {
76
76
 
77
77
  static VALUE _native_validate_exporter(DDTRACE_UNUSED VALUE _self, VALUE exporter_configuration) {
78
78
  ENFORCE_TYPE(exporter_configuration, T_ARRAY);
79
- ddog_NewProfileExporterResult exporter_result = create_exporter(exporter_configuration, rb_ary_new());
79
+ ddog_prof_Exporter_NewResult exporter_result = create_exporter(exporter_configuration, rb_ary_new());
80
80
 
81
81
  VALUE failure_tuple = handle_exporter_failure(exporter_result);
82
82
  if (!NIL_P(failure_tuple)) return failure_tuple;
83
83
 
84
84
  // We don't actually need the exporter for now -- we just wanted to validate that we could create it with the
85
85
  // settings we were given
86
- ddog_NewProfileExporterResult_drop(exporter_result);
86
+ ddog_prof_Exporter_NewResult_drop(exporter_result);
87
87
 
88
88
  return rb_ary_new_from_args(2, ok_symbol, Qnil);
89
89
  }
90
90
 
91
- static ddog_NewProfileExporterResult create_exporter(VALUE exporter_configuration, VALUE tags_as_array) {
91
+ static ddog_prof_Exporter_NewResult create_exporter(VALUE exporter_configuration, VALUE tags_as_array) {
92
92
  ENFORCE_TYPE(exporter_configuration, T_ARRAY);
93
93
  ENFORCE_TYPE(tags_as_array, T_ARRAY);
94
94
 
95
- // This needs to be called BEFORE convert_tags since it can raise an exception and thus cause the ddog_Vec_tag
95
+ // This needs to be called BEFORE convert_tags since it can raise an exception and thus cause the ddog_Vec_Tag
96
96
  // to be leaked.
97
97
  ddog_Endpoint endpoint = endpoint_from(exporter_configuration);
98
98
 
99
- ddog_Vec_tag tags = convert_tags(tags_as_array);
99
+ ddog_Vec_Tag tags = convert_tags(tags_as_array);
100
100
 
101
101
  ddog_CharSlice library_name = DDOG_CHARSLICE_C("dd-trace-rb");
102
102
  ddog_CharSlice library_version = char_slice_from_ruby_string(library_version_string);
103
103
  ddog_CharSlice profiling_family = DDOG_CHARSLICE_C("ruby");
104
104
 
105
- ddog_NewProfileExporterResult exporter_result =
106
- ddog_ProfileExporter_new(library_name, library_version, profiling_family, &tags, endpoint);
105
+ ddog_prof_Exporter_NewResult exporter_result =
106
+ ddog_prof_Exporter_new(library_name, library_version, profiling_family, &tags, endpoint);
107
107
 
108
- ddog_Vec_tag_drop(tags);
108
+ ddog_Vec_Tag_drop(tags);
109
109
 
110
110
  return exporter_result;
111
111
  }
112
112
 
113
- static VALUE handle_exporter_failure(ddog_NewProfileExporterResult exporter_result) {
114
- if (exporter_result.tag == DDOG_NEW_PROFILE_EXPORTER_RESULT_OK) return Qnil;
113
+ static VALUE handle_exporter_failure(ddog_prof_Exporter_NewResult exporter_result) {
114
+ if (exporter_result.tag == DDOG_PROF_EXPORTER_NEW_RESULT_OK) return Qnil;
115
115
 
116
- VALUE err_details = ruby_string_from_vec_u8(exporter_result.err);
116
+ VALUE err_details = ruby_string_from_prof_vec_u8(exporter_result.err);
117
117
 
118
- ddog_NewProfileExporterResult_drop(exporter_result);
118
+ ddog_prof_Exporter_NewResult_drop(exporter_result);
119
119
 
120
120
  return rb_ary_new_from_args(2, error_symbol, err_details);
121
121
  }
@@ -145,17 +145,17 @@ static ddog_Endpoint endpoint_from(VALUE exporter_configuration) {
145
145
  }
146
146
 
147
147
  __attribute__((warn_unused_result))
148
- static ddog_Vec_tag convert_tags(VALUE tags_as_array) {
148
+ static ddog_Vec_Tag convert_tags(VALUE tags_as_array) {
149
149
  ENFORCE_TYPE(tags_as_array, T_ARRAY);
150
150
 
151
151
  long tags_count = RARRAY_LEN(tags_as_array);
152
- ddog_Vec_tag tags = ddog_Vec_tag_new();
152
+ ddog_Vec_Tag tags = ddog_Vec_Tag_new();
153
153
 
154
154
  for (long i = 0; i < tags_count; i++) {
155
155
  VALUE name_value_pair = rb_ary_entry(tags_as_array, i);
156
156
 
157
157
  if (!RB_TYPE_P(name_value_pair, T_ARRAY)) {
158
- ddog_Vec_tag_drop(tags);
158
+ ddog_Vec_Tag_drop(tags);
159
159
  ENFORCE_TYPE(name_value_pair, T_ARRAY);
160
160
  }
161
161
 
@@ -164,23 +164,23 @@ static ddog_Vec_tag convert_tags(VALUE tags_as_array) {
164
164
  VALUE tag_value = rb_ary_entry(name_value_pair, 1);
165
165
 
166
166
  if (!(RB_TYPE_P(tag_name, T_STRING) && RB_TYPE_P(tag_value, T_STRING))) {
167
- ddog_Vec_tag_drop(tags);
167
+ ddog_Vec_Tag_drop(tags);
168
168
  ENFORCE_TYPE(tag_name, T_STRING);
169
169
  ENFORCE_TYPE(tag_value, T_STRING);
170
170
  }
171
171
 
172
- ddog_PushTagResult push_result =
173
- ddog_Vec_tag_push(&tags, char_slice_from_ruby_string(tag_name), char_slice_from_ruby_string(tag_value));
172
+ ddog_Vec_Tag_PushResult push_result =
173
+ ddog_Vec_Tag_push(&tags, char_slice_from_ruby_string(tag_name), char_slice_from_ruby_string(tag_value));
174
174
 
175
- if (push_result.tag == DDOG_PUSH_TAG_RESULT_ERR) {
175
+ if (push_result.tag == DDOG_VEC_TAG_PUSH_RESULT_ERR) {
176
176
  VALUE err_details = ruby_string_from_vec_u8(push_result.err);
177
- ddog_PushTagResult_drop(push_result);
177
+ ddog_Vec_Tag_PushResult_drop(push_result);
178
178
 
179
179
  // libdatadog validates tags and may catch invalid tags that ddtrace didn't actually catch.
180
180
  // We warn users about such tags, and then just ignore them.
181
181
  safely_log_failure_to_process_tag(tags, err_details);
182
182
  } else {
183
- ddog_PushTagResult_drop(push_result);
183
+ ddog_Vec_Tag_PushResult_drop(push_result);
184
184
  }
185
185
  }
186
186
 
@@ -193,12 +193,12 @@ static VALUE log_failure_to_process_tag(VALUE err_details) {
193
193
 
194
194
  // Since we are calling into Ruby code, it may raise an exception. This method ensure that dynamically-allocated tags
195
195
  // get cleaned before propagating the exception.
196
- static void safely_log_failure_to_process_tag(ddog_Vec_tag tags, VALUE err_details) {
196
+ static void safely_log_failure_to_process_tag(ddog_Vec_Tag tags, VALUE err_details) {
197
197
  int exception_state;
198
198
  rb_protect(log_failure_to_process_tag, err_details, &exception_state);
199
199
 
200
200
  if (exception_state) { // An exception was raised
201
- ddog_Vec_tag_drop(tags); // clean up
201
+ ddog_Vec_Tag_drop(tags); // clean up
202
202
  rb_jump_tag(exception_state); // "Re-raise" exception
203
203
  }
204
204
  }
@@ -206,17 +206,18 @@ static void safely_log_failure_to_process_tag(ddog_Vec_tag tags, VALUE err_detai
206
206
  // Note: This function handles a bunch of libdatadog dynamically-allocated objects, so it MUST not use any Ruby APIs
207
207
  // which can raise exceptions, otherwise the objects will be leaked.
208
208
  static VALUE perform_export(
209
- ddog_NewProfileExporterResult valid_exporter_result, // Must be called with a valid exporter result
209
+ ddog_prof_Exporter_NewResult valid_exporter_result, // Must be called with a valid exporter result
210
210
  ddog_Timespec start,
211
211
  ddog_Timespec finish,
212
- ddog_Slice_file slice_files,
213
- ddog_Vec_tag *additional_tags,
212
+ ddog_prof_Exporter_Slice_File slice_files,
213
+ ddog_Vec_Tag *additional_tags,
214
214
  uint64_t timeout_milliseconds
215
215
  ) {
216
- ddog_ProfileExporter *exporter = valid_exporter_result.ok;
216
+ ddog_prof_Exporter *exporter = valid_exporter_result.ok;
217
217
  ddog_CancellationToken *cancel_token = ddog_CancellationToken_new();
218
- ddog_Request *request =
219
- ddog_ProfileExporter_build(exporter, start, finish, slice_files, additional_tags, timeout_milliseconds);
218
+ ddog_prof_ProfiledEndpointsStats *endpoints_stats = NULL; // Not in use yet
219
+ ddog_prof_Exporter_Request *request =
220
+ ddog_prof_Exporter_Request_build(exporter, start, finish, slice_files, additional_tags, endpoints_stats, timeout_milliseconds);
220
221
 
221
222
  // We'll release the Global VM Lock while we're calling send, so that the Ruby VM can continue to work while this
222
223
  // is pending
@@ -246,23 +247,23 @@ static VALUE perform_export(
246
247
 
247
248
  // Cleanup exporter and token, no longer needed
248
249
  ddog_CancellationToken_drop(cancel_token);
249
- ddog_NewProfileExporterResult_drop(valid_exporter_result);
250
+ ddog_prof_Exporter_NewResult_drop(valid_exporter_result);
250
251
 
251
252
  if (pending_exception) {
252
253
  // If we got here send did not run, so we need to explicitly dispose of the request
253
- ddog_Request_drop(request);
254
+ ddog_prof_Exporter_Request_drop(request);
254
255
 
255
256
  // Let Ruby propagate the exception. This will not return.
256
257
  rb_jump_tag(pending_exception);
257
258
  }
258
259
 
259
- ddog_SendResult result = args.result;
260
- bool success = result.tag == DDOG_SEND_RESULT_HTTP_RESPONSE;
260
+ ddog_prof_Exporter_SendResult result = args.result;
261
+ bool success = result.tag == DDOG_PROF_EXPORTER_SEND_RESULT_HTTP_RESPONSE;
261
262
 
262
263
  VALUE ruby_status = success ? ok_symbol : error_symbol;
263
- VALUE ruby_result = success ? UINT2NUM(result.http_response.code) : ruby_string_from_vec_u8(result.err);
264
+ VALUE ruby_result = success ? UINT2NUM(result.http_response.code) : ruby_string_from_prof_vec_u8(result.err);
264
265
 
265
- ddog_SendResult_drop(args.result);
266
+ ddog_prof_Exporter_SendResult_drop(args.result);
266
267
  // The request itself does not need to be freed as libdatadog takes care of it as part of sending.
267
268
 
268
269
  return rb_ary_new_from_args(2, ruby_status, ruby_result);
@@ -303,23 +304,23 @@ static VALUE _native_do_export(
303
304
  {.seconds = NUM2LONG(finish_timespec_seconds), .nanoseconds = NUM2UINT(finish_timespec_nanoseconds)};
304
305
 
305
306
  int files_to_report = 1 + (have_code_provenance ? 1 : 0);
306
- ddog_File files[files_to_report];
307
- ddog_Slice_file slice_files = {.ptr = files, .len = files_to_report};
307
+ ddog_prof_Exporter_File files[files_to_report];
308
+ ddog_prof_Exporter_Slice_File slice_files = {.ptr = files, .len = files_to_report};
308
309
 
309
- files[0] = (ddog_File) {
310
+ files[0] = (ddog_prof_Exporter_File) {
310
311
  .name = char_slice_from_ruby_string(pprof_file_name),
311
312
  .file = byte_slice_from_ruby_string(pprof_data)
312
313
  };
313
314
  if (have_code_provenance) {
314
- files[1] = (ddog_File) {
315
+ files[1] = (ddog_prof_Exporter_File) {
315
316
  .name = char_slice_from_ruby_string(code_provenance_file_name),
316
317
  .file = byte_slice_from_ruby_string(code_provenance_data)
317
318
  };
318
319
  }
319
320
 
320
- ddog_Vec_tag *null_additional_tags = NULL;
321
+ ddog_Vec_Tag *null_additional_tags = NULL;
321
322
 
322
- ddog_NewProfileExporterResult exporter_result = create_exporter(exporter_configuration, tags_as_array);
323
+ ddog_prof_Exporter_NewResult exporter_result = create_exporter(exporter_configuration, tags_as_array);
323
324
  // Note: Do not add anything that can raise exceptions after this line, as otherwise the exporter memory will leak
324
325
 
325
326
  VALUE failure_tuple = handle_exporter_failure(exporter_result);
@@ -331,7 +332,7 @@ static VALUE _native_do_export(
331
332
  static void *call_exporter_without_gvl(void *call_args) {
332
333
  struct call_exporter_without_gvl_arguments *args = (struct call_exporter_without_gvl_arguments*) call_args;
333
334
 
334
- args->result = ddog_ProfileExporter_send(args->exporter, args->request, args->cancel_token);
335
+ args->result = ddog_prof_Exporter_send(args->exporter, args->request, args->cancel_token);
335
336
  args->send_ran = true;
336
337
 
337
338
  return NULL; // Unused
@@ -9,6 +9,10 @@ inline static ddog_CharSlice char_slice_from_ruby_string(VALUE string) {
9
9
  return char_slice;
10
10
  }
11
11
 
12
- inline static VALUE ruby_string_from_vec_u8(ddog_Vec_u8 string) {
12
+ inline static VALUE ruby_string_from_vec_u8(ddog_Vec_U8 string) {
13
+ return rb_str_new((char *) string.ptr, string.len);
14
+ }
15
+
16
+ inline static VALUE ruby_string_from_prof_vec_u8(ddog_prof_Vec_U8 string) {
13
17
  return rb_str_new((char *) string.ptr, string.len);
14
18
  }