Skip to content

Commit

Permalink
Merge branch 'master' into pr-3042
Browse files Browse the repository at this point in the history
* master: (161 commits)
  Bump to version 2.9.0 (#4293)
  Increase type checking coverage (#4290)
  DEBUG-3329 rename datadog/di/init to datadog/di/preload (#4288)
  update supported versions workflow (#4289)
  DEBUG-3182 DI railtie (#4272)
  DEBUG-3328 report DI status in environment logger summary (#4285)
  Move out ostruct gem from test group for Ruby 3.5
  DEBUG-3316 verify code tracking works in forked processes (#4284)
  Fix rebase issue in Rack::RequestMiddleware
  Improve code style in AppSec rack middlewares
  Improve variable naming in Rack::RequestBodyMiddleware
  Improve variable naming in Rack::RequestMiddleware
  Simplify Rack::RequestMiddleware
  Switch AppSec rack blocking to throw
  Extract to .gitlab/scripts
  Implement polling vaccine
  Update RBS signatures
  Add new RSpec negate matcher not_change
  Replace direct AppSec::Processor::Context calls
  Change AppSec::Context exposed interface
  ...
  • Loading branch information
p committed Jan 15, 2025
2 parents fb677a6 + fe9272b commit 677a716
Show file tree
Hide file tree
Showing 1,402 changed files with 14,534 additions and 33,568 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ save_bundle_checksum: &save_bundle_checksum
command: |
if [ "$CI_BUNDLE_CACHE_HIT" != 1 ]; then
# Recompute gemfiles/*.lock checksum, as those files might have changed
cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
cat Gemfile Gemfile.lock jruby-*.gemfile ruby-*.gemfile gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
fi
cp .circleci/bundle_checksum /usr/local/bundle/bundle_checksum
step_bundle_install: &step_bundle_install
Expand Down Expand Up @@ -96,7 +96,7 @@ step_compute_bundle_checksum: &step_compute_bundle_checksum
# updating the gemset lock files produces extremely large commits.
command: |
bundle lock # Create Gemfile.lock
cat Gemfile Gemfile.lock Appraisals gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
cat Gemfile Gemfile.lock jruby-*.gemfile ruby-*.gemfile gemfiles/*.gemfile gemfiles/*.gemfile.lock | md5sum > .circleci/bundle_checksum
step_get_test_agent_trace_check_results: &step_get_test_agent_trace_check_results
run:
name: Get APM Test Agent Trace Check Results
Expand Down
31 changes: 0 additions & 31 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "Bug Report (Low Priority)"
description: "Create a public Bug Report. Note that these may not be addressed as quickly as the helpdesk and that looking up account information will be difficult."
title: "[BUG]: "
labels: community, bug
body:
- type: input
attributes:
label: Tracer Version(s)
description: "Version(s) of the tracer affected by this bug"
placeholder: "1.23.4, 2.8.0"
validations:
required: true

- type: input
attributes:
label: Ruby Version(s)
description: "Version(s) of Ruby (`ruby --version`) that you've encountered this bug with"
placeholder: "ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]"
validations:
required: true

- type: input
attributes:
label: Relevent Library and Version(s)
description: "The name of a library and version(s) that you've encountered this bug with"
placeholder: "mysql 2.9.1"
validations:
required: false

- type: textarea
attributes:
label: Bug Report
description: Please add a clear and concise description of the bug here
validations:
required: true

- type: textarea
attributes:
label: Reproduction Code
description: Please add code here to help us reproduce the problem
validations:
required: false

- type: textarea
attributes:
label: Configuration Block
description: How is your tracer configured, e.g. `Datadog.configure ...`
validations:
required: false

- type: textarea
attributes:
label: Error Logs
description: "Please provide any error logs from the tracer (`DD_TRACE_DEBUG=true` can help)"
validations:
required: false

- type: input
attributes:
label: Operating System
description: "Provide your operating system and version (e.g. `uname -a`)"
placeholder: Darwin Kernel Version 23.6.0
validations:
required: false

- type: textarea
attributes:
label: How does Datadog help you?
description: "Optionally, tell us why and how you're using datadog, and what your overall experience with it is!"
validations:
required: false
11 changes: 7 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: ℹ️ Datadog Support
url: https://www.datadoghq.com/support/
about: Get help from the Datadog support team
- name: Bug Report (High Priority)
url: https://help.datadoghq.com/hc/en-us/requests/new?tf_1260824651490=pt_product_type:apm&tf_1900004146284=pt_apm_language:ruby
about: Create an expedited Bug Report via the helpdesk (no login required). This will allow us to look up your account and allows you to provide additional information in private.
- name: Feature Request (High Priority)
url: https://help.datadoghq.com/hc/en-us/requests/new?tf_1260824651490=pt_product_type:apm&tf_1900004146284=pt_apm_language:ruby&tf_1260825272270=pt_apm_category_feature_request
about: Create an expedited Feature Request via the helpdesk (no login required). This helps with prioritization and allows you to provide additional information in private.
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Feature Request (Low Priority)
description: Create a public Feature Request. Note that these may not be addressed as quickly as the helpdesk and that looking up account information will be difficult.
title: "[FEATURE]: "
labels: community, feature-request
body:
- type: input
attributes:
label: Gem Name
description: "If your feature request is to add instrumentation support for a Ruby gem please provide the gem name here"
placeholder: mysql
validations:
required: false

- type: input
attributes:
label: Gem Version(s)
description: "Please provide the version of the above gem here"
placeholder: 2.9.1
validations:
required: false

- type: textarea
attributes:
label: Describe the goal of the feature
description: A clear and concise goal of what you want to happen.
validations:
required: true

- type: textarea
attributes:
label: Is your feature request related to a problem?
description: |
Please add a clear and concise description of your problem.
E.g. I'm unable to instrument my database queries...
validations:
required: false

- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered
validations:
required: false

- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here
validations:
required: false

- type: textarea
attributes:
label: How does Datadog help you?
description: "Optionally, tell us why and how you're using datadog, and what your overall experience with it is!"
validations:
required: false
162 changes: 162 additions & 0 deletions .github/scripts/find_gem_version_bounds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
require 'pathname'
require 'rubygems'
require 'json'
require 'bundler'

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'datadog'

class GemfileProcessor
SPECIAL_CASES = {
"opensearch" => "OpenSearch" # special case because opensearch = OpenSearch not Opensearch
}.freeze
EXCLUDED_INTEGRATIONS = ["configuration", "propagation", "utils"].freeze

def initialize(directory: 'gemfiles/', contrib_dir: 'lib/datadog/tracing/contrib/')
@directory = directory
@contrib_dir = contrib_dir
@min_gems = { 'ruby' => {}, 'jruby' => {} }
@max_gems = { 'ruby' => {}, 'jruby' => {} }
@integration_json_mapping = {}
end

def process
parse_gemfiles
process_integrations
include_hardcoded_versions
write_output
end

private


def parse_gemfiles(directory = 'gemfiles/')
gemfiles = Dir.glob(File.join(@directory, '*'))
gemfiles.each do |gemfile_name|
runtime = File.basename(gemfile_name).split('_').first # ruby or jruby
next unless %w[ruby jruby].include?(runtime)
# parse the gemfile
if gemfile_name.end_with?(".gemfile")
process_gemfile(gemfile_name, runtime)
elsif gemfile_name.end_with?('.gemfile.lock')
process_lockfile(gemfile_name, runtime)
end
end

end

def process_gemfile(gemfile_name, runtime)
begin
definition = Bundler::Definition.build(gemfile_name, nil, nil)
definition.dependencies.each do |dependency|
gem_name = dependency.name
version = dependency.requirement.to_s
unspecified = version.strip == '' || version == ">= 0"
if unspecified
puts "#{gem_name} uses latest"
end
update_gem_versions(runtime, gem_name, version, unspecified)
end
rescue Bundler::GemfileError => e
puts "Error reading Gemfile: #{e.message}"
end
end

def process_lockfile(gemfile_name, runtime)
lockfile_contents = File.read(gemfile_name)
parser = Bundler::LockfileParser.new(lockfile_contents)
parser.specs.each do |spec|
gem_name = spec.name
version = spec.version.to_s
update_gem_versions(runtime, gem_name, version, false)
end
end

def update_gem_versions(runtime, gem_name, version, unspecified)
return unless version_valid?(version, unspecified)

gem_version = Gem::Version.new(version) unless unspecified
# Update minimum gems
if not unspecified
if @min_gems[runtime][gem_name].nil? || gem_version < Gem::Version.new(@min_gems[runtime][gem_name])
@min_gems[runtime][gem_name] = version
end
end

# Update maximum gems
if unspecified
puts "Setting gem #{gem_name} to infinity"
@max_gems[runtime][gem_name] = Float::INFINITY
else
if @max_gems[runtime][gem_name].nil? || (@max_gems[runtime][gem_name] != Float::INFINITY && gem_version > Gem::Version.new(@max_gems[runtime][gem_name]))
@max_gems[runtime][gem_name] = version
end
end
end

# Helper: Validate the version format
def version_valid?(version, unspecified)
return true if unspecified
return false if version.nil? || version.strip.empty?
Gem::Version.new(version)
true
rescue ArgumentError
false
end


def process_integrations
integrations = Datadog::Tracing::Contrib::REGISTRY.map(&:name).map(&:to_s)
integrations.each do |integration|
next if EXCLUDED_INTEGRATIONS.include?(integration)

integration_name = resolve_integration_name(integration)

@integration_json_mapping[integration] = [
@min_gems['ruby'][integration_name],
@max_gems['ruby'][integration_name],
@min_gems['jruby'][integration_name],
@max_gems['jruby'][integration_name]
]
end
end

def include_hardcoded_versions
# `httpx` is maintained externally
@integration_json_mapping['httpx'] = [
'0.11', # Min version Ruby
nil, # Max version Ruby
'0.11', # Min version JRuby
nil # Max version JRuby
]

# `makara` is part of `activerecord`
@integration_json_mapping['makara'] = [
'0.3.5', # Min version Ruby
nil, # Max version Ruby
'0.3.5', # Min version JRuby
nil # Max version JRuby
]
end

def resolve_integration_name(integration)
mod_name = SPECIAL_CASES[integration] || integration.split('_').map(&:capitalize).join
module_name = "Datadog::Tracing::Contrib::#{mod_name}"
integration_module = Object.const_get(module_name)::Integration
integration_module.respond_to?(:gem_name) ? integration_module.gem_name : integration
rescue NameError, NoMethodError
puts "Fallback for #{integration}: module or gem_name not found."
integration
end

def write_output
@integration_json_mapping = @integration_json_mapping.sort.to_h
@integration_json_mapping.each do |integration, versions|
versions.map! { |v| v == Float::INFINITY ? 'infinity' : v }
end
File.write("gem_output.json", JSON.pretty_generate(@integration_json_mapping))
end
end

GemfileProcessor.new.process
Loading

0 comments on commit 677a716

Please sign in to comment.