Pitometer
Pitometer is a Node.js module that helps you to qualify the overal performance
or quality of applications using a well defined specificaton format.
The specification is done using the Perfspec format which is a declarative way to
define which metrics you want to pay attention to, the sources to collect
them from and how to grade/interpret the results.
Pitometer is pluggable and accepts different sources and grading mechanisms.
Right now, source plugins for Dynatrace and Prometheus and a grader for thresholds
are available but it's easy to write new sources and graders.
Quickstart
-
Run npm install -S @keptn/pitometer
to install it
into your Node.js project.
-
Install a grader and sources:
npm install -S @keptn/pitometer-grader-threshold
npm install -S @keptn/pitometer-source-prometheus
npm install -S @keptn/pitometer-source-dynatrace
- Require, configure and register all components and
run the Perfspec file.
const Pitometer = require('@keptn/pitometer').Pitometer;
const DynatraceSource = require('@keptn/source-dynatrace').Source;
const PrometheusSource = require('@keptn/source-prometheus').Source;
const ThresholdGrader = require('@keptn/grader-threshold').Grader;
const pitometer = new Pitometer();
pitometer.addSource('Prometheus', new PrometheusSource({
queryUrl: '<PROMETHEUS_PROMQL_ENDPOINT>',
}));
pitometer.addSource('Dynatrace', new DynatraceSource({
baseUrl: '<DYNATRACE_ENVIRONMENT_URL>',
apiToken: '<DYNATRACE_API_TOKEN>',
}));
pitometer.addGrader('Threshold', new ThresholdGrader());
const perfspec = require('./samples/perfspec-sample.json');
pitometer.run(perfspec, {
context: 'Optional context that is passed to all sources and graders',
timeStart: START_TIME_IN_SECONDS,
timeEnd: END_TIME_IN_SECONDS,
})
.then((results) => console.log(JSON.stringify(results)))
.catch((err) => console.error(err));
API Documentation
The API documentation can be found here.