Skip to content

Commit

Permalink
Merge branch 'main' into add-deprecation-warnings-ruby-3
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle authored Nov 25, 2024
2 parents 0ecd3f5 + 0e5dd05 commit 9d09a5e
Show file tree
Hide file tree
Showing 69 changed files with 176 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

# equivalent cli: markdownlint-cli2 "**/*.md" "#**/CHANGELOG.md" --config .markdownlint.json
- name: "Markdown Lint Check"
uses: DavidAnson/markdownlint-cli2-action@v17
uses: DavidAnson/markdownlint-cli2-action@v18
with:
fix: false
globs: |
Expand Down
87 changes: 44 additions & 43 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,54 @@
{
"helpers/mysql": "0.1.1",
"helpers/sql_obfuscation": "0.1.1",
"instrumentation/base": "0.22.4",
"instrumentation/graphql": "0.28.2",
"helpers/sql-obfuscation": "0.2.0",
"instrumentation/action_mailer": "0.2.0",
"instrumentation/action_pack": "0.10.0",
"instrumentation/action_view": "0.7.3",
"instrumentation/active_job": "0.7.8",
"instrumentation/active_model_serializers": "0.20.2",
"instrumentation/active_record": "0.8.1",
"instrumentation/active_support": "0.6.0",
"instrumentation/all": "0.69.0",
"instrumentation/aws_lambda": "0.1.1",
"instrumentation/aws_sdk": "0.7.0",
"instrumentation/base": "0.22.6",
"instrumentation/bunny": "0.21.4",
"instrumentation/concurrent_ruby": "0.21.4",
"instrumentation/dalli": "0.25.4",
"instrumentation/delayed_job": "0.22.4",
"instrumentation/ethon": "0.21.8",
"instrumentation/excon": "0.22.4",
"instrumentation/faraday": "0.24.6",
"instrumentation/grape": "0.2.0",
"instrumentation/graphql": "0.28.4",
"instrumentation/gruf": "0.2.1",
"instrumentation/racecar": "0.3.2",
"instrumentation/rake": "0.2.2",
"instrumentation/rdkafka": "0.4.6",
"instrumentation/trilogy": "0.59.3",
"instrumentation/active_support": "0.5.1",
"instrumentation/action_mailer": "0.1.0",
"instrumentation/action_view": "0.7.0",
"instrumentation/action_pack": "0.9.0",
"instrumentation/active_job": "0.7.1",
"instrumentation/resque": "0.5.2",
"instrumentation/bunny": "0.21.3",
"instrumentation/active_record": "0.7.2",
"instrumentation/aws_sdk": "0.5.2",
"instrumentation/aws_lambda": "0.1.0",
"instrumentation/lmdb": "0.22.2",
"instrumentation/http": "0.23.3",
"instrumentation/http_client": "0.22.6",
"instrumentation/http": "0.23.4",
"instrumentation/http_client": "0.22.7",
"instrumentation/httpx": "0.1.2",
"instrumentation/koala": "0.20.5",
"instrumentation/active_model_serializers": "0.20.1",
"instrumentation/concurrent_ruby": "0.21.3",
"instrumentation/dalli": "0.25.3",
"instrumentation/delayed_job": "0.22.2",
"instrumentation/ethon": "0.21.7",
"instrumentation/excon": "0.22.3",
"instrumentation/faraday": "0.24.4",
"instrumentation/mongo": "0.22.3",
"instrumentation/mysql2": "0.27.1",
"instrumentation/net_http": "0.22.6",
"instrumentation/pg": "0.27.3",
"instrumentation/que": "0.8.1",
"instrumentation/rack": "0.24.5",
"instrumentation/rails": "0.30.2",
"instrumentation/grape": "0.1.8",
"instrumentation/redis": "0.25.6",
"instrumentation/restclient": "0.22.6",
"instrumentation/lmdb": "0.22.3",
"instrumentation/mongo": "0.22.4",
"instrumentation/mysql2": "0.28.0",
"instrumentation/net_http": "0.22.7",
"instrumentation/pg": "0.29.0",
"instrumentation/que": "0.8.4",
"instrumentation/racecar": "0.3.4",
"instrumentation/rack": "0.25.0",
"instrumentation/rails": "0.33.0",
"instrumentation/rake": "0.2.2",
"instrumentation/rdkafka": "0.4.8",
"instrumentation/redis": "0.25.7",
"instrumentation/resque": "0.5.2",
"instrumentation/restclient": "0.22.7",
"instrumentation/rspec": "0.3.3",
"instrumentation/ruby_kafka": "0.21.1",
"instrumentation/sidekiq": "0.25.5",
"instrumentation/sinatra": "0.23.5",
"instrumentation/all": "0.56.0",
"instrumentation/ruby_kafka": "0.21.3",
"instrumentation/sidekiq": "0.25.7",
"instrumentation/sinatra": "0.24.1",
"instrumentation/trilogy": "0.60.0",
"processor/baggage": "0.2.0",
"propagator/ottrace": "0.21.2",
"propagator/xray": "0.22.1",
"propagator/ottrace": "0.21.3",
"propagator/vitess": "0.1.0",
"propagator/xray": "0.22.2",
"resources/azure": "0.1.0",
"resources/container": "0.1.1",
"resources/google_cloud_platform": "0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ source 'https://rubygems.org'

gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.68.0'
gem 'rubocop-performance', '~> 1.21.0'
gem 'rubocop-performance', '~> 1.23.0'
36 changes: 36 additions & 0 deletions bin/sync-release-please
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env ruby

require 'json'

# Function to extract VERSION constant from a file
def extract_version(file_path)
version = nil
File.open(file_path, 'r') do |file|
file.each_line do |line|
if line =~ /VERSION\s*=\s*['"]([^'"]+)['"]/
version = $1
break
end
end
end
version
end

# Hash to store the directory names and their versions
versions = {}

# Find all version.rb files
Dir.glob('**/version.rb').each do |file_path|
# Extract the top 2 level directories
top_dirs = file_path.split('/')[0..1].join('/')
# Extract the version
version = extract_version(file_path)
# Store in the hash
versions[top_dirs] = version if version
end

# Write the hash to a JSON file
File.open('.release-please-manifest.json', 'w') do |file|
file.write(JSON.pretty_generate(versions))
file.write("\n")
end
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.5"

x-shared-config:
base: &base
command: /bin/bash
Expand Down
2 changes: 1 addition & 1 deletion helpers/mysql/opentelemetry-helpers-mysql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.22.0'
spec.add_development_dependency 'yard', '~> 0.9'
spec.add_development_dependency 'yard-doctest', '~> 0.1.6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'yard', '~> 0.9'
spec.add_development_dependency 'yard-doctest', '~> 0.1.6'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rails', '>= 6.1'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rspec-mocks'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec-mocks'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'minitest', '~> 5.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry-byebug' unless RUBY_ENGINE == 'jruby'
spec.add_development_dependency 'rspec-mocks'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry-byebug' unless RUBY_ENGINE == 'jruby'
spec.add_development_dependency 'rspec-mocks'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'webmock', '~> 3.24.0'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.22.0'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1'
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1'
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1'
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rspec-mocks'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'sqlite3'
spec.add_development_dependency 'webmock', '~> 3.24.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module Easy
end
HTTP_METHODS_TO_SPAN_NAMES = Hash.new { |h, k| h[k] = "HTTP #{k}" }

# Constant for the HTTP status range
HTTP_STATUS_SUCCESS_RANGE = (100..399)

def http_request(url, action_name, options = {})
@otel_method = ACTION_NAMES_TO_HTTP_METHODS[action_name]
super
Expand All @@ -42,7 +45,7 @@ def complete
@otel_span.status = OpenTelemetry::Trace::Status.error("Request has failed: #{message}")
else
@otel_span.set_attribute('http.status_code', response_code)
@otel_span.status = OpenTelemetry::Trace::Status.error unless (100..399).cover?(response_code.to_i)
@otel_span.status = OpenTelemetry::Trace::Status.error unless HTTP_STATUS_SUCCESS_RANGE.cover?(response_code.to_i)
end
ensure
@otel_span&.finish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-sdk', '~> 1.1'
spec.add_development_dependency 'opentelemetry-test-helpers', '~> 0.3'
spec.add_development_dependency 'rubocop', '~> 1.68.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.22.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.23.0'
spec.add_development_dependency 'simplecov', '~> 0.17.1'
spec.add_development_dependency 'yard', '~> 0.9'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ class TracerMiddleware < ::Excon::Middleware::Base
hash[uppercase_method] ||= "HTTP #{uppercase_method}"
end.freeze

# Constant for the HTTP status range
HTTP_STATUS_SUCCESS_RANGE = (100..399)

def request_call(datum)
return @stack.request_call(datum) if untraced?(datum)

http_method = HTTP_METHODS_TO_UPPERCASE[datum[:method]]

attributes = {
OpenTelemetry::SemanticConventions::Trace::HTTP_HOST => datum[:host],
OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => http_method,
Expand All @@ -35,19 +37,14 @@ def request_call(datum)
OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => datum[:hostname],
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => datum[:port]
}

peer_service = Excon::Instrumentation.instance.config[:peer_service]
attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = peer_service if peer_service
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)

