[8.7] Mobile central config (#152782) (#153440)

# Backport

This will backport the following commits from `main` to `8.7`:
- [Mobile central config
(#152782)](https://github.com/elastic/kibana/pull/152782)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"LikeTheSalad","email":"56847527+LikeTheSalad@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-03-22T12:01:46Z","message":"Mobile
central config (#152782)\n\n## Summary\r\n\r\nAdding mobile agents'
central configuration parameter to toggle\r\nautomatic instrumentation
on/off as
specified\r\n[here](https://github.com/elastic/apm/pull/771).\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2b425b6ce4ed34fef8e9184ea9e598e076a3e8b3","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:APM","v8.7.0","v8.8.0"],"number":152782,"url":"https://github.com/elastic/kibana/pull/152782","mergeCommit":{"message":"Mobile
central config (#152782)\n\n## Summary\r\n\r\nAdding mobile agents'
central configuration parameter to toggle\r\nautomatic instrumentation
on/off as
specified\r\n[here](https://github.com/elastic/apm/pull/771).\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2b425b6ce4ed34fef8e9184ea9e598e076a3e8b3"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152782","number":152782,"mergeCommit":{"message":"Mobile
central config (#152782)\n\n## Summary\r\n\r\nAdding mobile agents'
central configuration parameter to toggle\r\nautomatic instrumentation
on/off as
specified\r\n[here](https://github.com/elastic/apm/pull/771).\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2b425b6ce4ed34fef8e9184ea9e598e076a3e8b3"}}]}]
BACKPORT-->

Co-authored-by: LikeTheSalad <56847527+LikeTheSalad@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-03-22 09:11:49 -04:00 committed by GitHub
parent f6f061e47a
commit 11a8620c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 8 deletions

View file

@ -27,7 +27,16 @@ export const generalSettings: RawSettingDefinition[] = [
'The maximum total compressed size of the request body which is sent to the APM Server intake api via a chunked encoding (HTTP streaming).\nNote that a small overshoot is possible.\n\nAllowed byte units are `b`, `kb` and `mb`. `1kb` is equal to `1024b`.',
}
),
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'],
excludeAgents: [
'js-base',
'rum-js',
'dotnet',
'go',
'nodejs',
'php',
'android/java',
'iOS/swift',
],
},
// API Request Time
@ -45,7 +54,16 @@ export const generalSettings: RawSettingDefinition[] = [
"Maximum time to keep an HTTP request to the APM Server open for.\n\nNOTE: This value has to be lower than the APM Server's `read_timeout` setting.",
}
),
excludeAgents: ['js-base', 'rum-js', 'dotnet', 'go', 'nodejs', 'php'],
excludeAgents: [
'js-base',
'rum-js',
'dotnet',
'go',
'nodejs',
'php',
'android/java',
'iOS/swift',
],
},
// Capture body
@ -70,7 +88,7 @@ export const generalSettings: RawSettingDefinition[] = [
{ text: 'transactions', value: 'transactions' },
{ text: 'all', value: 'all' },
],
excludeAgents: ['js-base', 'rum-js', 'php'],
excludeAgents: ['js-base', 'rum-js', 'php', 'android/java', 'iOS/swift'],
},
{
@ -111,7 +129,14 @@ export const generalSettings: RawSettingDefinition[] = [
'If set to `true`, the agent will capture HTTP request and response headers (including cookies), as well as message headers/properties when using messaging frameworks (like Kafka).\n\nNOTE: Setting this to `false` reduces network bandwidth, disk space and object allocations.',
}
),
excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'],
excludeAgents: [
'js-base',
'rum-js',
'nodejs',
'php',
'android/java',
'iOS/swift',
],
},
{
@ -310,7 +335,14 @@ export const generalSettings: RawSettingDefinition[] = [
'In its default settings, the APM agent will collect a stack trace with every recorded span.\nWhile this is very helpful to find the exact place in your code that causes the span, collecting this stack trace does have some overhead. \nWhen setting this option to a negative value, like `-1ms`, stack traces will be collected for all spans. Setting it to a positive value, e.g. `5ms`, will limit stack trace collection to spans with durations equal to or longer than the given value, e.g. 5 milliseconds.\n\nTo disable stack trace collection for spans completely, set the value to `0ms`.',
}
),
excludeAgents: ['js-base', 'rum-js', 'nodejs', 'php'],
excludeAgents: [
'js-base',
'rum-js',
'nodejs',
'php',
'android/java',
'iOS/swift',
],
},
// STACK_TRACE_LIMIT
@ -385,7 +417,7 @@ export const generalSettings: RawSettingDefinition[] = [
'Limits the amount of spans that are recorded per transaction.',
}
),
excludeAgents: ['js-base', 'rum-js'],
excludeAgents: ['js-base', 'rum-js', 'android/java', 'iOS/swift'],
},
// Transaction sample rate
@ -403,6 +435,7 @@ export const generalSettings: RawSettingDefinition[] = [
'By default, the agent will sample every transaction (e.g. request to your service). To reduce overhead and storage requirements, you can set the sample rate to a value between 0.0 and 1.0. We still record overall time and the result for unsampled transactions, but not context information, labels, or spans.',
}
),
excludeAgents: ['android/java', 'iOS/swift'],
},
// Sanitize field names

View file

@ -180,6 +180,14 @@ describe('filterByAgent', () => {
);
});
it('android/java', () => {
expect(getSettingKeysForAgent('android/java')).toEqual(['recording']);
});
it('iOS/swift', () => {
expect(getSettingKeysForAgent('iOS/swift')).toEqual(['recording']);
});
it('"All" services (no agent name)', () => {
expect(getSettingKeysForAgent(undefined)).toEqual(
expect.arrayContaining([

View file

@ -12,7 +12,7 @@ import { PathReporter } from 'io-ts/lib/PathReporter';
import { AgentName } from '../../../typings/es_schemas/ui/fields/agent';
import { booleanRt } from '../runtime_types/boolean_rt';
import { getIntegerRt } from '../runtime_types/integer_rt';
import { isRumAgentName } from '../../agent_name';
import { isRumOrMobileAgent } from '../../agent_name';
import { floatRt } from '../runtime_types/float_rt';
import { RawSettingDefinition, SettingDefinition } from './types';
import { generalSettings } from './general_settings';
@ -105,7 +105,7 @@ export function filterByAgent(agentName?: AgentName) {
// only options that apply to every agent (ignoring RUM) should be returned
if (setting.excludeAgents) {
return setting.excludeAgents.every(isRumAgentName);
return setting.excludeAgents.every(isRumOrMobileAgent);
}
return true;

View file

@ -73,6 +73,10 @@ export function isMobileAgentName(agentName?: string) {
return isIosAgentName(agentName) || isAndroidAgentName(agentName);
}
export function isRumOrMobileAgent(agentName?: string) {
return isRumAgentName(agentName) || isMobileAgentName(agentName);
}
export function isIosAgentName(agentName?: string) {
const lowercased = agentName && agentName.toLowerCase();
return lowercased === 'ios/swift';