Skip to content

Commit

Permalink
Merge pull request #3547 from DataDog/tonycthsu/update-2.0-with-maste…
Browse files Browse the repository at this point in the history
…r-1.21.1

Update 2.0 with 1.21.1
  • Loading branch information
TonyCTHsu authored Mar 21, 2024
2 parents e2504ea + 0d0b659 commit 438a180
Show file tree
Hide file tree
Showing 51 changed files with 462 additions and 271 deletions.
2 changes: 1 addition & 1 deletion .circleci/images/primary/binary_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
4
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ run the test suite, write new integrations, and more.
**2.0 Upgrade Guide notes**
<!--
(If this PR is for 1.x, please delete this section)
A public facing description that will go into the [upgrade guide](https://github.com/DataDog/dd-trace-rb/blob/master/docs/UpgradeGuide.md) for this change.
We already know what the PR does (from the PR title),
but users should know either:
If this PR introduces a breaking change, update the
https://github.com/DataDog/dd-trace-rb/blob/2.0/docs/UpgradeGuide2.md
in this PR with either:
* A migration path for this change. In other words, how to continue using their application without behavior changes
in 2.0 (e.g. environment variable 'X' renamed to 'Y').
* That there's no alternative; we completely dropped support for this feature.
* That there's no alternative; we removed support for this feature.
-->

**What does this PR do?**
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/lib-injection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Login to Docker
run: docker login -u publisher -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- name: Docker latest snapshot build
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
push: true
tags: ghcr.io/datadog/dd-trace-rb/dd-lib-ruby-init:latest_snapshot
platforms: 'linux/amd64,linux/arm64/v8'
build-args: DDTRACE_RUBY_SHA=${{ github.sha }}
context: ./lib-injection
- name: Docker Build
uses: docker/build-push-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ build-gem:
stage: package
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
when: on_success
- if: $CI_COMMIT_TAG
when: on_success
- if: $CI_COMMIT_BRANCH == 'master'
Expand All @@ -90,7 +90,7 @@ build-gem:
.gitlab/patch_gem_version.sh glci $CI_JOB_ID $CI_COMMIT_REF_NAME $CI_COMMIT_SHA
fi
- bundle install && bundle exec rake build
- bundle install && chmod go-w -R . && bundle exec rake build
- mkdir -p tmp && ruby -Ilib -rdatadog/version -e 'puts Gem::Version.new(Datadog::VERSION::STRING).to_s' >> tmp/version.txt
artifacts:
paths:
Expand Down
6 changes: 5 additions & 1 deletion .gitlab/build-deb-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ echo -n "$RUBY_PACKAGE_VERSION" > auto_inject-ruby.version

source common_build_functions.sh

chmod a+r -R ../tmp/*
# The normal settings for /tmp are 1777, which ls shows as drwxrwxrwt. That is wide open.
#
# This gives all users read access, and removes write access for group and others,
# to all files and directories in the tmp directory.
chmod -R a+r,go-w ../tmp/*

fpm_wrapper "datadog-apm-library-ruby" "$RUBY_PACKAGE_VERSION" \
--input-type dir \
Expand Down
78 changes: 77 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,54 @@

## [Unreleased]

## [1.21.1] - 2024-03-20

### Added

* Backports auto instrument shim with `datadog/auto_instrument` ([#3535][])

### Fixed

* Fix ActiveRecord resolving invalid string ([#3523][])
* Revert `http.route` tagging to fix instrumentation failure for Rails 7.1 apps ([#3539][])
* Fix wrong permissions on released gem files ([#3531][])

## [1.21.0] - 2024-03-14

### Highlights
Allocation profiling is now in beta, and timeline profiling is enabled by default.
For more details, check the [release notes](https://github.com/DataDog/dd-trace-rb/releases/tag/v1.21.0)

### Added

* APM source code integration ([#3463][])
* Core: Reduce startup logs verbosity ([#3468][])
* Tracing: Add Concurrent::Async instrumentation ([#3427][])
* Profiling: System info support ([#3357][])
* Profiling: Add bin/ddprofrb ([#3501][])

### Changed

* Bump datadog-ci dependency to 0.8.1 ([#3518][])
* Upgrade to libdatadog 6 ([#3455][])
* Core: Allow suppressing error logs for Core::Remote::Negotiation ([#3495][])
* Tracing: Add `http.route` tag to rack ([#3345][])
* Tracing: Logs deprecation warning for `use` removal ([#3438][])
* Profiling: Allocation sampling overhead improvements ([#3434][], [#3440][])
* Profiling: Enable timeline by default ([#3428][])
* Profiling: Rename Profiling files to reflect "datadog" instead of "ddtrace" ([#3502][])
* Profiling: Replace `profiling.advanced.experimental_allocation_enabled` with `profiling.allocation_enabled` and remove experimental warning ([#3520][])

### Fixed

* Core: Fix rare remote configuration worker thread leak ([#3519][])
* Tracing: Fix `Datadog::Tracing.reject!` with correct metrics ([#3491][])
* Tracing: Guard PG result with `nil` check ([#3511][])
* Profiling: Add workaround for Ruby VM bug causing crash in gc_finalize_deferred ([#3473][])
* Profiling: Fix missing profiling code hotspots when using ddtrace+otel ([#3466][])
* Profiling: Stop worker on clock failure ([#3439][])
* Profiling: Upgrade libdatadog to fix incorrect platform detection for x86_64-linux-gnu/aarch64-linux-gnu ([#3503][])

## [1.20.0] - 2024-02-05

### Added
Expand Down Expand Up @@ -2728,7 +2776,9 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1


[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.20.0...master
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.1...master
[1.21.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.0...v1.21.1
[1.21.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.20.0...v1.21.0
[1.20.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.19.0...v1.20.0
[1.19.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.18.0...v1.19.0
[1.18.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.17.0...v1.18.0
Expand Down Expand Up @@ -3979,10 +4029,12 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
[#3328]: https://github.com/DataDog/dd-trace-rb/issues/3328
[#3329]: https://github.com/DataDog/dd-trace-rb/issues/3329
[#3333]: https://github.com/DataDog/dd-trace-rb/issues/3333
[#3345]: https://github.com/DataDog/dd-trace-rb/issues/3345
[#3349]: https://github.com/DataDog/dd-trace-rb/issues/3349
[#3352]: https://github.com/DataDog/dd-trace-rb/issues/3352
[#3354]: https://github.com/DataDog/dd-trace-rb/issues/3354
[#3356]: https://github.com/DataDog/dd-trace-rb/issues/3356
[#3357]: https://github.com/DataDog/dd-trace-rb/issues/3357
[#3360]: https://github.com/DataDog/dd-trace-rb/issues/3360
[#3361]: https://github.com/DataDog/dd-trace-rb/issues/3361
[#3362]: https://github.com/DataDog/dd-trace-rb/issues/3362
Expand All @@ -3996,7 +4048,31 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
[#3408]: https://github.com/DataDog/dd-trace-rb/issues/3408
[#3420]: https://github.com/DataDog/dd-trace-rb/issues/3420
[#3426]: https://github.com/DataDog/dd-trace-rb/issues/3426
[#3427]: https://github.com/DataDog/dd-trace-rb/issues/3427
[#3428]: https://github.com/DataDog/dd-trace-rb/issues/3428
[#3431]: https://github.com/DataDog/dd-trace-rb/issues/3431
[#3434]: https://github.com/DataDog/dd-trace-rb/issues/3434
[#3438]: https://github.com/DataDog/dd-trace-rb/issues/3438
[#3439]: https://github.com/DataDog/dd-trace-rb/issues/3439
[#3440]: https://github.com/DataDog/dd-trace-rb/issues/3440
[#3455]: https://github.com/DataDog/dd-trace-rb/issues/3455
[#3463]: https://github.com/DataDog/dd-trace-rb/issues/3463
[#3466]: https://github.com/DataDog/dd-trace-rb/issues/3466
[#3468]: https://github.com/DataDog/dd-trace-rb/issues/3468
[#3473]: https://github.com/DataDog/dd-trace-rb/issues/3473
[#3491]: https://github.com/DataDog/dd-trace-rb/issues/3491
[#3495]: https://github.com/DataDog/dd-trace-rb/issues/3495
[#3501]: https://github.com/DataDog/dd-trace-rb/issues/3501
[#3502]: https://github.com/DataDog/dd-trace-rb/issues/3502
[#3503]: https://github.com/DataDog/dd-trace-rb/issues/3503
[#3511]: https://github.com/DataDog/dd-trace-rb/issues/3511
[#3518]: https://github.com/DataDog/dd-trace-rb/issues/3518
[#3519]: https://github.com/DataDog/dd-trace-rb/issues/3519
[#3520]: https://github.com/DataDog/dd-trace-rb/issues/3520
[#3523]: https://github.com/DataDog/dd-trace-rb/issues/3523
[#3531]: https://github.com/DataDog/dd-trace-rb/issues/3531
[#3535]: https://github.com/DataDog/dd-trace-rb/issues/3535
[#3539]: https://github.com/DataDog/dd-trace-rb/issues/3539
[@AdrianLC]: https://github.com/AdrianLC
[@Azure7111]: https://github.com/Azure7111
[@BabyGroot]: https://github.com/BabyGroot
Expand Down
13 changes: 2 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ TEST_METADATA = {
'redis-4' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby',
'redis-5' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
'routetest' => {
'multi-rack-app' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby'
},
'appsec:rack' => {
# Non-deprecated form of Regexp.new does not backport to Rack 1.x, see: https://github.com/rack/rack/pull/1998
'rack-1' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ❌ 3.3 / ✅ jruby',
Expand Down Expand Up @@ -329,13 +326,13 @@ namespace :spec do
task all: [:main, :benchmark,
:rails, :railsredis, :railsredis_activesupport, :railsactivejob,
:elasticsearch, :http, :redis, :sidekiq, :sinatra, :hanami, :hanami_autoinstrument,
:profiling, :routetest]
:profiling]

desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:main) do |t, args|
t.pattern = 'spec/**/*_spec.rb'
t.exclude_pattern = 'spec/**/{contrib,benchmark,redis,auto_instrument,opentelemetry,profiling}/**/*_spec.rb,'\
' spec/**/{auto_instrument,opentelemetry}_spec.rb'
' spec/**/{auto_instrument,opentelemetry}_spec.rb, spec/datadog/gem_packaging_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

Expand All @@ -358,12 +355,6 @@ namespace :spec do
t.rspec_opts = args.to_a.join(' ')
end

desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:routetest) do |t, args|
t.pattern = 'spec/datadog/tracing/contrib/http_route_spec.rb'
t.rspec_opts = args.to_a.join(' ')
end

