8000 Protocol specific metrics (#14674) · arangodb/arangodb@866a723 · GitHub
[go: up one dir, main page]

Skip to content

Commit 866a723

Browse files
authored
Protocol specific metrics (#14674)
1 parent 67aed64 commit 866a723

19 files changed

+265
-8
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
devel
22
-----
33

4+
* Added protocol specific metrics: histogram about request body size, total
5+
number of HTTP/2 connections and total number of VST connections.
6+
47
* Add pseudo log topic "all" to set the log levels for all log topics at
58
once. For example, this can be used when starting a server with trace or
69
debug logging enabled for all log topics, e.g.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: arangodb_http2_connections_total
2+
introducedIn: "3.7.15"
3+
help: |
4+
Total number of HTTP/2 connections accepted.
5+
unit: number
6+
type: counter
7+
category: Connectivity
8+
complexity: medium
9+
exposedBy:
10+
- coordinator
11+
- dbserver
12+
- agent
13+
- single
14+
description: |
15+
Total number of connections accepted for HTTP/2, this can be upgraded
16+
connections from HTTP/1.1 or connections negotiated to be HTTP/2 during
17+
the TLS handshake.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: arangodb_request_body_size_http1
2+
introducedIn: "3.7.15"
3+
help: |
4+
Body size in bytes for HTTP/1.1 requests.
5+
unit: bytes
6+
type: histogram
7+
category: Statistics
8+
complexity: medium
9+
exposedBy:
10+
- coordinator
11+
- dbserver
12+
- agent
13+
- single
14+
description: |
15+
Histogram of the body sizes of the received HTTP/1.1 requests in bytes.
16+
Note that this does not account for the header.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: arangodb_request_body_size_http2
2+
introducedIn: "3.7.15"
3+
help: |
4+
Body size in bytes for HTTP/2 requests.
5+
unit: bytes
6+
type: histogram
7+
category: Statistics
8+
complexity: medium
9+
exposedBy:
10+
- coordinator
11+
- dbserver
12+
- agent
13+
- single
14+
description: |
15+
Histogram of the body sizes of the received HTTP/2 requests in bytes.
16+
Note that this does not account for the header.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: arangodb_request_body_size_vst
2+
introducedIn: "3.7.15"
3+
help: |
4+
Body size in bytes for VST requests.
5+
unit: bytes
6+
type: histogram
7+
category: Statistics
8+
complexity: medium
9+
exposedBy:
10+
- coordinator
11+
- dbserver
12+
- agent
13+
- single
14+
description: |
15+
Histogram of the body sizes of the received VST requests in bytes.
16+
Note that this does include the binary header.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: arangodb_vst_connections_total
2+
introducedIn: "3.7.15"
3+
help: |
4+
Total number of VST connections accepted.
5+
unit: number
6+
type: counter
7+
category: Connectivity
8+
complexity: medium
9+
exposedBy:
10+
- coordinator
11+
- dbserver
12+
- agent
13+
- single
14+
description: |
15+
Total number of connections accepted for VST, this are upgraded
16+
connections from HTTP/1.1.

arangod/GeneralServer/GeneralCommTask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class GeneralCommTask : public CommTask {
6565

6666
std::unique_ptr<AsioSocket<T>> _protocol;
6767

68-
GeneralServerFeature const& _generalServerFeature;
68+
GeneralServerFeature& _generalServerFeature;
6969

7070
bool _reading;
7171
bool _writing;

arangod/GeneralServer/GeneralServerFeature.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,39 @@ namespace arangodb {
120120

121121
static uint64_t const _maxIoThreads = 64;
122122

123+
struct RequestBodySizeScale {
124+
static log_scale_t<uint64_t> scale() { return { 2, 64, 65536, 10 }; }
125+
};
126+
127+
DECLARE_HISTOGRAM(arangodb_request_body_size_http1, RequestBodySizeScale,
128+
"Body size of HTTP/1.1 requests");
129+
DECLARE_HISTOGRAM(arangodb_request_body_size_http2, RequestBodySizeScale,
130+
"Body size of HTTP/2 requests");
131+
DECLARE_HISTOGRAM(arangodb_request_body_size_vst, RequestBodySizeScale,
132+
"Body size of VST requests");
133+
DECLARE_COUNTER(arangodb_http2_connections_total,
134+
"Total number of HTTP/2 connections");
135+
DECLARE_COUNTER(arangodb_vst_connections_total,
136+
"Total number of VST connections");
137+
123138
GeneralServerFeature::GeneralServerFeature(application_features::ApplicationServer& server)
124139
: ApplicationFeature(server, "GeneralServer"),
125140
_allowMethodOverride(false),
126141
_proxyCheck(true),
127142< 65CE /code>
_permanentRootRedirect(true),
128143
_redirectRootTo("/_admin/aardvark/index.html"),
129144
_supportInfoApiPolicy("hardened"),
130-
_numIoThreads(0) {
145+
_numIoThreads(0),
146+
_requestBodySizeHttp1(
147+
server.getFeature<MetricsFeature>().add(arangodb_request_body_size_http1{})),
148+
_requestBodySizeHttp2(
149+
server.getFeature<MetricsFeature>().add(arangodb_request_body_size_http2{})),
150+
_requestBodySizeVst(
151+
server.getFeature<MetricsFeature>().add(arangodb_request_body_size_vst{})),
152+
_http2Connections(
153+
server.getFeature<MetricsFeature>().add(arangodb_http2_connections_total{})),
154+
_vstConnections(
155+
server.getFeature<MetricsFeature>().add(arangodb_vst_connections_total{})) {
131156
setOptional(true);
132157
startsAfter<application_features::AqlFeaturePhase>();
133158

arangod/GeneralServer/GeneralServerFeature.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "GeneralServer/AsyncJobManager.h"
2828
#include "GeneralServer/GeneralServer.h"
2929
#include "GeneralServer/RestHandlerFactory.h"
30+
#include "RestServer/Metrics.h"
3031

3132
namespace arangodb {
3233
class RestServerThread;
@@ -57,6 +58,26 @@ class GeneralServerFeature final : public application_features::ApplicationFeatu
5758
rest::RestHandlerFactory& handlerFactory();
5859
rest::AsyncJobManager& jobManager();
5960

61+
void countHttp1Request(uint64_t bodySize) {
62+
_requestBodySizeHttp1.count(bodySize);
63+
}
64+
65+
void countHttp2Request(uint64_t bodySize) {
66+
_requestBodySizeHttp2.count(bodySize);
67+
}
68+
69+
void countVstRequest(uint64_t bodySize) {
70+
_requestBodySizeVst.count(bodySize);
71+
}
72+
73+
void countHttp2Connection() {
74+
_http2Connections.count();
75+
}
76+
77+
void countVstConnection() {
78+
_vstConnections.count();
79+
}
80+
6081
private:
6182

6283
void buildServers();
@@ -75,6 +96,13 @@ class GeneralServerFeature final : public application_features::ApplicationFeatu
7596
std::unique_ptr<rest::AsyncJobManager> _jobManager;
7697
std::vector<std::unique_ptr<rest::GeneralServer>> _servers;
7798
uint64_t _numIoThreads;
99+
100+
// Some metrics about
101+
Histogram<log_scale_t<uint64_t>>& _requestBodySizeHttp1;
102+
Histogram<log_scale_t<uint64_t>>& _requestBodySizeHttp2;
103+
Histogram<log_scale_t<uint64_t>>& _requestBodySizeVst;
104+
Counter& _http2Connections;
105+
Counter& _vstConnections;
78106
};
79107

80108
} // namespace arangodb

arangod/GeneralServer/H2CommTask.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ H2CommTask<T>::H2CommTask(GeneralServer& server, ConnectionInfo info,
209209
std::unique_ptr<AsioSocket<T>> so)
210210
: GeneralCommTask<T>(server, std::move(info), std::move(so)) {
211211
this->_connectionStatistics.SET_HTTP();
212+
this->_generalServerFeature.countHttp2Connection();
212213
initNgHttp2Session();
213214
}
214215

@@ -512,6 +513,7 @@ void H2CommTask<T>::processRequest(Stream& stream, std::unique_ptr<HttpRequest>
512513
<< HttpRequest::translateMethod(req->requestType()) << "\",\"" << url(req.get()) << "\"";
513514

514515
VPackStringRef body = req->rawPayload();
516+
this->_generalServerFeature.countHttp2Request(body.size());
515517
if (!body.empty() && Logger::isEnabled(LogLevel::TRACE, Logger::REQUESTS) &&
516518
Logger::logRequestParameters()) {
517519
LOG_TOPIC("b6dc3", TRACE, Logger::REQUESTS)

0 commit comments

Comments
 (0)
0