Skip to content

Commit

Permalink
Clean up a few more references to libddprof name
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoanjo committed Jul 8, 2022
1 parent ff18ad2 commit 142d404
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ext/ddtrace_profiling_loader/ddtrace_profiling_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// This idea was shamelessly stolen from @lloeki's work in https://github.com/rubyjs/mini_racer/pull/179, big thanks!
//
// Extra note: Currently (May 2022), that we know of, the profiling native extension only exposes one potentially
// problematic symbol: `rust_eh_personality` (coming from libddprof/libdatadog).
// problematic symbol: `rust_eh_personality` (coming from libdatadog).
// Future versions of Rust have been patched not to expose this
// (see https://github.com/rust-lang/rust/pull/95604#issuecomment-1108563434) so we may want to revisit the need
// for this loader in the future, and perhaps delete it if we no longer require its services :)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The profiling native extension is used to:
1. Implement features which are expensive (in terms of resources) or otherwise impossible to implement using Ruby code.
2. Bridge between Ruby-specific profiling features and [`libddprof`](https://github.com/DataDog/libddprof), a Rust-based
2. Bridge between Ruby-specific profiling features and [`libdatadog`](https://github.com/DataDog/libdatadog), a Rust-based
library with common profiling functionality.

Due to (1), this extension is quite coupled with MRI Ruby ("C Ruby") internals, and is not intended to support other rubies such as
Expand Down
6 changes: 3 additions & 3 deletions ext/ddtrace_profiling_native_extension/http_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static ddprof_ffi_Vec_tag convert_tags(VALUE tags_as_array) {
VALUE err_details = ruby_string_from_vec_u8(push_result.err);
ddprof_ffi_PushTagResult_drop(push_result);

// libddprof validates tags and may catch invalid tags that ddtrace didn't actually catch.
// libdatadog validates tags and may catch invalid tags that ddtrace didn't actually catch.
// We warn users about such tags, and then just ignore them.
safely_log_failure_to_process_tag(tags, err_details);
} else {
Expand All @@ -193,7 +193,7 @@ static void safely_log_failure_to_process_tag(ddprof_ffi_Vec_tag tags, VALUE err
}
}

// Note: This function handles a bunch of libddprof dynamically-allocated objects, so it MUST not use any Ruby APIs
// Note: This function handles a bunch of libdatadog dynamically-allocated objects, so it MUST not use any Ruby APIs
// which can raise exceptions, otherwise the objects will be leaked.
static VALUE perform_export(
ddprof_ffi_NewProfileExporterV3Result valid_exporter_result, // Must be called with a valid exporter result
Expand Down Expand Up @@ -253,7 +253,7 @@ static VALUE perform_export(
VALUE ruby_result = success ? UINT2NUM(result.http_response.code) : ruby_string_from_vec_u8(result.err);

ddprof_ffi_SendResult_drop(args.result);
// The request itself does not need to be freed as libddprof takes care of it as part of sending.
// The request itself does not need to be freed as libdatadog takes care of it as part of sending.

return rb_ary_new_from_args(2, ruby_status, ruby_result);
}
Expand Down
6 changes: 3 additions & 3 deletions ext/ddtrace_profiling_native_extension/stack_recorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ void stack_recorder_init(VALUE profiling_module) {

// Instances of the StackRecorder class are "TypedData" objects.
// "TypedData" objects are special objects in the Ruby VM that can wrap C structs.
// In our case, we're going to keep a libddprof profile reference inside our object.
// In our case, we're going to keep a libdatadog profile reference inside our object.
//
// Because Ruby doesn't know how to initialize libddprof profiles, we MUST override the allocation function for objects
// Because Ruby doesn't know how to initialize libdatadog profiles, we MUST override the allocation function for objects
// of this class so that we can manage this part. Not overriding or disabling the allocation function is a common
// gotcha for "TypedData" objects that can very easily lead to VM crashes, see for instance
// https://bugs.ruby-lang.org/issues/18007 for a discussion around this.
Expand Down Expand Up @@ -105,7 +105,7 @@ static VALUE _native_serialize(VALUE self, VALUE recorder_instance) {
ddprof_ffi_Timespec ddprof_start = serialized_profile.ok.start;
ddprof_ffi_Timespec ddprof_finish = serialized_profile.ok.end;

// Clean up libddprof object to avoid leaking in case ruby_time_from raises an exception
// Clean up libdatadog object to avoid leaking in case ruby_time_from raises an exception
ddprof_ffi_SerializeResult_drop(serialized_profile);

VALUE start = ruby_time_from(ddprof_start);
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/profiling/http_transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def export(flush)
upload_timeout_milliseconds: @upload_timeout_milliseconds,

# why "timespec"?
# libddprof represents time using POSIX's struct timespec, see
# libdatadog represents time using POSIX's struct timespec, see
# https://www.gnu.org/software/libc/manual/html_node/Time-Types.html
# aka it represents the seconds part separate from the nanoseconds part
start_timespec_seconds: flush.start.tv_sec,
Expand Down
4 changes: 2 additions & 2 deletions spec/datadog/profiling/http_transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# between the Ruby code and the native methods, and thus in this class we have a bunch of tests to make sure the
# native methods are invoked correctly.
#
# We also have "integration" specs, where we exercise the Ruby code together with the C code and libddprof to ensure
# that things come out of libddprof as we expected.
# We also have "integration" specs, where we exercise the Ruby code together with the C code and libdatadog to ensure
# that things come out of libdatadog as we expected.
RSpec.describe Datadog::Profiling::HttpTransport do
before { skip_if_profiling_not_supported(self) }

Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/profiling/native_extension_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

expect(relative_path).to start_with('../')
expect(File.exist?(full_libdatadog_path))
.to be(true), "Libddprof not available in expected path: #{full_libdatadog_path.inspect}"
.to be(true), "Libdatadog not available in expected path: #{full_libdatadog_path.inspect}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/datadog/profiling/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def skip_if_profiling_not_supported(testcase)
testcase.skip('Profiling is not supported on JRuby') if PlatformHelpers.jruby?
testcase.skip('Profiling is not supported on TruffleRuby') if PlatformHelpers.truffleruby?

# Profiling is not officially supported on macOS due to missing libddprof binaries,
# Profiling is not officially supported on macOS due to missing libdatadog binaries,
# but it's still useful to allow it to be enabled for development.
if PlatformHelpers.mac? && ENV['DD_PROFILING_MACOS_TESTING'] != 'true'
testcase.skip(
Expand Down
4 changes: 2 additions & 2 deletions spec/datadog/profiling/stack_recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

subject(:stack_recorder) { described_class.new }

# NOTE: A lot of libddprof integration behaviors are tested in the Collectors::Stack specs, since we need actual
# samples in order to observe what comes out of libddprof
# NOTE: A lot of libdatadog integration behaviors are tested in the Collectors::Stack specs, since we need actual
# samples in order to observe what comes out of libdatadog

describe '#serialize' do
subject(:serialize) { stack_recorder.serialize }
Expand Down

0 comments on commit 142d404

Please sign in to comment.