-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM] Agent configuration GA #46995
Merged
sorenlouv
merged 23 commits into
elastic:master
from
sorenlouv:apm-acm-extended-options
Oct 10, 2019
Merged
[APM] Agent configuration GA #46995
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f9ef4bb
[APM] Agent Config Management Phase 2
sorenlouv d77f700
Add status indicator
sorenlouv 97b0133
Extract TimestampTooltip component
sorenlouv dcabc90
Remove unused StickyTransactionProperties component
sorenlouv 2704892
Fix snapshot and minor cleanup
sorenlouv f409499
Minor cleanup
sorenlouv 12f15c8
Display settings conditionally by agent name
sorenlouv 3c1ba8e
Fix client
sorenlouv fe4b077
Format timestamp
sorenlouv 77fb633
Minor design feedback
sorenlouv 55da360
Clear cache when clicking refresh
sorenlouv 869d521
Fix test
sorenlouv a34954a
Revert t() short hand
sorenlouv 15e1e31
Fix translations
sorenlouv f7aac55
Add support for “all” option
sorenlouv 7410fb3
Fix API tests
sorenlouv 35c734b
Move delete button to footer
sorenlouv 2e5dc14
Fix snapshots
sorenlouv 7dec317
Add API tests
sorenlouv 26402e5
Fix toasts
sorenlouv 3d60b96
Address feedback and ensure order when searching for configs
sorenlouv 021c174
Fix snapshots
sorenlouv cb9183f
Remove timeout
sorenlouv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, why
parseFloat
? because it's more permissive thanNumber
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opposite actually. Due to coercion
Number('') => 0
whereasparseFloat('') => NaN
.I wanted to disallow empty values.