Sha256: 7ea2203408fb47a584ca51629052fa1c7cb5510e30b66f7447cfa24ad6244639
Contents?: true
Size: 1.21 KB
Versions: 12
Compression:
Stored size: 1.21 KB
Contents
# typed: true require_relative 'statistics' require_relative 'env' module Datadog module Transport module HTTP # Routes, encodes, and sends tracer data to the trace agent via HTTP. class Client include Transport::HTTP::Statistics attr_reader :api def initialize(api) @api = api end def send_request(request, &block) # Build request into env env = build_env(request) # Get responses from API response = yield(api, env) # Update statistics update_stats_from_response!(response) response rescue StandardError => e message = "Internal error during #{self.class.name} request. Cause: #{e.class.name} #{e.message} " \ "Location: #{Array(e.backtrace).first}" # Log error if stats.consecutive_errors > 0 Datadog.logger.debug(message) else Datadog.logger.error(message) end # Update statistics update_stats_from_exception!(e) InternalErrorResponse.new(e) end def build_env(request) Env.new(request) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems