libddprof 0.2.0.beta2 → 0.5.0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab2d397b008650be1995c56f28fcf085e355fa4609c91669027f592715c04419
4
- data.tar.gz: 11eb276ac1dc89cbf9d4e11fa618104f0307016a5010463ece61454a2cdac565
3
+ metadata.gz: f01692aa38a65d01c888aa33c8d49ae4dabf4344402e4c7efed79e3804fb3073
4
+ data.tar.gz: 52e7f4818b2a1cf39a08bd7fbe51208c7c20649fd2978b7b1ad4685073324caf
5
5
  SHA512:
6
- metadata.gz: 8b4a4aa558f57d4b4ebf9002e93619e076b81b0bfed62eb149faf0d10c39c20bdde5b13e53218558a9213c8f4ca6928d45fa7a9683581e0a13386f64528e0c68
7
- data.tar.gz: 0f4ec30dcf6401f5e55e7297162a17c36ab83ec47f70f91a8c55ce6414b80ad021f04f8d0434b277c6dc6f3dc0c5124977b8dc1e78910dc7c7a64e80e634415a
6
+ metadata.gz: 014be64f975e44baa87bb2766d3e2ad9ed5528f375aec84908e49daee883f9988f08530066c5487cf0d66feca901c58ae8683837e392e255ad8deabdfc6a0300
7
+ data.tar.gz: 83c1c491b99cf6c764405555c4d251be478e46f02d9147cecafd9bfb674f3debfaf4d4ca9c0976f902a091c037c177faaa452ef81675114feaf5024f195d0031
@@ -2,8 +2,16 @@
2
2
 
3
3
  module Libddprof
4
4
  # Current libddprof version
5
- LIB_VERSION = "0.2.0"
5
+ LIB_VERSION = "0.5.0"
6
6
 
7
- # This is the Ruby gem version -- often it will match LIB_VERSION, but sometimes it may not
8
- VERSION = "#{LIB_VERSION}.beta2"
7
+ GEM_MAJOR_VERSION = "1"
8
+ GEM_MINOR_VERSION = "0"
9
+ GEM_PRERELEASE_VERSION = ".beta1" # remember to include dot prefix, if needed!
10
+ private_constant :GEM_MAJOR_VERSION, :GEM_MINOR_VERSION, :GEM_PRERELEASE_VERSION
11
+
12
+ # The gem version scheme is lib_version.gem_major.gem_minor[.prerelease].
13
+ # This allows a version constraint such as ~> 0.2.0.1.0 in the consumer (ddtrace), in essence pinning the libddprof to
14
+ # a specific version like = 0.2.0, but still allow a) introduction of a gem-level breaking change by bumping gem_major
15
+ # and b) allow to push automatically picked up bugfixes by bumping gem_minor.
16
+ VERSION = "#{LIB_VERSION}.#{GEM_MAJOR_VERSION}.#{GEM_MINOR_VERSION}#{GEM_PRERELEASE_VERSION}"
9
17
  end
data/lib/libddprof.rb CHANGED
@@ -3,21 +3,22 @@
3
3
  require_relative "libddprof/version"
4
4
 
5
5
  module Libddprof
6
- # Is this a no-op libddprof release without binaries?
7
- def self.no_binaries?
8
- available_binaries.empty?
6
+ # Does this libddprof release include any binaries?
7
+ def self.binaries?
8
+ available_binaries.any?
9
9
  end
10
10
 
11
+ # This should only be used for debugging/logging
11
12
  def self.available_binaries
12
- File.directory?(vendor_directory) ? Dir.children(vendor_directory) : []
13
+ File.directory?(vendor_directory) ? (Dir.entries(vendor_directory) - [".", ".."]) : []
13
14
  end
14
15
 
15
- def self.pkgconfig_folder
16
+ def self.pkgconfig_folder(pkgconfig_file_name = "ddprof_ffi_with_rpath.pc")
16
17
  current_platform = Gem::Platform.local.to_s
17
18
 
18
19
  return unless available_binaries.include?(current_platform)
19
20
 
20
- pkgconfig_file = Dir.glob("#{vendor_directory}/#{current_platform}/**/ddprof_ffi.pc").first
21
+ pkgconfig_file = Dir.glob("#{vendor_directory}/#{current_platform}/**/#{pkgconfig_file_name}").first
21
22
 
22
23
  return unless pkgconfig_file
23
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libddprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta2
4
+ version: 0.5.0.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-02 00:00:00.000000000 Z
11
+ date: 2022-03-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: libddprof contains implementation bits used by Datadog's ddtrace gem
14
14
  as part of its Continuous Profiler feature.
