lib/scalyr/common/client.rb in logstash-output-scalyr-0.2.0 vs lib/scalyr/common/client.rb in logstash-output-scalyr-0.2.1.beta
- old
+ new
@@ -217,10 +217,18 @@
end
current_stats
end
end
+ # Send "ping" request to the API. This is mostly used to test the connecting with Scalyr API
+ # and verify that the API key is valid.
+ def send_ping(body)
+ post_body, post_headers, compression_duration = prepare_post_object @add_events_uri.path, body
+ response = client.send(:post, @add_events_uri, body: post_body, headers: post_headers)
+ handle_response(response)
+ response
+ end
# Upload data to Scalyr. Assumes that the body size complies with Scalyr limits
def post_add_events(body, is_status, body_serialization_duration = 0)
post_body, post_headers, compression_duration = prepare_post_object @add_events_uri.path, body
fail_count = 1 # putative assume failure