lib/datadog/profiling/http_transport.rb in datadog-2.0.0.beta2 vs lib/datadog/profiling/http_transport.rb in datadog-2.0.0

- old
+ new

@@ -5,30 +5,32 @@ module Datadog module Profiling # Used to report profiling data to Datadog. # Methods prefixed with _native_ are implemented in `http_transport.c` class HttpTransport + attr_reader :exporter_configuration + def initialize(agent_settings:, site:, api_key:, upload_timeout_seconds:) @upload_timeout_milliseconds = (upload_timeout_seconds * 1_000).to_i validate_agent_settings(agent_settings) @exporter_configuration = if agentless?(site, api_key) - [:agentless, site, api_key] + [:agentless, site, api_key].freeze else - [:agent, base_url_from(agent_settings)] + [:agent, base_url_from(agent_settings)].freeze end - status, result = validate_exporter(@exporter_configuration) + status, result = validate_exporter(exporter_configuration) raise(ArgumentError, "Failed to initialize transport: #{result}") if status == :error end def export(flush) status, result = do_export( - exporter_configuration: @exporter_configuration, + exporter_configuration: exporter_configuration, upload_timeout_milliseconds: @upload_timeout_milliseconds, # why "timespec"? # libdatadog represents time using POSIX's struct timespec, see # https://www.gnu.org/software/libc/manual/html_node/Time-Types.html @@ -64,16 +66,10 @@ Datadog.logger.error("Failed to report profiling data (#{config_without_api_key}): #{result}") false end end - # Used to log soft failures in `ddog_Vec_tag_push` (e.g. we still report the profile in these cases) - # Called from native code - def self.log_failure_to_process_tag(failure_details) - Datadog.logger.warn("Failed to add tag to profiling request: #{failure_details}") - end - private def base_url_from(agent_settings) case agent_settings.adapter when Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER @@ -134,10 +130,10 @@ info_json, ) end def config_without_api_key - [@exporter_configuration[0..1]].to_h + [exporter_configuration[0..1]].to_h end end end end