Compare commits
3 Commits
developmen
...
ft/Zenko-2
Author | SHA1 | Date |
---|---|---|
anurag4DSB | 52e95354a3 | |
anurag4DSB | 161141f9d5 | |
anurag4DSB | 92c3e69356 |
|
@ -4,6 +4,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { deleteBucket } = require('./apiUtils/bucket/bucketDeletion');
|
const { deleteBucket } = require('./apiUtils/bucket/bucketDeletion');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucketDelete - DELETE bucket (currently supports only non-versioned buckets)
|
* bucketDelete - DELETE bucket (currently supports only non-versioned buckets)
|
||||||
|
@ -50,6 +51,8 @@ function bucketDelete(authInfo, request, log, cb) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
|
monitoring.currentBucketNumber.dec();
|
||||||
return cb(null, corsHeaders);
|
return cb(null, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ function bucketDeleteCors(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
return callback(err, corsHeaders);
|
return callback(err, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ const metadata = require('../metadata/wrapper');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucketDeleteLifecycle - Delete the bucket Lifecycle configuration
|
* bucketDeleteLifecycle - Delete the bucket Lifecycle configuration
|
||||||
|
@ -48,6 +49,8 @@ function bucketDeleteLifecycle(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
|
monitoring.currentLifecycleBucketNumber.dec();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ const metadata = require('../metadata/wrapper');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucketDeleteReplication - Delete the bucket replication configuration
|
* bucketDeleteReplication - Delete the bucket replication configuration
|
||||||
|
@ -48,6 +49,7 @@ function bucketDeleteReplication(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ function bucketDeleteWebsite(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ const escapeForXml = s3middleware.escapeForXml;
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const validateSearchParams = require('../api/apiUtils/bucket/validateSearch');
|
const validateSearchParams = require('../api/apiUtils/bucket/validateSearch');
|
||||||
const parseWhere = require('../api/apiUtils/bucket/parseWhere');
|
const parseWhere = require('../api/apiUtils/bucket/parseWhere');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
|
|
||||||
/* Sample XML response for GET bucket objects:
|
/* Sample XML response for GET bucket objects:
|
||||||
|
@ -214,6 +215,7 @@ function handleResult(listParams, requestMaxKeys, encoding, authInfo,
|
||||||
res = processMasterVersions(bucketName, listParams, list);
|
res = processMasterVersions(bucketName, listParams, list);
|
||||||
}
|
}
|
||||||
pushMetric('listBucket', log, { authInfo, bucket: bucketName });
|
pushMetric('listBucket', log, { authInfo, bucket: bucketName });
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, res, corsHeaders);
|
return callback(null, res, corsHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const vault = require('../auth/vault');
|
const vault = require('../auth/vault');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
// Sample XML response:
|
// Sample XML response:
|
||||||
/*
|
/*
|
||||||
|
@ -166,6 +167,7 @@ function bucketGetACL(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@ const { convertToXml } = require('./apiUtils/bucket/bucketCors');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ function bucketGetCors(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ const LifecycleConfiguration =
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucketGetLifecycle - Get the bucket lifecycle configuration
|
* bucketGetLifecycle - Get the bucket lifecycle configuration
|
||||||
|
@ -45,6 +46,7 @@ function bucketGetLifecycle(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ const metadata = require('../metadata/wrapper');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const escapeForXml = s3middleware.escapeForXml;
|
const escapeForXml = s3middleware.escapeForXml;
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ function bucketGetLocation(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const { getReplicationConfigurationXML } =
|
const { getReplicationConfigurationXML } =
|
||||||
require('./apiUtils/bucket/getReplicationConfiguration');
|
require('./apiUtils/bucket/getReplicationConfiguration');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucketGetReplication - Get the bucket replication configuration
|
* bucketGetReplication - Get the bucket replication configuration
|
||||||
|
@ -45,6 +46,7 @@ function bucketGetReplication(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
// Sample XML response:
|
// Sample XML response:
|
||||||
/*
|
/*
|
||||||
|
@ -70,6 +71,7 @@ function bucketGetVersioning(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ function bucketGetWebsite(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
|
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if bucket exists and if user has permission to access it
|
* Determine if bucket exists and if user has permission to access it
|
||||||
|
@ -30,6 +31,7 @@ function bucketHead(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.headRequest.inc();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
const aclUtils = require('../utilities/aclUtils');
|
const aclUtils = require('../utilities/aclUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
let { restEndpoints, locationConstraints } = config;
|
let { restEndpoints, locationConstraints } = config;
|
||||||
config.on('rest-endpoints-update', () => {
|
config.on('rest-endpoints-update', () => {
|
||||||
restEndpoints = config.restEndpoints;
|
restEndpoints = config.restEndpoints;
|
||||||
|
@ -183,6 +183,9 @@ function bucketPut(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
|
monitoring.totalBucketNumber.inc();
|
||||||
|
monitoring.currentBucketNumber.inc();
|
||||||
return next(null, corsHeaders);
|
return next(null, corsHeaders);
|
||||||
}),
|
}),
|
||||||
], callback);
|
], callback);
|
||||||
|
|
|
@ -9,6 +9,7 @@ const constants = require('../../constants');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const vault = require('../auth/vault');
|
const vault = require('../auth/vault');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format of xml request:
|
Format of xml request:
|
||||||
|
@ -289,6 +290,7 @@ function bucketPutACL(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
}
|
}
|
||||||
return callback(err, corsHeaders);
|
return callback(err, corsHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { parseCorsXml } = require('./apiUtils/bucket/bucketCors');
|
const { parseCorsXml } = require('./apiUtils/bucket/bucketCors');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ function bucketPutCors(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
return callback(err, corsHeaders);
|
return callback(err, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
const { metadataValidateBucket } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bucket Put Lifecycle - Create or update bucket lifecycle configuration
|
* Bucket Put Lifecycle - Create or update bucket lifecycle configuration
|
||||||
|
@ -64,6 +65,8 @@ function bucketPutLifecycle(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
|
monitoring.currentLifecycleBucketNumber.inc();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const { getReplicationConfiguration } =
|
const { getReplicationConfiguration } =
|
||||||
require('./apiUtils/bucket/getReplicationConfiguration');
|
require('./apiUtils/bucket/getReplicationConfiguration');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
// The error response when a bucket does not have versioning 'Enabled'.
|
// The error response when a bucket does not have versioning 'Enabled'.
|
||||||
const versioningNotEnabledError = errors.InvalidRequest.customizeDescription(
|
const versioningNotEnabledError = errors.InvalidRequest.customizeDescription(
|
||||||
|
@ -64,6 +65,7 @@ function bucketPutReplication(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
return callback(null, corsHeaders);
|
return callback(null, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const versioningNotImplBackends =
|
const versioningNotImplBackends =
|
||||||
require('../../constants').versioningNotImplBackends;
|
require('../../constants').versioningNotImplBackends;
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const externalVersioningErrorMessage = 'We do not currently support putting ' +
|
const externalVersioningErrorMessage = 'We do not currently support putting ' +
|
||||||
'a versioned object to a location-constraint of type Azure or GCP.';
|
'a versioned object to a location-constraint of type Azure or GCP.';
|
||||||
|
@ -132,6 +133,7 @@ function bucketPutVersioning(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
}
|
}
|
||||||
return callback(err, corsHeaders);
|
return callback(err, corsHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { parseWebsiteConfigXml } = require('./apiUtils/bucket/bucketWebsite');
|
const { parseWebsiteConfigXml } = require('./apiUtils/bucket/bucketWebsite');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const requestType = 'bucketOwnerAction';
|
const requestType = 'bucketOwnerAction';
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ function bucketPutWebsite(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
}
|
}
|
||||||
return callback(err, corsHeaders);
|
return callback(err, corsHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,7 @@ const { preprocessingVersioningDelete }
|
||||||
= require('./apiUtils/object/versioning');
|
= require('./apiUtils/object/versioning');
|
||||||
const createAndStoreObject = require('./apiUtils/object/createAndStoreObject');
|
const createAndStoreObject = require('./apiUtils/object/createAndStoreObject');
|
||||||
const { metadataGetObject } = require('../metadata/metadataUtils');
|
const { metadataGetObject } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
|
|
||||||
|
@ -490,6 +491,7 @@ function multiObjectDelete(authInfo, request, log, callback) {
|
||||||
byteLength: Number.parseInt(totalContentLengthDeleted, 10),
|
byteLength: Number.parseInt(totalContentLengthDeleted, 10),
|
||||||
numberOfObjects: numOfObjectsRemoved,
|
numberOfObjects: numOfObjectsRemoved,
|
||||||
});
|
});
|
||||||
|
monitoring.currentObjectNumber.dec();
|
||||||
return callback(null, xml, corsHeaders);
|
return callback(null, xml, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const isLegacyAWSBehavior = require('../utilities/legacyAWSBehavior');
|
const isLegacyAWSBehavior = require('../utilities/legacyAWSBehavior');
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* multipartDelete - DELETE an open multipart upload from a bucket
|
* multipartDelete - DELETE an open multipart upload from a bucket
|
||||||
|
@ -148,6 +149,7 @@ function multipartDelete(authInfo, request, log, callback) {
|
||||||
keys: [objectKey],
|
keys: [objectKey],
|
||||||
byteLength: partSizeSum,
|
byteLength: partSizeSum,
|
||||||
});
|
});
|
||||||
|
monitoring.currentObjectNumber.dec();
|
||||||
return next(null, destBucket);
|
return next(null, destBucket);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,6 +20,7 @@ const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
const validateWebsiteHeader = require('./apiUtils/object/websiteServing')
|
const validateWebsiteHeader = require('./apiUtils/object/websiteServing')
|
||||||
.validateWebsiteHeader;
|
.validateWebsiteHeader;
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
const locationHeader = constants.objectLocationConstraintHeader;
|
const locationHeader = constants.objectLocationConstraintHeader;
|
||||||
|
@ -485,6 +486,8 @@ function objectCopy(authInfo, request, sourceBucket,
|
||||||
newByteLength: sourceObjSize,
|
newByteLength: sourceObjSize,
|
||||||
oldByteLength: isVersioned ? null : destObjPrevSize,
|
oldByteLength: isVersioned ? null : destObjPrevSize,
|
||||||
});
|
});
|
||||||
|
monitoring.totalObjectNumber.inc();
|
||||||
|
monitoring.currentObjectNumber.inc();
|
||||||
// Add expiration header if lifecycle enabled
|
// Add expiration header if lifecycle enabled
|
||||||
return callback(null, xml, additionalHeaders);
|
return callback(null, xml, additionalHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ const createAndStoreObject = require('./apiUtils/object/createAndStoreObject');
|
||||||
const { decodeVersionId, preprocessingVersioningDelete }
|
const { decodeVersionId, preprocessingVersioningDelete }
|
||||||
= require('./apiUtils/object/versioning');
|
= require('./apiUtils/object/versioning');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
|
|
||||||
|
@ -170,7 +171,10 @@ function objectDelete(authInfo, request, log, cb) {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
keys: [objectKey],
|
keys: [objectKey],
|
||||||
byteLength: Number.parseInt(objectMD['content-length'], 10),
|
byteLength: Number.parseInt(objectMD['content-length'], 10),
|
||||||
numberOfObjects: 1 });
|
numberOfObjects: 1,
|
||||||
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
|
monitoring.currentObjectNumber.dec();
|
||||||
}
|
}
|
||||||
return cb(err, resHeaders);
|
return cb(err, resHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,7 @@ const metadata = require('../metadata/wrapper');
|
||||||
const getReplicationInfo = require('./apiUtils/object/getReplicationInfo');
|
const getReplicationInfo = require('./apiUtils/object/getReplicationInfo');
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
const REPLICATION_ACTION = 'DELETE_TAGGING';
|
const REPLICATION_ACTION = 'DELETE_TAGGING';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +103,7 @@ function objectDeleteTagging(authInfo, request, log, callback) {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
keys: [objectKey],
|
keys: [objectKey],
|
||||||
});
|
});
|
||||||
|
monitoring.deleteRequest.inc();
|
||||||
const verCfg = bucket.getVersioningConfiguration();
|
const verCfg = bucket.getVersioningConfiguration();
|
||||||
additionalResHeaders['x-amz-version-id'] =
|
additionalResHeaders['x-amz-version-id'] =
|
||||||
getVersionIdResHeader(verCfg, objectMD);
|
getVersionIdResHeader(verCfg, objectMD);
|
||||||
|
|
|
@ -10,6 +10,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const { getVersionIdResHeader } = require('./apiUtils/object/versioning');
|
const { getVersionIdResHeader } = require('./apiUtils/object/versioning');
|
||||||
const setPartRanges = require('./apiUtils/object/setPartRanges');
|
const setPartRanges = require('./apiUtils/object/setPartRanges');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const validateHeaders = s3middleware.validateConditionalHeaders;
|
const validateHeaders = s3middleware.validateConditionalHeaders;
|
||||||
|
|
||||||
|
@ -200,6 +201,7 @@ function objectGet(authInfo, request, returnTagCount, log, callback) {
|
||||||
newByteLength:
|
newByteLength:
|
||||||
Number.parseInt(responseMetaHeaders['Content-Length'], 10),
|
Number.parseInt(responseMetaHeaders['Content-Length'], 10),
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, dataLocator, responseMetaHeaders,
|
return callback(null, dataLocator, responseMetaHeaders,
|
||||||
byteRange);
|
byteRange);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,7 @@ const { decodeVersionId, getVersionIdResHeader }
|
||||||
= require('./apiUtils/object/versioning');
|
= require('./apiUtils/object/versioning');
|
||||||
const vault = require('../auth/vault');
|
const vault = require('../auth/vault');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
// Sample XML response:
|
// Sample XML response:
|
||||||
/*
|
/*
|
||||||
|
@ -216,6 +217,7 @@ function objectGetACL(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
resHeaders['x-amz-version-id'] = resVersionId;
|
resHeaders['x-amz-version-id'] = resVersionId;
|
||||||
return callback(null, xml, resHeaders);
|
return callback(null, xml, resHeaders);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const { convertToXml } = s3middleware.tagging;
|
const { convertToXml } = s3middleware.tagging;
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object Get Tagging - Return tag for object
|
* Object Get Tagging - Return tag for object
|
||||||
|
@ -84,6 +85,7 @@ function objectGetTagging(authInfo, request, log, callback) {
|
||||||
authInfo,
|
authInfo,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
const verCfg = bucket.getVersioningConfiguration();
|
const verCfg = bucket.getVersioningConfiguration();
|
||||||
additionalResHeaders['x-amz-version-id'] =
|
additionalResHeaders['x-amz-version-id'] =
|
||||||
getVersionIdResHeader(verCfg, objectMD);
|
getVersionIdResHeader(verCfg, objectMD);
|
||||||
|
|
|
@ -6,6 +6,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const { getVersionIdResHeader } = require('./apiUtils/object/versioning');
|
const { getVersionIdResHeader } = require('./apiUtils/object/versioning');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ function objectHead(authInfo, request, log, callback) {
|
||||||
const responseHeaders =
|
const responseHeaders =
|
||||||
collectResponseHeaders(objMD, corsHeaders, verCfg);
|
collectResponseHeaders(objMD, corsHeaders, verCfg);
|
||||||
pushMetric('headObject', log, { authInfo, bucket: bucketName });
|
pushMetric('headObject', log, { authInfo, bucket: bucketName });
|
||||||
|
monitoring.headRequest.inc();
|
||||||
return callback(null, responseHeaders);
|
return callback(null, responseHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ const { checkQueryVersionId } = require('./apiUtils/object/versioning');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const kms = require('../kms/wrapper');
|
const kms = require('../kms/wrapper');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
|
|
||||||
|
@ -118,6 +119,10 @@ function objectPut(authInfo, request, streamingV4Params, log, callback) {
|
||||||
newByteLength,
|
newByteLength,
|
||||||
oldByteLength: isVersionedObj ? null : oldByteLength,
|
oldByteLength: isVersionedObj ? null : oldByteLength,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
|
monitoring.bytesUploaded.inc(newByteLength);
|
||||||
|
monitoring.totalObjectNumber.inc();
|
||||||
|
monitoring.currentObjectNumber.inc();
|
||||||
return callback(null, responseHeaders);
|
return callback(null, responseHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@ const vault = require('../auth/vault');
|
||||||
const { decodeVersionId, getVersionIdResHeader }
|
const { decodeVersionId, getVersionIdResHeader }
|
||||||
= require('./apiUtils/object/versioning');
|
= require('./apiUtils/object/versioning');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format of xml request:
|
Format of xml request:
|
||||||
|
@ -301,6 +302,7 @@ function objectPutACL(authInfo, request, log, cb) {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
keys: [objectKey],
|
keys: [objectKey],
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
return cb(null, resHeaders);
|
return cb(null, resHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ const logger = require('../utilities/logger');
|
||||||
const services = require('../services');
|
const services = require('../services');
|
||||||
const setUpCopyLocator = require('./apiUtils/object/setUpCopyLocator');
|
const setUpCopyLocator = require('./apiUtils/object/setUpCopyLocator');
|
||||||
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const versionIdUtils = versioning.VersionID;
|
const versionIdUtils = versioning.VersionID;
|
||||||
|
|
||||||
|
@ -333,6 +334,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
additionalHeaders['x-amz-copy-source-version-id'] = sourceVerId;
|
additionalHeaders['x-amz-copy-source-version-id'] = sourceVerId;
|
||||||
|
monitoring.putRequest.inc();
|
||||||
// TODO push metric for objectPutCopyPart
|
// TODO push metric for objectPutCopyPart
|
||||||
// pushMetric('putObjectCopyPart', log, {
|
// pushMetric('putObjectCopyPart', log, {
|
||||||
// bucket: destBucketName,
|
// bucket: destBucketName,
|
||||||
|
|
|
@ -14,6 +14,7 @@ const { pushMetric } = require('../utapi/utilities');
|
||||||
const logger = require('../utilities/logger');
|
const logger = require('../utilities/logger');
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
const skipError = new Error('skip');
|
const skipError = new Error('skip');
|
||||||
|
|
||||||
|
@ -345,6 +346,10 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
|
||||||
newByteLength: size,
|
newByteLength: size,
|
||||||
oldByteLength: prevObjectSize,
|
oldByteLength: prevObjectSize,
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
|
monitoring.bytesUploaded.inc(size);
|
||||||
|
monitoring.totalObjectNumber.inc();
|
||||||
|
monitoring.currentObjectNumber.inc();
|
||||||
return cb(null, hexDigest, corsHeaders);
|
return cb(null, hexDigest, corsHeaders);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ const collectCorsHeaders = require('../utilities/collectCorsHeaders');
|
||||||
const metadata = require('../metadata/wrapper');
|
const metadata = require('../metadata/wrapper');
|
||||||
const { config } = require('../Config');
|
const { config } = require('../Config');
|
||||||
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
const multipleBackendGateway = require('../data/multipleBackendGateway');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
const { parseTagXml } = s3middleware.tagging;
|
const { parseTagXml } = s3middleware.tagging;
|
||||||
const REPLICATION_ACTION = 'PUT_TAGGING';
|
const REPLICATION_ACTION = 'PUT_TAGGING';
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ function objectPutTagging(authInfo, request, log, callback) {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
keys: [objectKey],
|
keys: [objectKey],
|
||||||
});
|
});
|
||||||
|
monitoring.putRequest.inc();
|
||||||
const verCfg = bucket.getVersioningConfiguration();
|
const verCfg = bucket.getVersioningConfiguration();
|
||||||
additionalResHeaders['x-amz-version-id'] =
|
additionalResHeaders['x-amz-version-id'] =
|
||||||
getVersionIdResHeader(verCfg, objectMD);
|
getVersionIdResHeader(verCfg, objectMD);
|
||||||
|
|
|
@ -2,6 +2,7 @@ const { errors } = require('arsenal');
|
||||||
|
|
||||||
const constants = require('../../constants');
|
const constants = require('../../constants');
|
||||||
const services = require('../services');
|
const services = require('../services');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format of xml response:
|
* Format of xml response:
|
||||||
|
@ -75,6 +76,7 @@ function serviceGet(authInfo, request, log, callback) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
monitoring.getRequest.inc();
|
||||||
// TODO push metric for serviceGet
|
// TODO push metric for serviceGet
|
||||||
// pushMetric('getService', log, {
|
// pushMetric('getService', log, {
|
||||||
// bucket: bucketName,
|
// bucket: bucketName,
|
||||||
|
|
|
@ -11,6 +11,7 @@ const { isObjAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _errorActions - take a number of actions once have error getting obj
|
* _errorActions - take a number of actions once have error getting obj
|
||||||
|
@ -205,6 +206,7 @@ function websiteGet(request, log, callback) {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
newByteLength: responseMetaHeaders['Content-Length'],
|
newByteLength: responseMetaHeaders['Content-Length'],
|
||||||
});
|
});
|
||||||
|
monitoring.getRequest.inc();
|
||||||
return callback(null, false, dataLocator, responseMetaHeaders);
|
return callback(null, false, dataLocator, responseMetaHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ const { isObjAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
const collectResponseHeaders = require('../utilities/collectResponseHeaders');
|
||||||
const { pushMetric } = require('../utapi/utilities');
|
const { pushMetric } = require('../utapi/utilities');
|
||||||
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
const { isBucketAuthorized } = require('./apiUtils/authorization/aclChecks');
|
||||||
|
const monitoring = require('../utilities/monitoringHandler');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _errorActions - take a number of actions once have error getting obj
|
* _errorActions - take a number of actions once have error getting obj
|
||||||
|
@ -151,6 +151,7 @@ function websiteHead(request, log, callback) {
|
||||||
pushMetric('headObject', log, {
|
pushMetric('headObject', log, {
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
});
|
});
|
||||||
|
monitoring.headRequest.inc();
|
||||||
return callback(null, responseMetaHeaders);
|
return callback(null, responseMetaHeaders);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ const http = require('http');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const cluster = require('cluster');
|
const cluster = require('cluster');
|
||||||
const arsenal = require('arsenal');
|
const arsenal = require('arsenal');
|
||||||
|
const monitoringClient = require('./utilities/monitoringHandler');
|
||||||
const { RedisClient, StatsClient } = require('arsenal').metrics;
|
const { RedisClient, StatsClient } = require('arsenal').metrics;
|
||||||
|
|
||||||
const logger = require('./utilities/logger');
|
const logger = require('./utilities/logger');
|
||||||
|
@ -248,6 +249,7 @@ function main() {
|
||||||
const server = new S3Server(cluster.worker);
|
const server = new S3Server(cluster.worker);
|
||||||
server.initiateStartup(logger.newRequestLogger());
|
server.initiateStartup(logger.newRequestLogger());
|
||||||
}
|
}
|
||||||
|
monitoringClient.collectDefaultMetrics({ timeout: 5000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = main;
|
module.exports = main;
|
||||||
|
|
|
@ -1,6 +1,49 @@
|
||||||
const errors = require('arsenal');
|
const errors = require('arsenal');
|
||||||
const client = require('prom-client');
|
const client = require('prom-client');
|
||||||
|
|
||||||
|
const collectDefaultMetrics = client.collectDefaultMetrics;
|
||||||
|
const totalBucketNumber = new client.Counter({
|
||||||
|
name: 'cloud_server_bucket_number_total',
|
||||||
|
help: 'Total number of buckets created by Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const currentBucketNumber = new client.Gauge({
|
||||||
|
name: 'cloud_server_bucket_number_current',
|
||||||
|
help: 'Current number of buckets created by Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const currentLifecycleBucketNumber = new client.Gauge({
|
||||||
|
name: 'cloud_server_bucket_lifecycle_number_current',
|
||||||
|
help: 'Current number of lifecycle buckets created by Zenko',
|
||||||
|
});
|
||||||
|
const totalObjectNumber = new client.Counter({
|
||||||
|
name: 'cloud_server_object_number_total',
|
||||||
|
help: 'Total number of objects uploaded by Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const currentObjectNumber = new client.Gauge({
|
||||||
|
name: 'cloud_server_object_number_current',
|
||||||
|
help: 'Current number of objects uploaded by Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const getRequest = new client.Counter({
|
||||||
|
name: 'cloud_server_get_request',
|
||||||
|
help: 'Number of GET requests made through Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const putRequest = new client.Counter({
|
||||||
|
name: 'cloud_server_put_request',
|
||||||
|
help: 'Number of PUT requests made through Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const deleteRequest = new client.Counter({
|
||||||
|
name: 'cloud_server_delete_request',
|
||||||
|
help: 'Number of DELETE requests made through Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
const headRequest = new client.Counter({
|
||||||
|
name: 'cloud_server_head_request',
|
||||||
|
help: 'Number of HEAD requests made through Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
|
||||||
|
const bytesUploaded = new client.Counter({
|
||||||
|
name: 'cloud_server_bytes_uploaded',
|
||||||
|
help: 'Number of bytes uploaded made through Zenko(post deployment)',
|
||||||
|
});
|
||||||
|
|
||||||
function writeResponse(res, error, log, results, cb) {
|
function writeResponse(res, error, log, results, cb) {
|
||||||
let statusCode = 200;
|
let statusCode = 200;
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -22,7 +65,6 @@ function routeHandler(req, res, log, cb) {
|
||||||
if (req.method !== 'GET') {
|
if (req.method !== 'GET') {
|
||||||
return cb(errors.BadRequest, []);
|
return cb(errors.BadRequest, []);
|
||||||
}
|
}
|
||||||
client.collectDefaultMetrics();
|
|
||||||
const promMetrics = client.register.metrics();
|
const promMetrics = client.register.metrics();
|
||||||
const contentLen = Buffer.byteLength(promMetrics, 'utf8');
|
const contentLen = Buffer.byteLength(promMetrics, 'utf8');
|
||||||
res.setHeader('content-length', contentLen);
|
res.setHeader('content-length', contentLen);
|
||||||
|
@ -62,4 +104,16 @@ function monitoringHandler(clientIP, req, res, log) {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
monitoringHandler,
|
monitoringHandler,
|
||||||
|
client,
|
||||||
|
collectDefaultMetrics,
|
||||||
|
totalBucketNumber,
|
||||||
|
currentBucketNumber,
|
||||||
|
currentLifecycleBucketNumber,
|
||||||
|
totalObjectNumber,
|
||||||
|
currentObjectNumber,
|
||||||
|
getRequest,
|
||||||
|
bytesUploaded,
|
||||||
|
putRequest,
|
||||||
|
deleteRequest,
|
||||||
|
headRequest,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue