Skip to content

Commit

Permalink
Merge branch 'master' into ivoanjo/prof-6447-improve-mysql2-issue-det…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
ivoanjo authored Apr 12, 2023
2 parents c44e9a7 + ba10daa commit 2699ed1
Show file tree
Hide file tree
Showing 594 changed files with 2,199 additions and 1,506 deletions.
6 changes: 4 additions & 2 deletions .gitlab/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ variables:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: always
- when: manual

# If you have a problem with Gitlab cache, see Troubleshooting section in Benchmarking Platform docs
image: $GITLAB_BENCHMARKS_CI_IMAGE

script:
- export ARTIFACTS_DIR="$(pwd)/reports" && (mkdir "${ARTIFACTS_DIR}" || :)
- export DD_API_KEY=$(aws ssm get-parameter --region us-east-1 --name ci.dd-trace-rb.dd_api_key --with-decryption --query "Parameter.Value" --out text)
Expand All @@ -34,6 +32,10 @@ variables:
FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "true"
DD_RELENV_DDTRACE_COMMIT_ID: $CI_COMMIT_SHORT_SHA
K6_RUN_ID_PREFIX: ci_rb
# Workaround: Currently we're not running the benchmarks on every PR, but GitHub still shows them as pending.
# By marking the benchmarks as allow_failure, this should go away. (This workaround should be removed once the
# benchmarks get changed to run on every PR)
allow_failure: true

baseline-benchmarks:
extends: .benchmarks
Expand Down
614 changes: 0 additions & 614 deletions .rubocop_todo.yml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,6 @@ target :ddtrace do
library 'base64'
library 'digest'

# TODO: gem 'libddwaf'

repo_path 'vendor/rbs'
library 'ffi'
library 'jruby'
Expand All @@ -659,4 +657,7 @@ target :ddtrace do
library 'google-protobuf'
library 'protobuf-cucumber'
library 'mysql2'

# TODO: gem 'libddwaf'
library 'libddwaf'
end
2 changes: 2 additions & 0 deletions lib/datadog/appsec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'appsec/configuration'
require_relative 'appsec/extensions'

Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/assets.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'pathname'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/autoload.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

if %w[1 true].include?((ENV['DD_APPSEC_ENABLED'] || '').downcase)
begin
require_relative 'contrib/auto_instrument'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'configuration/settings'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/auto_instrument.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../core/configuration/base'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/patcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rack/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../configuration/settings'
require_relative '../ext'

Expand Down
6 changes: 4 additions & 2 deletions lib/datadog/appsec/contrib/rack/ext.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
module Rack
# Rack integration constants
module Ext
APP = 'rack'.freeze
ENV_ENABLED = 'DD_TRACE_RACK_ENABLED'.freeze # TODO: DD_APPSEC?
APP = 'rack'
ENV_ENABLED = 'DD_TRACE_RACK_ENABLED' # TODO: DD_APPSEC?
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rack/gateway/watcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../instrumentation/gateway'
require_relative '../../../reactive/operation'
require_relative '../reactive/request'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rack/integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../integration'

require_relative 'configuration/settings'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rack/patcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../patcher'
require_relative '../../monitor'
require_relative 'gateway/watcher'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rack/request_middleware.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'json'

require_relative 'gateway/request'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../configuration/settings'
require_relative '../ext'

Expand Down
6 changes: 4 additions & 2 deletions lib/datadog/appsec/contrib/rails/ext.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
module Rails
# Rack integration constants
module Ext
APP = 'rails'.freeze
ENV_ENABLED = 'DD_TRACE_RAILS_ENABLED'.freeze
APP = 'rails'
ENV_ENABLED = 'DD_TRACE_RAILS_ENABLED'
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/framework.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/gateway/watcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../instrumentation/gateway'
require_relative '../../../reactive/operation'
require_relative '../reactive/action'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../integration'

require_relative 'configuration/settings'
Expand Down
4 changes: 3 additions & 1 deletion lib/datadog/appsec/contrib/rails/patcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../core/utils/only_once'

require_relative '../patcher'
Expand Down Expand Up @@ -131,7 +133,7 @@ def method_missing(_op, *args) # rubocop:disable Style/MissingRespondToMissing
end

def inspect_middlewares(app)
Datadog.logger.debug { 'Rails middlewares: ' << app.middleware.map(&:inspect).inspect }
Datadog.logger.debug { "Rails middlewares: #{app.middleware.map(&:inspect).inspect}" }
end

def patch_after_intialize
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/request.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/rails/request_middleware.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../configuration/settings'
require_relative '../ext'

