-
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] Agent configuration phase 2 (#46995)
* [APM] Agent Config Management Phase 2 * Add status indicator * Extract TimestampTooltip component * Remove unused StickyTransactionProperties component * Fix snapshot and minor cleanup * Minor cleanup * Display settings conditionally by agent name * Fix client * Format timestamp * Minor design feedback * Clear cache when clicking refresh * Fix test * Revert t() short hand * Fix translations * Add support for “all” option * Fix API tests * Move delete button to footer * Fix snapshots * Add API tests * Fix toasts * Address feedback and ensure order when searching for configs * Fix snapshots * Remove timeout
- Loading branch information
Showing
62 changed files
with
1,884 additions
and
1,565 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
x-pack/legacy/plugins/apm/common/agent_configuration_constants.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,25 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const ALL_OPTION_VALUE = 'ALL_OPTION_VALUE'; | ||
|
||
// human-readable label for the option. The "All" option should be translated. | ||
// Everything else should be returned verbatim | ||
export function getOptionLabel(value: string | undefined) { | ||
if (value === undefined || value === ALL_OPTION_VALUE) { | ||
return i18n.translate('xpack.apm.settings.agentConf.allOptionLabel', { | ||
defaultMessage: 'All' | ||
}); | ||
} | ||
|
||
return value; | ||
} | ||
|
||
export function omitAllOption(value: string) { | ||
return value === ALL_OPTION_VALUE ? undefined : value; | ||
} |
28 changes: 28 additions & 0 deletions
28
x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_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,28 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { transactionMaxSpansRt } from './index'; | ||
import { isRight } from 'fp-ts/lib/Either'; | ||
|
||
describe('transactionMaxSpans', () => { | ||
it('does not accept empty values', () => { | ||
expect(isRight(transactionMaxSpansRt.decode(undefined))).toBe(false); | ||
expect(isRight(transactionMaxSpansRt.decode(null))).toBe(false); | ||
expect(isRight(transactionMaxSpansRt.decode(''))).toBe(false); | ||
}); | ||
|
||
it('accepts both strings and numbers as values', () => { | ||
expect(isRight(transactionMaxSpansRt.decode('55'))).toBe(true); | ||
expect(isRight(transactionMaxSpansRt.decode(55))).toBe(true); | ||
}); | ||
|
||
it('checks if the number falls within 0, 32000', () => { | ||
expect(isRight(transactionMaxSpansRt.decode(0))).toBe(true); | ||
expect(isRight(transactionMaxSpansRt.decode(32000))).toBe(true); | ||
expect(isRight(transactionMaxSpansRt.decode(-55))).toBe(false); | ||
expect(isRight(transactionMaxSpansRt.decode(NaN))).toBe(false); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
x-pack/legacy/plugins/apm/common/runtime_types/transaction_max_spans_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,19 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const transactionMaxSpansRt = new t.Type<number, number, unknown>( | ||
'transactionMaxSpans', | ||
t.number.is, | ||
(input, context) => { | ||
const value = parseInt(input as string, 10); | ||
return value >= 0 && value <= 32000 | ||
? t.success(value) | ||
: t.failure(input, context); | ||
}, | ||
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
Oops, something went wrong.