Commit 02d90306 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '233109-http-timeout-handling-improvements' into 'master'

Tweaks to setting HTTP client timeouts

See merge request gitlab-org/gitlab!39318
parents 9cfa4ab9 7e3a759b
......@@ -97,7 +97,13 @@ class PrometheusService < MonitoringService
def prometheus_client
return unless should_return_client?
options = { allow_local_requests: allow_local_api_url? }
options = {
allow_local_requests: allow_local_api_url?,
# We should choose more conservative timeouts, but some queries we run are now busting our
# default timeouts, which are stricter. We should make those queries faster instead.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/233109
timeout: 60
}
if behind_iap?
# Adds the Authorization header
......
......@@ -55,16 +55,17 @@ class WebHookService
message: response.to_s
}
rescue SocketError, OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout, Gitlab::HTTP::BlockedUrlError, Gitlab::HTTP::RedirectionTooDeep, Gitlab::Json::LimitedEncoder::LimitExceeded => e
execution_duration = Gitlab::Metrics::System.monotonic_time - start_time
log_execution(
trigger: hook_name,
url: hook.url,
request_data: data,
response: InternalErrorResponse.new,
execution_duration: Gitlab::Metrics::System.monotonic_time - start_time,
execution_duration: execution_duration,
error_message: e.to_s
)
Gitlab::AppLogger.error("WebHook Error => #{e}")
Gitlab::AppLogger.error("WebHook Error after #{execution_duration.to_i.seconds}s => #{e}")
{
status: :error,
......
---
title: Set longer Prometheus timeouts in PrometheusService
merge_request: 39318
author:
type: other
......@@ -132,7 +132,7 @@ module Gitlab
def http_options
strong_memoize(:http_options) do
{ follow_redirects: false, open_timeout: 5, read_timeout: 10 }.merge(mapped_options)
{ follow_redirects: false }.merge(mapped_options)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment