Skip to content

Commit

Permalink
account for differences in host_inject and auto_inject
Browse files Browse the repository at this point in the history
  • Loading branch information
randomanderson committed Jul 15, 2024
1 parent 9e6f71a commit 52f4f5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .gitlab/prepare-oci-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ set -e
mkdir sources

cp ../lib-injection/host_inject.rb sources
sed -i "s#/opt/datadog/apm/library/ruby/#/opt/datadog-packages/datadog-apm-library-ruby/$RUBY_PACKAGE_VERSION/#g" sources/host_inject.rb

# Kubernetes injection expects a different path
cp sources/host_inject.rb source/auto_inject.rb

sed -i "s#PATH_PLACEHOLDER#/opt/datadog-packages/datadog-apm-library-ruby/${RUBY_PACKAGE_VERSION}#g" sources/host_inject.rb
sed -i "s#PATH_PLACEHOLDER#/datadog-lib#g" sources/auto_inject.rb

cp -r ../tmp/${ARCH}/* sources

cp ../tmp/version.txt sources/version
8 changes: 5 additions & 3 deletions lib-injection/host_inject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def dd_skip_injection!
def dd_send_telemetry(events)
pid = Process.respond_to?(:pid) ? Process.pid : 0 # Not available on all platforms

tracer_version = if File.exist?('/opt/datadog/apm/library/ruby/version.txt')
File.read('/opt/datadog/apm/library/ruby/version.txt').chomp
tracer_version = if File.exist?('PATH_PLACEHOLDER/version.txt')
File.read('PATH_PLACEHOLDER/version.txt').chomp
elsif File.exist?('PATH_PLACEHOLDER/version')
File.read('PATH_PLACEHOLDER/version').chomp
else
'unknown'
end
Expand Down Expand Up @@ -58,7 +60,7 @@ def dd_send_telemetry(events)

major, minor, = RUBY_VERSION.split('.')
ruby_api_version = "#{major}.#{minor}.0"
dd_lib_injection_path = "/opt/datadog/apm/library/ruby/#{ruby_api_version}"
dd_lib_injection_path = "PATH_PLACEHOLDER/#{ruby_api_version}"
dd_debug_log "Loading from #{dd_lib_injection_path}..."

supported_ruby_api_versions = ['2.7.0', '3.0.0', '3.1.0', '3.2.0'].freeze
Expand Down

0 comments on commit 52f4f5b

Please sign in to comment.