lib/opentelemetry/exporter/jaeger/collector_exporter.rb in opentelemetry-exporter-jaeger-0.20.2 vs lib/opentelemetry/exporter/jaeger/collector_exporter.rb in opentelemetry-exporter-jaeger-0.21.0
- old
+ new
@@ -28,11 +28,11 @@
def initialize(endpoint: ENV.fetch('OTEL_EXPORTER_JAEGER_ENDPOINT', 'http://localhost:14268/api/traces'),
username: ENV['OTEL_EXPORTER_JAEGER_USER'],
password: ENV['OTEL_EXPORTER_JAEGER_PASSWORD'],
timeout: ENV.fetch('OTEL_EXPORTER_JAEGER_TIMEOUT', 10),
ssl_verify_mode: CollectorExporter.ssl_verify_mode)
- raise ArgumentError, "invalid url for Jaeger::CollectorExporter #{endpoint}" if invalid_url?(endpoint)
+ raise ArgumentError, "invalid url for Jaeger::CollectorExporter #{endpoint}" unless OpenTelemetry::Common::Utilities.valid_url?(endpoint)
raise ArgumentError, 'username and password should either both be nil or both be set' if username.nil? != password.nil?
transport_opts = { ssl_verify_mode: Integer(ssl_verify_mode) }
@transport = ::Thrift::HTTPClientTransport.new(endpoint, transport_opts)
unless username.nil? || password.nil?
@@ -85,18 +85,9 @@
@shutdown = true
SUCCESS
end
private
-
- def invalid_url?(url)
- return true if url.nil? || url.strip.empty?
-
- URI(url)
- false
- rescue URI::InvalidURIError
- true
- end
def encoded_batches(span_data)
span_data.group_by(&:resource).map do |resource, spans|
process = Encoder.encoded_process(resource)
spans.map! { |span| Encoder.encoded_span(span) }