Skip to content

Commit 3ac89e2

Browse files
committed
Merge branch 'feature/ZENKO-925-increaseMetricsExpiry' into q/8.0
2 parents 69346c4 + 409cbbb commit 3ac89e2

File tree

5 files changed

+27
-35
lines changed

5 files changed

+27
-35
lines changed

docs/metrics.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ for an object fails, failed object metrics are considered backlog.
7575
This route returns the replication completions in number of objects and number
7676
of total bytes transferred for the specified extension type and location.
7777
Completions are only collected up to an `EXPIRY` time, which is currently set
78-
to **15 minutes**.
78+
to **24 hours**.
7979

8080
**Example Output**:
8181

8282
```
8383
"completions":{
8484
"description":"Number of completed replication operations (count) and number
85-
of bytes transferred (size) in the last 900 seconds",
85+
of bytes transferred (size) in the last 86400 seconds",
8686
"results":{
8787
"count":31,
8888
"size":"47.04"
@@ -95,14 +95,14 @@ to **15 minutes**.
9595
This route returns the replication failures in number of objects and number
9696
of total bytes for the specified extension type and location. Failures are
9797
collected only up to an `EXPIRY` time, currently set to a default
98-
**15 minutes**.
98+
**24 hours**.
9999

100100
**Example Output**:
101101

102102
```
103103
"failures":{
104104
"description":"Number of failed replication operations (count) and bytes
105-
(size) in the last 900 seconds",
105+
(size) in the last 86400 seconds",
106106
"results":{
107107
"count":"5",
108108
"size":"10.12"
@@ -116,6 +116,9 @@ This route returns the current throughput in number of completed operations per
116116
second (or number of objects replicating per second) and number of total bytes
117117
completing per second for the specified type and location name.
118118

119+
Note throughput is averaged over the past 15 minutes of data collected so this
120+
metric is really an average throughput.
121+
119122
**Example Output**:
120123

121124
```
@@ -203,9 +206,9 @@ sends a Kafka entry, and when the CRR topic `BackbeatConsumer` consumes and
203206
processes its Kafka entries. The `MetricsConsumer` processes these Kafka metrics
204207
entries and produces to Redis.
205208

206-
A single-location CRR entry produces four keys in total. The data points
209+
A single-location CRR entry produces up to six keys in total. The data points
207210
stored in Redis are saved in intervals (default of 5 minutes) and are available
208-
up to an expiry time (default of 15 minutes).
211+
up to an expiry time (default of 24 hours).
209212

210213
An object CRR entry creates one key. An initial key is set when the CRR
211214
operation begins, storing the total size of the object to be replicated. Then,

lib/MetricsConsumer.js

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const redisKeys = require('../extensions/replication/constants').redisKeys;
88

99
// StatsClient constant defaults for site metrics
1010
const INTERVAL = 300; // 5 minutes;
11-
const EXPIRY = 900; // 15 minutes
12-
const OBJECT_MONITORING_EXPIRY = 86400; // 24 hours
11+
const EXPIRY = 86400; // 24 hours
1312

1413
// BackbeatConsumer constant defaults
1514
const CONSUMER_FETCH_MAX_BYTES = 5000020;
@@ -33,10 +32,7 @@ class MetricsConsumer {
3332

3433
this.logger = new Logger('Backbeat:MetricsConsumer');
3534
const redisClient = new RedisClient(rConfig, this.logger);
36-
this._siteStatsClient = new StatsModel(redisClient, INTERVAL,
37-
(EXPIRY + INTERVAL));
38-
this._objectStatsClient = new StatsModel(redisClient, INTERVAL,
39-
(OBJECT_MONITORING_EXPIRY + INTERVAL));
35+
this._statsClient = new StatsModel(redisClient, INTERVAL, EXPIRY);
4036
}
4137

4238
start() {
@@ -65,14 +61,14 @@ class MetricsConsumer {
6561
_sendSiteLevelRequests(data) {
6662
const { type, site, ops, bytes } = data;
6763
if (type === 'completed') {
68-
this._sendSiteLevelRequest(`${site}:${redisKeys.opsDone}`, ops);
69-
this._sendSiteLevelRequest(`${site}:${redisKeys.bytesDone}`, bytes);
64+
this._sendRequest(`${site}:${redisKeys.opsDone}`, ops);
65+
this._sendRequest(`${site}:${redisKeys.bytesDone}`, bytes);
7066
} else if (type === 'failed') {
71-
this._sendSiteLevelRequest(`${site}:${redisKeys.opsFail}`, ops);
72-
this._sendSiteLevelRequest(`${site}:${redisKeys.bytesFail}`, bytes);
67+
this._sendRequest(`${site}:${redisKeys.opsFail}`, ops);
68+
this._sendRequest(`${site}:${redisKeys.bytesFail}`, bytes);
7369
} else if (type === 'queued') {
74-
this._sendSiteLevelRequest(`${site}:${redisKeys.ops}`, ops);
75-
this._sendSiteLevelRequest(`${site}:${redisKeys.bytes}`, bytes);
70+
this._sendRequest(`${site}:${redisKeys.ops}`, ops);
71+
this._sendRequest(`${site}:${redisKeys.bytes}`, bytes);
7672
}
7773
return undefined;
7874
}
@@ -82,11 +78,11 @@ class MetricsConsumer {
8278
if (type === 'completed') {
8379
const key = `${site}:${bucketName}:${objectKey}:` +
8480
`${versionId}:${redisKeys.objectBytesDone}`;
85-
this._sendObjectLevelRequest(key, bytes);
81+
this._sendRequest(key, bytes);
8682
} else if (type === 'queued') {
8783
const key = `${site}:${bucketName}:${objectKey}:` +
8884
`${versionId}:${redisKeys.objectBytes}`;
89-
this._sendObjectLevelRequest(key, bytes);
85+
this._sendRequest(key, bytes);
9086
}
9187
return undefined;
9288
}
@@ -133,12 +129,8 @@ class MetricsConsumer {
133129
return done();
134130
}
135131

136-
_sendSiteLevelRequest(key, value) {
137-
this._siteStatsClient.reportNewRequest(key, value);
138-
}
139-
140-
_sendObjectLevelRequest(key, value) {
141-
this._objectStatsClient.reportNewRequest(key, value);
132+
_sendRequest(key, value) {
133+
this._statsClient.reportNewRequest(key, value);
142134
}
143135
}
144136

lib/api/BackbeatAPI.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const monitoringClient = require('../clients/monitoringHandler').client;
2525
// StatsClient constant defaults
2626
// TODO: This should be moved to constants file
2727
const INTERVAL = 300; // 5 minutes
28-
const EXPIRY = 900; // 15 minutes
29-
const OBJECT_MONITORING_EXPIRY = 86400; // 24 hours.
28+
const EXPIRY = 86400; // 24 hours.
3029

3130
const ZK_CRR_STATE_PATH = '/state';
3231

@@ -79,10 +78,7 @@ class BackbeatAPI {
7978
this._redisClient = new RedisClient(this._redisConfig, this._logger);
8079
// Redis expiry increased by an additional interval so we can reference
8180
// the immediate older data for average throughput calculation
82-
this._statsClient = new StatsModel(this._redisClient, INTERVAL,
83-
(EXPIRY + INTERVAL));
84-
this._objectStatsClient = new StatsModel(this._redisClient, INTERVAL,
85-
(OBJECT_MONITORING_EXPIRY + INTERVAL));
81+
this._statsClient = new StatsModel(this._redisClient, INTERVAL, EXPIRY);
8682
const metricsConfig = {
8783
redisConfig: this._redisClient,
8884
validSites: this._validSites,
@@ -92,6 +88,7 @@ class BackbeatAPI {
9288
Object.assign(this, {
9389
_queryStats: metrics._queryStats,
9490
_getData: metrics._getData,
91+
_getMaxUptime: metrics._getMaxUptime,
9592
getBacklog: metrics.getBacklog,
9693
getCompletions: metrics.getCompletions,
9794
getFailedMetrics: metrics.getFailedMetrics,

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/scality/backbeat#readme",
3434
"dependencies": {
35-
"arsenal": "scality/Arsenal#12c4df7",
35+
"arsenal": "scality/Arsenal#06dfdd9",
3636
"async": "^2.3.0",
3737
"aws-sdk": "2.147.0",
3838
"backo": "^1.1.0",

0 commit comments

Comments
 (0)