desc '' # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(:railsredis) do |t, args|
t.pattern = 'spec/datadog/tracing/contrib/rails/**/*redis*_spec.rb'
Expand Down
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,5 @@ target :datadog do

# TODO: gem 'libddwaf'
library 'libddwaf'
library 'libdatadog'
end
8 changes: 0 additions & 8 deletions appraisal/jruby-9.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 5.2.1'
end
8 changes: 0 additions & 8 deletions appraisal/jruby-9.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 5.2.1'
end
8 changes: 0 additions & 8 deletions appraisal/jruby-9.4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 6.1.0'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-2.5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 5.2.1'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-2.6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 5.2.1'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-2.7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 5.2.1'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-3.0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 6.1.0'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-3.1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 6.1.0'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-3.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 6.1.0'
end
8 changes: 0 additions & 8 deletions appraisal/ruby-3.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,3 @@
appraise 'core-old' do
gem 'dogstatsd-ruby', '~> 4'
end

appraise 'multi-rack-app' do
gem 'sinatra', '>= 3'
gem 'rack-contrib'
gem 'rack-test' # Dev dependencies for testing rack-based code
gem 'grape'
gem 'rails', '~> 6.1.0'
end
11 changes: 0 additions & 11 deletions ext/datadog_profiling_native_extension/http_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ static VALUE _native_do_export(
);
static void *call_exporter_without_gvl(void *call_args);
static void interrupt_exporter_call(void *cancel_token);
static VALUE ddtrace_version(void);

