Count and report on various internal exceptions.
An initial set of seven of these, easy to add more as/when needed. Change-Id: I6c65e052d00f9eaa10adee3c9464043e4c594848 Signed-off-by: Michael Meeks <michael.meeks@collabora.com>pull/4236/head
parent
6a4f634630
commit
96b15bd704
|
@ -110,7 +110,8 @@ shared_sources = common/FileUtil.cpp \
|
|||
net/HttpRequest.cpp \
|
||||
net/HttpHelper.cpp \
|
||||
net/NetUtil.cpp \
|
||||
net/Socket.cpp
|
||||
net/Socket.cpp \
|
||||
wsd/Exceptions.cpp
|
||||
if ENABLE_SSL
|
||||
shared_sources += net/Ssl.cpp
|
||||
endif
|
||||
|
|
|
@ -99,6 +99,7 @@ common_sources = \
|
|||
../common/Util.cpp \
|
||||
../common/StringVector.cpp \
|
||||
../common/TraceEvent.cpp \
|
||||
../wsd/Exceptions.cpp \
|
||||
../net/HttpRequest.cpp \
|
||||
../net/Socket.cpp \
|
||||
../net/NetUtil.cpp \
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <Unit.hpp>
|
||||
#include <Util.hpp>
|
||||
#include <wsd/COOLWSD.hpp>
|
||||
#include <wsd/Exceptions.hpp>
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <dirent.h>
|
||||
|
@ -1157,6 +1158,15 @@ void AdminModel::getMetrics(std::ostringstream &oss)
|
|||
PrintDocActExpMetrics(oss, "wopi_download_duration", "milliseconds", docStats._wopiDownloadDuration);
|
||||
oss << std::endl;
|
||||
PrintDocActExpMetrics(oss, "view_load_duration", "milliseconds", docStats._viewLoadDuration);
|
||||
|
||||
oss << std::endl;
|
||||
oss << "error_storage_space_low " << StorageSpaceLowException::count << "\n";
|
||||
oss << "error_storage_connection " << StorageConnectionException::count << "\n";
|
||||
oss << "error_bad_request " << (BadRequestException::count - BadArgumentException::count) << "\n";
|
||||
oss << "error_bad_argument " << BadArgumentException::count << "\n";
|
||||
oss << "error_unauthorized_request " << UnauthorizedRequestException::count << "\n";
|
||||
oss << "error_service_unavailable " << ServiceUnavailableException::count << "\n";
|
||||
oss << "error_parse_error " << ParseError::count << "\n";
|
||||
}
|
||||
|
||||
std::set<pid_t> AdminModel::getDocumentPids() const
|
||||
|
|
|
@ -3513,4 +3513,9 @@ bool DocumentBroker::isAsyncUploading() const
|
|||
return state == StorageBase::AsyncUpload::State::Running;
|
||||
}
|
||||
|
||||
// not beautiful - but neither is editing mobile project files.
|
||||
#if MOBILEAPP
|
||||
# include "Exceptions.cpp"
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "Exceptions.hpp"
|
||||
|
||||
#undef EXCEPTION_DECL
|
||||
|
||||
// not beautiful
|
||||
#define EXCEPTION_DECL(type,unused) \
|
||||
std::atomic<size_t> type::count;
|
||||
|
||||
EXCEPTION_DECL(StorageSpaceLowException,LoolException)
|
||||
EXCEPTION_DECL(StorageConnectionException,LoolException)
|
||||
EXCEPTION_DECL(BadRequestException,LoolException)
|
||||
EXCEPTION_DECL(BadArgumentException,BadRequestException)
|
||||
EXCEPTION_DECL(UnauthorizedRequestException,LoolException)
|
||||
EXCEPTION_DECL(ServiceUnavailableException,LoolException)
|
||||
EXCEPTION_DECL(ParseError,LoolException)
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@ -10,8 +10,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
// not beautiful
|
||||
#define EXCEPTION_DECL(type,parent_cl) \
|
||||
class type : public parent_cl \
|
||||
{ \
|
||||
public: \
|
||||
static std::atomic<size_t> count; \
|
||||
type(const std::string &str) : parent_cl(str) \
|
||||
{ type::count++; } \
|
||||
};
|
||||
|
||||
// Generic COOL errors and base for others.
|
||||
class CoolException : public std::runtime_error
|
||||
|
@ -21,62 +33,33 @@ public:
|
|||
{
|
||||
return what();
|
||||
}
|
||||
|
||||
protected:
|
||||
using std::runtime_error::runtime_error;
|
||||
};
|
||||
|
||||
class StorageSpaceLowException : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(StorageSpaceLowException,CoolException)
|
||||
|
||||
/// General exception thrown when we are not able to
|
||||
/// connect to storage.
|
||||
class StorageConnectionException : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(StorageConnectionException,CoolException)
|
||||
|
||||
/// A bad-request exception that is meant to signify,
|
||||
/// and translate into, an HTTP bad request.
|
||||
class BadRequestException : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(BadRequestException,CoolException)
|
||||
|
||||
/// A bad-argument exception that is meant to signify,
|
||||
/// and translate into, an HTTP bad request.
|
||||
class BadArgumentException : public BadRequestException
|
||||
{
|
||||
public:
|
||||
using BadRequestException::BadRequestException;
|
||||
};
|
||||
EXCEPTION_DECL(BadArgumentException,BadRequestException)
|
||||
|
||||
/// An authorization exception that is meant to signify,
|
||||
/// and translate into, an HTTP unauthorized error.
|
||||
class UnauthorizedRequestException : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(UnauthorizedRequestException,CoolException)
|
||||
|
||||
/// A service-unavailable exception that is meant to signify
|
||||
/// an internal error.
|
||||
class ServiceUnavailableException : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(ServiceUnavailableException,CoolException)
|
||||
|
||||
/// Badly formed data we are parsing
|
||||
class ParseError : public CoolException
|
||||
{
|
||||
public:
|
||||
using CoolException::CoolException;
|
||||
};
|
||||
EXCEPTION_DECL(ParseError,CoolException)
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -161,3 +161,13 @@ DOCUMENT VIEW LOAD DURATION
|
|||
document_expired_view_load_duration_average_seconds - average between the load duration of all views (active or expired) of each expired document.
|
||||
document_expired_view_load_duration_min_seconds - minimum from the load duration of all views (active or expired) of each expired document.
|
||||
document_expired_view_load_duration_max_seconds - maximum from the load duration of all views (active or expired) of each expired document.
|
||||
|
||||
SELECTED ERRORS - all integer counts
|
||||
|
||||
error_storage_space_low - local storage space too low to operate
|
||||
error_storage_connection - unable to connect to storage
|
||||
error_bad_request - we returned an HTTP bad request to a caller
|
||||
error_bad_argument - we returned an HTTP bad argument to a caller
|
||||
error_unauthorized_request - an authorization exception usually on CheckFileInfo
|
||||
error_service_unavailable - internal error, service is unavailable
|
||||
error_parse_error - badly formed data provided for us to parse.
|
||||
|
|
Loading…
Reference in New Issue