Skip to content

Commit

Permalink
wippp
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed May 10, 2024
1 parent de58093 commit b5bbf26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions utils/S3UtilsMongoClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { errors, constants } = require('arsenal');
const async = require('async');
const { validStorageMetricLevels } = require('../CountItems/utils/constants');
const getLocationConfig = require('./locationConfig');
const monitoring = require('../utils/monitoring');

Check failure on line 8 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Useless path segments for "../utils/monitoring", should be "./monitoring"

const METASTORE = '__metastore';
const INFOSTORE = '__infostore';
Expand Down Expand Up @@ -150,6 +151,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
entry: res,
error,
});
monitoring.objectsCount.inc({ state: 'error' });
return;
}

Expand All @@ -159,6 +161,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
method: 'getObjectMDStats',
entry: res,
});
monitoring.objectsCount.inc({ state: 'skipped' });
return;
}

Expand Down Expand Up @@ -231,6 +234,7 @@ class S3UtilsMongoClient extends MongoClientInterface {
collRes.account[account].locations[location].deleteMarkerCount += res.value.isDeleteMarker ? 1 : 0;
});
});
monitoring.objectsCount.inc({ state: 'success' });
processed++;
},
err => {
Expand Down
13 changes: 11 additions & 2 deletions utils/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ const bucketCount = new promClient.Gauge({

// Histogram of the bucket processing duration, by the utilization service.

const bucketProcessingDuration = new promClient.Histogram({
const bucketProcessingDuration = (promClient.register.getSingleMetric('count_items_workersCountErrors'))

Check failure on line 15 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Trailing spaces not allowed
|| new promClient.Histogram({
name: 'count_items_bucketProcessingDuration',

Check failure on line 17 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
help: 'Duration of processing a bucket',

Check failure on line 18 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
labelNames: ['service'],

Check failure on line 19 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
buckets: [1, 10, 60, 600, 3600, 18000, 36000],

Check failure on line 20 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
});

Check failure on line 21 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 4 spaces but found 0

const consolidationDuration = new promClient.Histogram({
const consolidationDuration = (promClient.register.getSingleMetric('count_items_workersCountErrors'))

Check failure on line 23 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Trailing spaces not allowed
|| new promClient.Histogram({
name: 'count_items_consolidationDuration',

Check failure on line 25 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
help: 'Duration of metrics consolidation in seconds',

Check failure on line 26 in utils/monitoring.js

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 spaces but found 4
labelNames: ['service'],
Expand All @@ -33,6 +35,12 @@ const workersCount = (promClient.register.getSingleMetric('count_items_workersCo
labelNames: ['state'],
});

const objectsCount = (promClient.register.getSingleMetric('count_items_objectsCount'))
|| new promClient.Counter({
name: 'count_items_objectsCount',
help: 'Number of objects',
labelNames: ['state'],
});
/**
* @param {http.ServerResponse} res - http response object
* @param {errors.ArsenalError} error - Error code
Expand Down Expand Up @@ -81,4 +89,5 @@ module.exports = {
bucketProcessingDuration,
consolidationDuration,
workersCount,
objectsCount,
};

0 comments on commit b5bbf26

Please sign in to comment.