Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,21 @@ Naming/FileName:
- "lib/opentelemetry-api.rb"
Style/ExplicitBlockArgument:
Enabled: false
Lint/AmbiguousOperatorPrecedence:
Enabled: false
Minitest/AssertPredicate:
Enabled: false
Minitest/RefutePredicate:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
Style/BitwisePredicate:
Enabled: false
Style/EmptyClassDefinition:
Enabled: false
Style/HashConversion:
Enabled: false
Style/NegatedIfElseCondition:
Enabled: false
Style/OneClassPerFile:
Enabled: false
16 changes: 8 additions & 8 deletions api/benchmarks/context_bench.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def set_value(key, value)
FiberLocalVarContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
FiberLocalVarContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -188,7 +188,7 @@ def set_value(key, value)
FiberAttributeContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
FiberAttributeContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -287,7 +287,7 @@ def set_value(key, value)
LinkedListContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
LinkedListContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -379,7 +379,7 @@ def set_value(key, value)
new_entries
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
merge(values)
end

Expand Down Expand Up @@ -472,7 +472,7 @@ def set_value(key, value)
ArrayContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
ArrayContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -591,7 +591,7 @@ def set_value(key, value)
FiberLocalArrayContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
FiberLocalArrayContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -684,7 +684,7 @@ def set_value(key, value)
ImmutableArrayContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
ImmutableArrayContext.new(@entries.merge(values))
end

Expand Down Expand Up @@ -777,7 +777,7 @@ def set_value(key, value)
FiberLocalImmutableArrayContext.new(new_entries)
end

def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
FiberLocalImmutableArrayContext.new(@entries.merge(values))
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def encode(baggage)
end

def encode_value(key, entry)
result = +"#{URI.encode_uri_component(key.to_s)}=#{URI.encode_uri_component(entry.value.to_s)}"
result = "#{URI.encode_uri_component(key.to_s)}=#{URI.encode_uri_component(entry.value.to_s)}"
# We preserve metadata received on extract and assume it's already formatted
# for transport. It's sent as-is without further processing.
result << ";#{entry.metadata}" if entry.metadata
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def set_value(key, value)
# entries.
# @param [Object] value Object to be stored under key
# @return [Context]
def set_values(values) # rubocop:disable Naming/AccessorMethodName:
def set_values(values) # rubocop:disable Naming/AccessorMethodName
Context.new(@entries.merge(values))
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def keys(carrier)

def to_rack_key(key)
# Use + for mutable string interpolation in pre-Ruby 3.0.
Comment thread
thompson-tomo marked this conversation as resolved.
Outdated
ret = +"HTTP_#{key}"
ret = "HTTP_#{key}"
ret.tr!('-', '_')
ret.upcase!
ret
Expand Down
1 change: 1 addition & 0 deletions api/lib/opentelemetry/trace/propagation/trace_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Propagation
# for context propagation in the W3C Trace Context format.
module TraceContext
extend self

TEXT_MAP_PROPAGATOR = TextMapPropagator.new

private_constant :TEXT_MAP_PROPAGATOR
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 @@ -18,7 +18,7 @@ class << self
# @param [String] header Encoding of the tracestate header defined by
# the W3C Trace Context specification https://www.w3.org/TR/trace-context/
# @return [Tracestate] A new Tracestate instance or DEFAULT
def from_string(header) # rubocop:disable Metrics/CyclomaticComplexity:
def from_string(header) # rubocop:disable Metrics/CyclomaticComplexity
return DEFAULT if header.nil? || header.empty?

hash = header.split(',').each_with_object({}) do |member, memo|
Expand Down
4 changes: 2 additions & 2 deletions api/test/opentelemetry/context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
# Manipulate _this fiber's_ context stack.
Context.attach(new_context)
ensure
locals.each { |k, _| t2[k] = nil } # rubocop:disable Style/HashEachMethods (locals is not a Hash)
locals.each { |k, _| t2[k] = nil } # rubocop:disable Style/HashEachMethods --(locals is not a Hash)
end.resume
end
_(log_stream.string).must_be_empty
Expand Down Expand Up @@ -348,7 +348,7 @@
# Manipulate _this thread's_ context stack.
Context.attach(new_context)
ensure
locals.each { |k, _| t2[k] = nil } # rubocop:disable Style/HashEachMethods (locals is not a Hash)
locals.each { |k, _| t2[k] = nil } # rubocop:disable Style/HashEachMethods --(locals is not a Hash)
end.join
end
_(log_stream.string).must_be_empty
Expand Down
2 changes: 1 addition & 1 deletion api/test/opentelemetry/trace/trace_flags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe OpenTelemetry::Trace::TraceFlags do
describe '.new' do
it 'is private' do
_(-> { OpenTelemetry::Trace::TraceFlags.new(0) })\
_(-> { OpenTelemetry::Trace::TraceFlags.new(0) })
.must_raise(NoMethodError)
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/test/opentelemetry/trace/tracestate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe OpenTelemetry::Trace::Tracestate do
describe '.new' do
it 'is private' do
_(-> { OpenTelemetry::Trace::Tracestate.new({}) })\
_(-> { OpenTelemetry::Trace::Tracestate.new({}) })
.must_raise(NoMethodError)
end
end
Expand Down
8 changes: 8 additions & 0 deletions common/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ Metrics/BlockLength:
Naming/FileName:
Exclude:
- "lib/opentelemetry-common.rb"
Lint/AmbiguousRange:
Enabled: false
Minitest/AssertPredicate:
Enabled: false
Minitest/RefutePredicate:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
2 changes: 1 addition & 1 deletion common/lib/opentelemetry-common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
#
# SPDX-License-Identifier: Apache-2.0

