Skip to content

Commit

Permalink
[APM] Script for metric aggregation (#67964)
Browse files Browse the repository at this point in the history
* [APM] Script for metric aggregation

* Retry mechanism

* Docs/comments

* compress histogram; support --filter & --only parameters

* Add flag for significant figures

* Ignore apm scripts

* Add tsconfig project for apm/scripts
  • Loading branch information
dgieselaar committed Jun 25, 2020
1 parent 1ae5d32 commit 42b87c0
Show file tree
Hide file tree
Showing 12 changed files with 704 additions and 115 deletions.
4 changes: 4 additions & 0 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const PROJECTS = [
name: 'apm/cypress',
disableTypeCheck: true,
}),
new Project(resolve(REPO_ROOT, 'x-pack/plugins/apm/scripts/tsconfig.json'), {
name: 'apm/scripts',
disableTypeCheck: true,
}),

// NOTE: using glob.sync rather than glob-all or globby
// because it takes less than 10 ms, while the other modules
Expand Down
31 changes: 31 additions & 0 deletions x-pack/plugins/apm/scripts/aggregate-latency-metrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
// eslint-disable-next-line import/no-extraneous-dependencies
require('@babel/register')({
extensions: ['.ts'],
plugins: [
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
presets: [
'@babel/typescript',
['@babel/preset-env', { targets: { node: 'current' } }],
],
});

const {
aggregateLatencyMetrics,
} = require('./aggregate-latency-metrics/index.ts');

aggregateLatencyMetrics().catch((err) => {
if (err.meta && err.meta.body) {
// error from elasticsearch client
console.error(err.meta.body);
} else {
console.error(err);
}
process.exit(1);
});
Loading

0 comments on commit 42b87c0

Please sign in to comment.