-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Adding comparison to throughput chart (#90128)
Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Dario Gieselaar <[email protected]>
- Loading branch information
1 parent
f980405
commit 874fadf
Showing
25 changed files
with
1,454 additions
and
182 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
x-pack/plugins/apm/common/runtime_types/date_as_string_rt/index.test.ts
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/apm/common/runtime_types/iso_to_epoch_rt/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { isoToEpochRt } from './index'; | ||
import { isRight } from 'fp-ts/lib/Either'; | ||
|
||
describe('isoToEpochRt', () => { | ||
it('validates whether its input is a valid ISO timestamp', () => { | ||
expect(isRight(isoToEpochRt.decode(1566299881499))).toBe(false); | ||
|
||
expect(isRight(isoToEpochRt.decode('2019-08-20T11:18:31.407Z'))).toBe(true); | ||
}); | ||
|
||
it('decodes valid ISO timestamps to epoch time', () => { | ||
const iso = '2019-08-20T11:18:31.407Z'; | ||
const result = isoToEpochRt.decode(iso); | ||
|
||
if (isRight(result)) { | ||
expect(result.right).toBe(new Date(iso).getTime()); | ||
} else { | ||
fail(); | ||
} | ||
}); | ||
|
||
it('encodes epoch time to ISO string', () => { | ||
expect(isoToEpochRt.encode(1566299911407)).toBe('2019-08-20T11:18:31.407Z'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/apm/common/runtime_types/to_boolean_rt/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const toBooleanRt = new t.Type<boolean, unknown, unknown>( | ||
'ToBoolean', | ||
t.boolean.is, | ||
(input) => { | ||
let value: boolean; | ||
if (typeof input === 'string') { | ||
value = input === 'true'; | ||
} else { | ||
value = !!input; | ||
} | ||
|
||
return t.success(value); | ||
}, | ||
t.identity | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.