@hyperledger/caliper-core
Advanced tools
Comparing version 0.5.0-unstable-20220323105926 to 0.5.0-unstable-20220324180635
@@ -152,8 +152,9 @@ /* | ||
}); | ||
res.on('error', err => { | ||
Logger.error(err); | ||
reject(err); | ||
}); | ||
}); | ||
req.on('error', err => { | ||
Logger.error(err); | ||
reject(err); | ||
}); | ||
req.end(); | ||
@@ -160,0 +161,0 @@ }); |
@@ -68,3 +68,3 @@ /* | ||
*/ | ||
getQueryClient(){ | ||
getQueryClient() { | ||
return this.prometheusQueryClient; | ||
@@ -78,3 +78,3 @@ } | ||
async start() { | ||
this.startTime = Date.now()/1000; | ||
this.startTime = Date.now() / 1000; | ||
} | ||
@@ -119,3 +119,3 @@ | ||
async getStatistics(testLabel) { | ||
this.endTime = Date.now()/1000; | ||
this.endTime = Date.now() / 1000; | ||
@@ -137,4 +137,11 @@ const resourceStats = []; | ||
const queryString = PrometheusQueryHelper.buildStringRangeQuery(queryObject.query, this.startTime, this.endTime, queryObject.step); | ||
const response = await this.prometheusQueryClient.getByEncodedUrl(queryString); | ||
let response; | ||
try { | ||
response = await this.prometheusQueryClient.getByEncodedUrl(queryString); | ||
} catch (error) { | ||
Logger.warn('Failed to connect to Prometheus, unable to perform queries'); | ||
break; | ||
} | ||
// Retrieve map of component names and corresponding values for the issued query | ||
@@ -153,3 +160,3 @@ const componentNameValueMap = PrometheusQueryHelper.extractStatisticFromRange(response, queryObject.statistic, queryObject.label); | ||
const multiplier = queryObject.multiplier ? queryObject.multiplier : 1; | ||
watchItemStat.set('Value', (value*multiplier).toPrecision(this.precision)); | ||
watchItemStat.set('Value', (value * multiplier).toPrecision(this.precision)); | ||
// Store | ||
@@ -160,3 +167,3 @@ resourceStats.push(watchItemStat); | ||
const metricMap = new Map(); | ||
metricMap.set('Name', watchItemStat.get('Name')); | ||
metricMap.set('Name', watchItemStat.get('Name')); | ||
metricMap.set(queryObject.name, watchItemStat.get('Value')); | ||
@@ -163,0 +170,0 @@ metricArray.push(metricMap); |
{ | ||
"name": "@hyperledger/caliper-core", | ||
"description": "Core Hyperledger Caliper module, used for running performance benchmarks that interact with blockchain technologies", | ||
"version": "0.5.0-unstable-20220323105926", | ||
"version": "0.5.0-unstable-20220324180635", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
454610
10290