Skip to content

Commit f6fdcfe

Browse files
committed
Reduce logcache timeout from 250 to 10s
1 parent f10b4c2 commit f6fdcfe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/logcache/client.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def initialize(host:, port:, client_ca_path:, client_cert_path:, client_key_path
1616
"#{host}:#{port}",
1717
GRPC::Core::ChannelCredentials.new(client_ca, client_key, client_cert),
1818
channel_args: { GRPC::Core::Channel::SSL_TARGET => tls_subject_name },
19-
timeout: 250
19+
timeout: 10
2020
)
2121
else
2222
@service = Logcache::V1::Egress::Stub.new(
2323
"#{host}:#{port}",
2424
:this_channel_is_insecure,
25-
timeout: 250
25+
timeout: 10
2626
)
2727
end
2828
end
@@ -46,7 +46,12 @@ def container_metrics(source_guid:, start_time:, end_time:, envelope_limit: DEFA
4646

4747
def with_request_error_handling(_source_guid)
4848
tries ||= 3
49+
start_time = Time.now
4950
yield
51+
52+
# convert to milliseconds to get more precise information
53+
time_taken = (Time.now - start_time) * 1000
54+
logger.info("Response time: #{time_taken.round(2)} ms")
5055
rescue StandardError => e
5156
raise CloudController::Errors::ApiError.new_from_details('ServiceUnavailable', 'Connection to Log Cache timed out') if e.is_a?(GRPC::DeadlineExceeded)
5257

0 commit comments

Comments
 (0)