49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/fluent/plugin/out_jfrog_send_metrics.rb', line 49
def process(tag, es)
logger = log
es.each do |time, record|
begin
logger.info("Sending metrics to target platform: #{@target_platform} started")
if @target_platform == 'NEWRELIC'
vendor = NewRelicMetrics.new(@apikey, @url)
vendor.send_metrics(record, @http_proxy, @verify_ssl, @request_timeout, @gzip_compression, logger)
elsif @target_platform == 'DATADOG'
vendor = DatadogMetrics.new(@apikey, @url)
vendor.send_metrics(@ddtags, record, @http_proxy, @verify_ssl, @request_timeout, @gzip_compression, logger)
end
logger.info("Sending metrics to target platform: #{@target_platform} finished")
rescue RestClient::Exceptions::OpenTimeout
logger.info("The request timed out while trying to open a connection. The configured request timeout is: #{@request_timeout}")
rescue RestClient::Exceptions::ReadTimeout
logger.info("The request timed out while waiting for a response. The configured request timeout is: #{@request_timeout}")
rescue RestClient::ExceptionWithResponse => e
logger.info("HTTP request failed: #{e.response}")
rescue Net::HTTPClientException => e
logger.info("An HTTP client error occurred when sending metrics to #{@target_platform}: #{e.message}")
rescue StandardError => e
logger.info("An error occurred when sending metrics to #{@target_platform}: #{e.message}")
end
end
end
|