aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/upstreamcache.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-17 15:34:35 +0100
committerMartin Ridgers <[email protected]>2021-11-17 15:34:35 +0100
commitdcfc3a4b9c70d6034209c7b518ae6e59205e6c61 (patch)
tree7553b5c53fab5cbd1ae44624101cf67f2f0022e4 /zenserver/upstream/upstreamcache.cpp
parentUse syscalls to get user path as '~' is only an alias to shells (diff)
parentLog upstream HTTP errors as errors. (diff)
downloadzen-dcfc3a4b9c70d6034209c7b518ae6e59205e6c61.tar.xz
zen-dcfc3a4b9c70d6034209c7b518ae6e59205e6c61.zip
Merged main
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 53b3710bf..e4ccaadbe 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.Key.Bucket,
- CacheRecord.Key.Hash,
- e.what());
+ ZEN_ERROR("upload cache record '{}/{}' FAILED, reason '{}'",
+ CacheRecord.Key.Bucket,
+ CacheRecord.Key.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());
+ }
}
}