Skip to content

Commit

Permalink
feat!: Remove support for EoL Ruby 2.7 (#1459)
Browse files Browse the repository at this point in the history
* feat!: Remove EoL Ruby 2.7 from ci

* chore: appease the cops

* fix: let test var
  • Loading branch information
robertlaurin committed Jun 1, 2023
1 parent 886cb59 commit 20c640d
Show file tree
Hide file tree
Showing 63 changed files with 113 additions and 119 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ jobs:
with:
gem: "${{ matrix.gem }}"
ruby: "3.0"
- name: "Test Ruby 2.7"
if: "${{ matrix.os == 'ubuntu-latest' }}"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "2.7"
yard: true
rubocop: true
build: true
Expand Down Expand Up @@ -111,12 +105,6 @@ jobs:
with:
gem: "${{ matrix.gem }}"
ruby: "3.0"
- name: "Test Ruby 2.7"
if: "${{ matrix.os == 'ubuntu-latest' }}"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "2.7"
yard: true
rubocop: true
build: true
Expand Down Expand Up @@ -184,12 +172,6 @@ jobs:
with:
gem: "${{ matrix.gem }}"
ruby: "3.0"
- name: "Test Ruby 2.7"
if: "${{ matrix.os == 'ubuntu-latest' }}"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "2.7"
yard: true
rubocop: true
build: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-hook-on-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
release-process-request:
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-hook-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
release-update-open-requests:
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-perform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
release-perform:
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release-request:
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
release-retry:
if: ${{ github.repository == 'open-telemetry/opentelemetry-ruby' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
release-process-request:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .toys/release/.data/templates/release-hook-on-open.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
release-check-commits:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .toys/release/.data/templates/release-hook-on-push.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
release-update-open-requests:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .toys/release/.data/templates/release-perform.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
release-perform:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .toys/release/.data/templates/release-request.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release-request:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion .toys/release/.data/templates/release-retry.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
release-retry:
if: ${{ github.repository == '<%= @settings.repo_path %>' }}
env:
ruby_version: "2.7"
ruby_version: "3.0"
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion api/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: "2.6.0"
TargetRubyVersion: "3.0"

Lint/UnusedMethodArgument:
Enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TraceParent
MAX_VERSION = 254
private_constant :MAX_VERSION

REGEXP = /^(?<version>[A-Fa-f0-9]{2})-(?<trace_id>[A-Fa-f0-9]{32})-(?<span_id>[A-Fa-f0-9]{16})-(?<flags>[A-Fa-f0-9]{2})(?<ignored>-.*)?$/.freeze
REGEXP = /^(?<version>[A-Fa-f0-9]{2})-(?<trace_id>[A-Fa-f0-9]{32})-(?<span_id>[A-Fa-f0-9]{16})-(?<flags>[A-Fa-f0-9]{2})(?<ignored>-.*)?$/
private_constant :REGEXP

INVALID_TRACE_ID = OpenTelemetry::Trace::SpanContext::INVALID.hex_trace_id
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/trace/tracestate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create(hash)

MAX_MEMBER_COUNT = 32 # Defined by https://www.w3.org/TR/trace-context/
VALID_KEY = Regexp.union(%r(^[a-z][a-z0-9_\-*/]{,255}$), %r(^[a-z0-9][a-z0-9_\-*/]{,240}@[a-z][a-z0-9_\-*/]{,13}$)).freeze
VALID_VALUE = /^[ -~&&[^,=]]{,255}[!-~&&[^,=]]$/.freeze
VALID_VALUE = /^[ -~&&[^,=]]{,255}[!-~&&[^,=]]$/
private_constant(:MAX_MEMBER_COUNT, :VALID_KEY, :VALID_VALUE)

# @api private
Expand Down
2 changes: 1 addition & 1 deletion api/opentelemetry-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.0'

spec.add_development_dependency 'benchmark-ipsa', '~> 0.2.0'
spec.add_development_dependency 'bundler', '>= 1.17'
Expand Down
2 changes: 1 addition & 1 deletion common/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: '2.6.0'
TargetRubyVersion: '3.0'
NewCops: disable
SuggestExtensions: false

Expand Down
2 changes: 1 addition & 1 deletion common/opentelemetry-common.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'opentelemetry-api', '~> 1.0'

Expand Down
4 changes: 2 additions & 2 deletions exporter/jaeger/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: "2.6.0"
TargetRubyVersion: "3.0"
NewCops: disable
SuggestExtensions: false
Exclude:
Expand Down Expand Up @@ -39,4 +39,4 @@ Metrics/BlockLength:
Enabled: false
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-jaeger.rb"
- "lib/opentelemetry-exporter-jaeger.rb"
2 changes: 1 addition & 1 deletion exporter/jaeger/opentelemetry-exporter-jaeger.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'opentelemetry-api', '~> 1.1'
spec.add_dependency 'opentelemetry-common', '~> 0.19.6'
Expand Down
8 changes: 6 additions & 2 deletions exporter/otlp-common/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: "2.6.0"
TargetRubyVersion: "3.0"
Exclude:
- "lib/opentelemetry/proto/**/*"
- "vendor/**/*"
Expand All @@ -11,7 +11,11 @@ Metrics/AbcSize:
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Max: 21
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Naming/FileName:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def as_encoded_etsr(span_data)
#
# @return [Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest]
# returns an ETSR of the provided span data
def as_etsr(span_data) # rubocop:disable Metrics/MethodLength
def as_etsr(span_data)
Opentelemetry::Proto::Collector::Trace::V1::ExportTraceServiceRequest.new(
resource_spans: span_data
.group_by(&:resource)
Expand All @@ -70,7 +70,7 @@ def as_etsr(span_data) # rubocop:disable Metrics/MethodLength

private

def as_otlp_span(span_data) # rubocop:disable Metrics/MethodLength
def as_otlp_span(span_data)
Opentelemetry::Proto::Trace::V1::Span.new(
trace_id: span_data.trace_id,
span_id: span_data.span_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'google-protobuf', '~> 3.19'
spec.add_dependency 'googleapis-common-protos-types', '~> 1.3'
spec.add_dependency 'google-protobuf', '~> 3.19'
spec.add_dependency 'opentelemetry-api', '~> 1.1'

spec.add_development_dependency 'bundler', '>= 1.17'
Expand All @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry'
spec.add_development_dependency 'pry-byebug' unless RUBY_ENGINE == 'jruby'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rubocop', '~> 0.73.0'
spec.add_development_dependency 'rubocop', '~> 1.51.0'
spec.add_development_dependency 'simplecov', '~> 0.17'
spec.add_development_dependency 'webmock', '~> 3.7.6'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp-grpc/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: "2.5.0"
TargetRubyVersion: "3.0"

Lint/UnusedMethodArgument:
Enabled: false
Expand Down
4 changes: 2 additions & 2 deletions exporter/otlp-grpc/opentelemetry-exporter-otlp-grpc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.5.0'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'grpc'
spec.add_dependency 'opentelemetry-api', '~> 1.1'
Expand All @@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers'
spec.add_development_dependency 'pry-byebug' unless RUBY_ENGINE == 'jruby'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rubocop', '~> 0.73.0'
spec.add_development_dependency 'rubocop', '~> 1.51.0'
spec.add_development_dependency 'simplecov', '~> 0.17'
spec.add_development_dependency 'webmock', '~> 3.7.6'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
require 'test_helper'

describe OpenTelemetry::Exporter::OTLP::GRPC::TraceExporter do
SUCCESS = OpenTelemetry::SDK::Trace::Export::SUCCESS
FAILURE = OpenTelemetry::SDK::Trace::Export::FAILURE
let(:success) { OpenTelemetry::SDK::Trace::Export::SUCCESS }

describe '#exporter' do
it 'integrates with collector' do
skip unless ENV['TRACING_INTEGRATION_TEST']
span_data = OpenTelemetry::TestHelpers.create_span_data
exporter = OpenTelemetry::Exporter::OTLP::GRPC::TraceExporter.new(endpoint: 'http://localhost:4317')
result = exporter.export([span_data])
_(result).must_equal(SUCCESS)
_(result).must_equal(success)
end
end
end
6 changes: 5 additions & 1 deletion exporter/otlp-http/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: "2.6.0"
TargetRubyVersion: "3.0"
Exclude:
- "lib/opentelemetry/proto/**/*"
- "vendor/**/*"
Expand All @@ -8,6 +8,10 @@ Lint/UnusedMethodArgument:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/LineLength:
Enabled: false
Metrics/MethodLength:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TraceExporter # rubocop:disable Metrics/ClassLength
ERROR_MESSAGE_INVALID_HEADERS = 'headers must be a String with comma-separated URL Encoded UTF-8 k=v pairs or a Hash'
private_constant(:ERROR_MESSAGE_INVALID_HEADERS)

def initialize(endpoint: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'http://localhost:4318/v1/traces'), # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def initialize(endpoint: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', 'OTEL_EXPORTER_OTLP_ENDPOINT', default: 'http://localhost:4318/v1/traces'),
certificate_file: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE', 'OTEL_EXPORTER_OTLP_CERTIFICATE'),
ssl_verify_mode: fetch_ssl_verify_mode,
headers: OpenTelemetry::Common::Utilities.config_opt('OTEL_EXPORTER_OTLP_TRACES_HEADERS', 'OTEL_EXPORTER_OTLP_HEADERS', default: {}),
Expand Down Expand Up @@ -125,10 +125,10 @@ def http_connection(uri, ssl_verify_mode, certificate_file)
# and override this method's behaviour to explicitly trace the HTTP request.
# This would allow you to trace your export pipeline.
def around_request
OpenTelemetry::Common::Utilities.untraced { yield }
OpenTelemetry::Common::Utilities.untraced { yield } # rubocop:disable Style/ExplicitBlockArgument
end

def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def send_bytes(bytes, timeout:) # rubocop:disable Metrics/MethodLength
return FAILURE if bytes.nil?

retry_count = 0
Expand Down Expand Up @@ -236,7 +236,7 @@ def measure_request_duration
end
end

def backoff?(retry_after: nil, retry_count:, reason:)
def backoff?(retry_count:, reason:, retry_after: nil)
@metrics_reporter.add_to_counter('otel.otlp_exporter.failure', labels: { 'reason' => reason })
return false if retry_count > RETRY_COUNT

Expand Down
4 changes: 2 additions & 2 deletions exporter/otlp-http/opentelemetry-exporter-otlp-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
::Dir.glob('*.md') +
['LICENSE', '.yardopts']
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'opentelemetry-api', '~> 1.1'
spec.add_dependency 'opentelemetry-common', '~> 0.19.6'
Expand All @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'opentelemetry-test-helpers'
spec.add_development_dependency 'pry-byebug' unless RUBY_ENGINE == 'jruby'
spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rubocop', '~> 0.73.0'
spec.add_development_dependency 'rubocop', '~> 1.51.0'
spec.add_development_dependency 'simplecov', '~> 0.17'
spec.add_development_dependency 'webmock', '~> 3.7.6'
spec.add_development_dependency 'yard', '~> 0.9'
Expand Down
Loading

0 comments on commit 20c640d

Please sign in to comment.