@@ -18,12 +18,6 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - ".rspec"
22
- - ".standard.yml"
23
- - README.md
24
- - Rakefile
25
- - docker-compose.yml
26
- - gems.rb
27
21
  - lib/libddprof.rb
28
22
  - lib/libddprof/version.rb
29
23
  homepage: https://docs.datadoghq.com/tracing/profiler/
@@ -49,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
43
  - !ruby/object:Gem::Version
50
44
  version: 1.3.1
51
45
  requirements: []
52
- rubygems_version: 3.3.3
46
+ rubygems_version: 3.3.7
53
47
  signing_key:
54
48
  specification_version: 4
55
49
  summary: Library of common code used by Datadog Continuous Profiler for Ruby
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.standard.yml DELETED
@@ -1,3 +0,0 @@
1
- # For available configuration options, see:
2
- # https://github.com/testdouble/standard
3
- ruby_version: 2.1
data/README.md DELETED
@@ -1,29 +0,0 @@
1
- # libddprof Ruby gem
2
-
3
- `libddprof` provides a shared library containing common code used in the implementation of Datadog's
4
- [Continuous Profilers](https://docs.datadoghq.com/tracing/profiler/).
5
-
6
- **NOTE**: If you're building a new profiler or want to contribute to Datadog's existing profilers, you've come to the
7
- right place!
8
- Otherwise, this is possibly not the droid you were looking for.
9
-
10
- ## Development
11
-
12
- Run `bundle exec rake` to run the tests and the style autofixer.
13
- You can also run `bundle exec pry` for an interactive prompt that will allow you to experiment.
14
-
15
- ## Releasing a new version to rubygems.org
16
-
17
- Note: No Ruby needed to run this! It all runs inside docker :)
18
-
19
- 1. [ ] Locate the new libddprof release on GitHub: <https://github.com/DataDog/libddprof/releases>
20
- 2. [ ] Update the `LIB_GITHUB_RELEASES` section of the <Rakefile> with the new version
21
- 3. [ ] Update the <lib/libddprof/version.rb> file with the `LIB_VERSION` and `VERSION` to use
22
- 4. [ ] Commit change, open PR, get it merged
23
- 5. [ ] Release by running `docker-compose run push_to_rubygems`.
24
- (When asked for rubygems credentials, check your local friendly 1Password.)
25
- 6. [ ] Verify that release shows up correctly on: <https://rubygems.org/gems/libddprof>
26
-
27
- ## Contributing
28
-
29
- See <../CONTRIBUTING.md>.
data/Rakefile DELETED
@@ -1,149 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
- require "standard/rake" unless RUBY_VERSION < "2.5"
6
-
7
- require "fileutils"
8
- require "http"
9
- require "pry"
10
- require "rubygems/package"
11
-
12
- RSpec::Core::RakeTask.new(:spec)
13
-
14
- LIB_GITHUB_RELEASES = {
15
- "0.2.0" => [
16
- {
17
- file: "libddprof-x86_64-unknown-linux-gnu.tar.gz",
18
- sha256: "cba0f24074d44781d7252b912faff50d330957e84a8f40a172a8138e81001f27",
19
- ruby_platform: "x86_64-linux"
20
- },
21
- {
22
- file: "libddprof-x86_64-alpine-linux-musl.tar.gz",
23
- sha256: "d519a6241d78260522624b8e79e98502510f11d5d9551f5f80fc1134e95fa146",
24
- ruby_platform: "x86_64-linux-musl"
25
- }
26
- ]
27
- # Add more versions here
28
- }
29
-
30
- task default: [
31
- :spec,
32
- (:'standard:fix' unless RUBY_VERSION < "2.5")
33
- ].compact
34
-
35
- desc "Download lib release from github"
36
- task :fetch do
37
- Helpers.each_github_release_variant do |file:, sha256:, target_directory:, target_file:, **_|
38
- target_url = "https://github.com/DataDog/libddprof/releases/download/v#{Libddprof::LIB_VERSION}/#{file}"
39
-
40
- if File.exist?(target_file)
41
- if Digest::SHA256.hexdigest(File.read(target_file)) == sha256
42
- puts "Found #{target_file} matching the expected sha256, skipping download"
43
- next
44
- else
45
- puts "Found #{target_file} BUT IT DID NOT MATCH THE EXPECTED sha256, skipping download"
46
- end
47
- end
48
-
49
- puts "Going to download #{target_url} into #{target_file}"
50
-
51
- File.open(target_file, "wb") do |file|
52
- HTTP.follow.get(target_url).body.each { |chunk| file.write(chunk) }
53
- end
54
-
55
- if Digest::SHA256.hexdigest(File.read(target_file)) == sha256
56
- puts "Success!"
57
- else
58
- raise "Downloaded file is corrupt, does not match expected sha256"
59
- end
60
- end
61
- end
62
-
63
- desc "Extract lib downloaded releases"
64
- task extract: [:fetch] do
65
- Helpers.each_github_release_variant do |target_directory:, target_file:, **_|
66
- puts "Extracting #{target_file}"
67
- File.open(target_file, "rb") do |file|
68
- Gem::Package.new("").extract_tar_gz(file, target_directory)
69
- end
70
- end
71
- end
72
-
73
- desc "Package lib downloaded releases as gems"
74
- task package: [:spec, :'standard:fix', :extract] do
75
- gemspec = eval(File.read("libddprof.gemspec"), nil, "libddprof.gemspec") # standard:disable Security/Eval
76
- FileUtils.mkdir_p("pkg")
77
-
78
- Helpers.package_without_binaries(gemspec)
79
- Helpers.package_linux_x86_64(gemspec)
80
- end
81
-
82
- desc "Release all packaged gems"
83
- task push_to_rubygems: [
84
- :package,
85
- :'release:guard_clean'
86
- ] do
87
- system("gem signout") # make sure there are no existing credentials in use
88
-
89
- system("gem push pkg/libddprof-#{Libddprof::VERSION}.gem")
90
- system("gem push pkg/libddprof-#{Libddprof::VERSION}-x86_64-linux.gem")
91
-
92
- system("gem signout") # leave no credentials behind
93
- end
94
-
95
- module Helpers
96
- def self.each_github_release_variant(version: Libddprof::LIB_VERSION)
97
- LIB_GITHUB_RELEASES.fetch(version).each do |variant|
98
- file = variant.fetch(:file)
99
- sha256 = variant.fetch(:sha256)
100
- ruby_platform = variant.fetch(:ruby_platform)
101
-
102
- # These two are so common that we just centralize them here
103
- target_directory = "vendor/libddprof-#{version}/#{ruby_platform}"
104
- target_file = "#{target_directory}/#{file}"
105
-
106
- FileUtils.mkdir_p(target_directory)
107
-
108
- yield(file: file, sha256: sha256, ruby_platform: ruby_platform, target_directory: target_directory, target_file: target_file)
109
- end
110
- end
111
-
112
- def self.package_without_binaries(gemspec)
113
- target_gemspec = gemspec.dup
114
-
115
- puts "Building a variant without binaries including:"
116
- pp target_gemspec.files
117
-
118
- package = Gem::Package.build(target_gemspec)
119
- FileUtils.mv(package, "pkg")
120
- puts("-" * 80)
121
- end
122
-
123
- def self.package_linux_x86_64(gemspec)
124
- # We include both glibc and musl variants in the same binary gem to avoid the issues
125
- # documented in https://github.com/rubygems/rubygems/issues/3174
126
- target_gemspec = gemspec.dup
127
- target_gemspec.files += files_for("x86_64-linux", "x86_64-linux-musl")
128
- target_gemspec.platform = "x86_64-linux"
129
-
130
- puts "Building for x86_64-linux including: (this can take a while)"
131
- pp target_gemspec.files
132
-
133
- package = Gem::Package.build(target_gemspec)
134
- FileUtils.mv(package, "pkg")
135
- puts("-" * 80)
136
- end
137
-
138
- def self.files_for(*included_platforms, version: Libddprof::LIB_VERSION)
139
- files = []
140
-
141
- each_github_release_variant(version: version) do |ruby_platform:, target_directory:, target_file:, **_|
142
- next unless included_platforms.include?(ruby_platform)
143
-
144
- files += Dir.glob("#{target_directory}/**/*").select { |path| File.file?(path) } - [target_file]
145
- end
146
-
147
- files
148
- end
149
- end
data/docker-compose.yml DELETED
@@ -1,14 +0,0 @@
1
- version: '3.2'
2
- services:
3
- push_to_rubygems:
4
- image: ruby:3.1
5
- platform: linux/x86_64
6
- stdin_open: true
7
- tty: true
8
- command: bash -c 'cd /libddprof/ruby && bundle install && bundle exec rake push_to_rubygems'
9
- volumes:
10
- - ..:/libddprof
11
- - bundle-3.1:/usr/local/bundle
12
-
13
- volumes:
14
- bundle-3.1:
data/gems.rb DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in libddprof.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.10"
10
- gem "standard", "~> 1.3" unless RUBY_VERSION < "2.5"
11
- gem "http", "~> 5.0"
12
- gem "pry"
13
- gem "pry-byebug"