aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/upstreamcache.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-11-17 15:29:58 +0100
committerPer Larsson <[email protected]>2021-11-17 15:29:58 +0100
commit731e523ab939c8aebf33ae5f7e127b01599bf575 (patch)
treeab116a8565107256030c750df78f5da486bad5c8 /zenserver/upstream/upstreamcache.cpp
parentCheck both success and error code when initializing Jupiter upstream. (diff)
downloadzen-731e523ab939c8aebf33ae5f7e127b01599bf575.tar.xz
zen-731e523ab939c8aebf33ae5f7e127b01599bf575.zip
Log upstream HTTP errors as errors.
Diffstat (limited to 'zenserver/upstream/upstreamcache.cpp')
-rw-r--r--zenserver/upstream/upstreamcache.cpp68
1 files changed, 55 insertions, 13 deletions
diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp
index 0fa497faf..726ef331d 100644
--- a/zenserver/upstream/upstreamcache.cpp
+++ b/zenserver/upstream/upstreamcache.cpp
@@ -814,7 +814,10 @@ namespace detail {
TotalElapsedSeconds += Result.ElapsedSeconds;
}
- return {.Bytes = TotalBytes, .ElapsedSeconds = TotalElapsedSeconds, .Success = Result.Success};
+ return {.Reason = std::move(Result.Reason),
+ .Bytes = TotalBytes,
+ .ElapsedSeconds = TotalElapsedSeconds,
+ .Success = Result.Success};
}
catch (std::exception& e)
{
@@ -1027,6 +1030,14 @@ public:
{
return Result;
}
+
+ if (Result.Error)
+ {
+ ZEN_ERROR("get cache record FAILED, endpoint '{}', reason '{}', error code '{}'",
+ Endpoint->DisplayName(),
+ Result.Error.Reason,
+ Result.Error.ErrorCode);
+ }
}
}
}
@@ -1060,6 +1071,14 @@ public:
}
});
+ if (Result.Error)
+ {
+ ZEN_ERROR("get cache record(s) (rpc) FAILED, endpoint '{}', reason '{}', error code '{}'",
+ Endpoint->DisplayName(),
+ Result.Error.Reason,
+ Result.Error.ErrorCode);
+ }
+
m_Stats.Add(m_Log, *Endpoint, Result, m_Endpoints);
MissingKeys = std::move(Missing);
}
@@ -1098,6 +1117,14 @@ public:
}
});
+ if (Result.Error)
+ {
+ ZEN_ERROR("get cache payloads(s) (rpc) FAILED, endpoint '{}', reason '{}', error code '{}'",
+ Endpoint->DisplayName(),
+ Result.Error.Reason,
+ Result.Error.ErrorCode);
+ }
+
m_Stats.Add(m_Log, *Endpoint, Result, m_Endpoints);
MissingPayloads = std::move(Missing);
}
@@ -1125,6 +1152,14 @@ public:
{
return Result;
}
+
+ if (Result.Error)
+ {
+ ZEN_ERROR("get cache payload FAILED, endpoint '{}', reason '{}', error code '{}'",
+ Endpoint->DisplayName(),
+ Result.Error.Reason,
+ Result.Error.ErrorCode);
+ }
}
}
}
@@ -1243,10 +1278,10 @@ private:
}
catch (std::exception& e)
{
- ZEN_WARN("upload cache record '{}/{}' FAILED, reason '{}'",
- CacheRecord.CacheKey.Bucket,
- CacheRecord.CacheKey.Hash,
- e.what());
+ ZEN_ERROR("upload cache record '{}/{}' FAILED, reason '{}'",
+ CacheRecord.CacheKey.Bucket,
+ CacheRecord.CacheKey.Hash,
+ e.what());
}
}
@@ -1269,20 +1304,27 @@ private:
}
}
- for (auto& Endpoint : m_Endpoints)
+ try
{
- if (!Endpoint->IsHealthy())
+ for (auto& Endpoint : m_Endpoints)
{
- if (const UpstreamEndpointHealth Health = Endpoint->CheckHealth(); Health.Ok)
+ if (!Endpoint->IsHealthy())
{
- ZEN_INFO("health check endpoint '{}' OK", Endpoint->DisplayName(), Health.Reason);
- }
- else
- {
- ZEN_WARN("health check endpoint '{}' FAILED, reason '{}'", Endpoint->DisplayName(), Health.Reason);
+ if (const UpstreamEndpointHealth Health = Endpoint->CheckHealth(); Health.Ok)
+ {
+ ZEN_INFO("health check endpoint '{}' OK", Endpoint->DisplayName(), Health.Reason);
+ }
+ else
+ {
+ ZEN_WARN("health check endpoint '{}' FAILED, reason '{}'", Endpoint->DisplayName(), Health.Reason);
+ }
}
}
}
+ catch (std::exception& e)
+ {
+ ZEN_ERROR("check endpoint(s) health FAILED, reason '{}'", e.what());
+ }
}
}