span = tracer.start_span(HTTP_METHODS_TO_SPAN_NAMES[http_method], attributes: attributes, kind: :client)
ctx = OpenTelemetry::Trace.context_with_span(span)

datum[:otel_span] = span
datum[:otel_token] = OpenTelemetry::Context.attach(ctx)

OpenTelemetry.propagation.inject(datum[:headers])

@stack.request_call(datum)
end

Expand All @@ -68,7 +65,6 @@ def self.around_default_stack
# If the default stack contains a version of the trace middleware already...
existing_trace_middleware = default_stack.find { |m| m <= TracerMiddleware }
default_stack.delete(existing_trace_middleware) if existing_trace_middleware

# Inject after the ResponseParser middleware
response_middleware_index = default_stack.index(::Excon::Middleware::ResponseParser).to_i
default_stack.insert(response_middleware_index + 1, self)
Expand All @@ -84,7 +80,7 @@ def handle_response(datum)
if datum.key?(:response)
response = datum[:response]
span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, response[:status])
span.status = OpenTelemetry::Trace::Status.error unless (100..399).cover?(response[:status].to_i)
span.status = OpenTelemetry::Trace::Status.error unless HTTP_STATUS_SUCCESS_RANGE.cover?(response[:status].to_i)
end

if datum.key?(:error)
Expand All @@ -93,7 +89,6 @@ def handle_response(datum)
end

span.finish

OpenTelemetry::Context.detach(datum.delete(:otel_token)) if datum.include?(:otel_token)
end
rescue StandardError => e
Expand Down
Loading

0 comments on commit 9d09a5e

Please sign in to comment.