Expand Down
6 changes: 4 additions & 2 deletions lib/datadog/appsec/contrib/sinatra/ext.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
module Sinatra
# Sinatra integration constants
module Ext
APP = 'sinatra'.freeze
ENV_ENABLED = 'DD_TRACE_SINATRA_ENABLED'.freeze
APP = 'sinatra'
ENV_ENABLED = 'DD_TRACE_SINATRA_ENABLED'
ROUTE_INTERRUPT = :datadog_appsec_contrib_sinatra_route_interrupt
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/framework.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../instrumentation/gateway'
require_relative '../../../reactive/operation'
require_relative '../../rack/reactive/request_body'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../integration'

require_relative 'configuration/settings'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/patcher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../tracing/contrib/rack/middlewares'

require_relative '../patcher'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/contrib/sinatra/request_middleware.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Contrib
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/event.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'json'

require_relative 'rate_limiter'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/extensions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'configuration'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/rate_limiter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
# Simple per-thread rate limiter
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/response.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'assets'
require_relative 'utils/http/media_range'

Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/utils.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
# Utilities for AppSec
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/appsec/utils/http.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Utils
Expand Down
6 changes: 4 additions & 2 deletions lib/datadog/appsec/utils/http/media_range.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'media_type'

module Datadog
Expand All @@ -9,7 +11,7 @@ class MediaRange
class ParseError < ::StandardError
end

WILDCARD = '*'.freeze
WILDCARD = '*'
WILDCARD_RE = ::Regexp.escape(WILDCARD)

# See: https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6
Expand Down Expand Up @@ -184,7 +186,7 @@ def wildcard?(field = nil)
end

def to_s
s = "#{@type}/#{@subtype}"
s = "#{@type}/#{@subtype}".dup

s << ';' << @parameters.map { |k, v| "#{k}=#{v}" }.join(';') if @parameters.count > 0
s << ";q=#{@quality}" if @quality < 1.0
Expand Down
6 changes: 4 additions & 2 deletions lib/datadog/appsec/utils/http/media_type.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Datadog
module AppSec
module Utils
Expand All @@ -11,7 +13,7 @@ class MediaType
class ParseError < ::StandardError
end

WILDCARD = '*'.freeze
WILDCARD = '*'

# See: https://www.rfc-editor.org/rfc/rfc7230#section-3.2.6
TOKEN_RE = /[-#$%&'*+.^_`|~A-Za-z0-9]+/.freeze
Expand Down Expand Up @@ -72,7 +74,7 @@ def initialize(media_type)
end

def to_s
s = "#{@type}/#{@subtype}"
s = "#{@type}/#{@subtype}".dup

s << ';' << @parameters.map { |k, v| "#{k}=#{v}" }.join(';') if @parameters.count > 0

Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/ci.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'core'
require_relative 'tracing'
require_relative 'tracing/contrib'
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/ci/configuration/components.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../flush'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/ci/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../ext/settings'

module Datadog
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/ci/contrib/cucumber/configuration/settings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../../../tracing/contrib/configuration/settings'
require_relative '../ext'

Expand Down
18 changes: 10 additions & 8 deletions lib/datadog/ci/contrib/cucumber/ext.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# frozen_string_literal: true

module Datadog
module CI
module Contrib
module Cucumber
# Cucumber integration constants
# TODO: mark as `@public_api` when GA, to protect from resource and tag name changes.
module Ext
APP = 'cucumber'.freeze
ENV_ENABLED = 'DD_TRACE_CUCUMBER_ENABLED'.freeze
ENV_OPERATION_NAME = 'DD_TRACE_CUCUMBER_OPERATION_NAME'.freeze
FRAMEWORK = 'cucumber'.freeze
OPERATION_NAME = 'cucumber.test'.freeze
SERVICE_NAME = 'cucumber'.freeze
STEP_SPAN_TYPE = 'step'.freeze
TEST_TYPE = 'test'.freeze
APP = 'cucumber'
ENV_ENABLED = 'DD_TRACE_CUCUMBER_ENABLED'
ENV_OPERATION_NAME = 'DD_TRACE_CUCUMBER_OPERATION_NAME'
FRAMEWORK = 'cucumber'
OPERATION_NAME = 'cucumber.test'
SERVICE_NAME = 'cucumber'
STEP_SPAN_TYPE = 'step'
TEST_TYPE = 'test'
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/ci/contrib/cucumber/formatter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test'
require_relative '../../ext/app_types'
require_relative '../../ext/environment'
Expand Down
Loading

0 comments on commit 2699ed1

Please sign in to comment.