void http_transport_init(VALUE profiling_module) {
VALUE http_transport_class = rb_define_class_under(profiling_module, "HttpTransport", rb_cObject);
Expand Down Expand Up @@ -374,13 +373,3 @@ static void *call_exporter_without_gvl(void *call_args) {
static void interrupt_exporter_call(void *cancel_token) {
ddog_CancellationToken_cancel((ddog_CancellationToken *) cancel_token);
}

static VALUE ddtrace_version(void) {
VALUE ddtrace_module = rb_const_get(rb_cObject, rb_intern("Datadog"));
ENFORCE_TYPE(ddtrace_module, T_MODULE);
VALUE version_module = rb_const_get(ddtrace_module, rb_intern("VERSION"));
ENFORCE_TYPE(version_module, T_MODULE);
VALUE version_string = rb_const_get(version_module, rb_intern("STRING"));
ENFORCE_TYPE(version_string, T_STRING);
return version_string;
}
10 changes: 10 additions & 0 deletions ext/datadog_profiling_native_extension/ruby_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,13 @@ VALUE ruby_safe_inspect(VALUE obj) {
return rb_str_new_cstr("(Not inspectable)");
}
}

VALUE ddtrace_version(void) {
VALUE ddtrace_module = rb_const_get(rb_cObject, rb_intern("Datadog"));
ENFORCE_TYPE(ddtrace_module, T_MODULE);
VALUE version_module = rb_const_get(ddtrace_module, rb_intern("VERSION"));
ENFORCE_TYPE(version_module, T_MODULE);
VALUE version_string = rb_const_get(version_module, rb_intern("STRING"));
ENFORCE_TYPE(version_string, T_STRING);
return version_string;
}
2 changes: 2 additions & 0 deletions ext/datadog_profiling_native_extension/ruby_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ size_t ruby_obj_memsize_of(VALUE obj);
// return a string with the result of that call. Elsif the object responds to
// 'to_s', return a string with the result of that call. Otherwise, return Qnil.
VALUE ruby_safe_inspect(VALUE obj);

VALUE ddtrace_version(void);
2 changes: 1 addition & 1 deletion lib/datadog/auto_instrument.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# This file's path is part of the @public_api.
require_relative '../datadog'
require_relative '../datadog/tracing/contrib/auto_instrument'
require_relative 'tracing/contrib/auto_instrument'

Datadog::Profiling.start_if_enabled

Expand Down
Loading

0 comments on commit 438a180

Please sign in to comment.