require_relative './opentelemetry/common'
require_relative 'opentelemetry/common'
2 changes: 1 addition & 1 deletion common/lib/opentelemetry/common/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ module HTTP
end
end

require_relative './http/client_context'
require_relative 'http/client_context'
4 changes: 2 additions & 2 deletions common/lib/opentelemetry/common/propagation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
# SPDX-License-Identifier: Apache-2.0

require_relative './propagation/rack_env_getter'
require_relative './propagation/symbol_key_getter'
require_relative 'propagation/rack_env_getter'
require_relative 'propagation/symbol_key_getter'

module OpenTelemetry
module Common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def keys(carrier)
private

def to_rack_key(key)
# Use + for mutable string interpolation in pre-Ruby 3.0.
ret = +"HTTP_#{key}"
ret = "HTTP_#{key}"
ret.tr!('-', '_')
ret.upcase!
ret
Expand Down
2 changes: 1 addition & 1 deletion common/lib/opentelemetry/common/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ def valid_exporter?(exporter)
end
end

require_relative './http/client_context'
require_relative 'http/client_context'
22 changes: 20 additions & 2 deletions contrib/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ plugins:
- rubocop-performance

AllCops:
NewCops: disable
SuggestExtensions: false
NewCops: enable
SuggestExtensions: true
TargetRubyVersion: "3.3"
Exclude:
- "vendor/**/*"

Gemspec/DevelopmentDependencies:
Enabled: false

Layout/LineLength:
Enabled: false

Lint/ConstantDefinitionInBlock:
Exclude:
- "test/**/*"
Lint/EmptyBlock:
Exclude:
- "**/*test.rb"
Lint/MissingSuper:
Enabled: false
Lint/UnusedMethodArgument:
Expand All @@ -33,6 +39,18 @@ Style/ModuleFunction:
Enabled: false
Style/NumericPredicate:
Enabled: false
Style/RedundantConstantBase:
Enabled: false
Style/RedundantRegexpEscape:
Enabled: false
Style/StringConcatenation:
Exclude:
- "test/**/*"

Gemspec/RequireMFA:
# We probably want to figure out how to set this up for the organization
Enabled: false

# we need to review the below
Minitest/EmptyLineBeforeAssertionMethods:
Enabled: false
2 changes: 2 additions & 0 deletions exporter/otlp-common/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Metrics/PerceivedComplexity:
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-otlp-common.rb"
Style/ObjectThen:
Enabled: false
8 changes: 8 additions & 0 deletions exporter/otlp-http/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ Metrics/PerceivedComplexity:
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-otlp-http.rb"
Lint/DuplicateBranch:
Enabled: false
Lint/SuppressedExceptionInNumberConversion:
Enabled: false
Performance/MapCompact:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
8 changes: 8 additions & 0 deletions exporter/otlp-logs/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ Style/FrozenStringLiteralComment:
- gemfiles/**/*
Metrics/BlockLength:
Enabled: false
Lint/DuplicateBranch:
Enabled: false
Lint/SuppressedExceptionInNumberConversion:
Enabled: false
Performance/MapCompact:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
8 changes: 8 additions & 0 deletions exporter/otlp-metrics/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ Metrics/BlockLength:
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-otlp-metrics.rb"
Lint/DuplicateBranch:
Enabled: false
Lint/SuppressedExceptionInNumberConversion:
Enabled: false
Performance/MapCompact:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
require 'opentelemetry/metrics'
require 'opentelemetry/sdk/metrics'

require_relative './util'
require_relative 'util'

module OpenTelemetry
module Exporter
Expand Down
10 changes: 10 additions & 0 deletions exporter/otlp/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ Metrics/BlockLength:
Naming/FileName:
Exclude:
- "lib/opentelemetry-exporter-otlp.rb"
Lint/DuplicateBranch:
Enabled: false
Lint/SuppressedExceptionInNumberConversion:
Enabled: false
Performance/MapCompact:
Enabled: false
Performance/MethodObjectAsBlock:
Enabled: false
Style/ObjectThen:
Enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def as_otlp_any_value(value)
end

def prepare_endpoint(endpoint)
endpoint ||= ENV['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT']
endpoint ||= ENV.fetch('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT', nil)
if endpoint.nil?
endpoint = ENV['OTEL_EXPORTER_OTLP_ENDPOINT'] || 'http://localhost:4318'
endpoint += '/' unless endpoint.end_with?('/')
Expand Down
6 changes: 6 additions & 0 deletions exporter/zipkin/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ Naming/FileName:
- "lib/opentelemetry-exporter-zipkin.rb"
Style/ExplicitBlockArgument:
Enabled: false
Lint/AmbiguousOperatorPrecedence:
Enabled: false
Lint/SuppressedExceptionInNumberConversion:
Enabled: false
Minitest/SkipEnsure:
Enabled: false
1 change: 1 addition & 0 deletions exporter/zipkin/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def create_span_data(status: nil, kind: nil, attributes: nil, total_recorded_att
# Test helper for Zipkin Exporter
class InMemoryMetricsReporter
include OpenTelemetry::SDK::Trace::Export::MetricsReporter

attr_reader :counters, :records, :observes

def initialize
Expand Down
2 changes: 2 additions & 0 deletions logs_api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Metrics/CyclomaticComplexity:
Naming/FileName:
Exclude:
- "lib/opentelemetry-logs-api.rb"
Lint/EmptyClass:
Enabled: false
4 changes: 4 additions & 0 deletions metrics_api/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Metrics/CyclomaticComplexity:
Naming/FileName:
Exclude:
- "lib/opentelemetry-metrics-api.rb"
Minitest/AssertKindOf:
Enabled: false
Style/EmptyClassDefinition:
Enabled: false
Loading
Loading