Skip to content

Commit 22ee5d0

Browse files
cauemarcondeskibanamachineclaude
authored
02 - Spacetime apm common (#268991)
## Summary Extracts agent configuration definitions from the `apm` plugin into the `@kbn/apm-common` package (`x-pack/platform/packages/shared/kbn-apm-common`). This moves agent configuration types, constants, runtime types (duration, bytes, boolean, integer, capture body, etc.), setting definitions (general, Java, mobile, eDOT SDK), and related tests out of `x-pack/solutions/observability/plugins/apm/common/agent_configuration/` into the shared platform package. The APM plugin files now re-export from `@kbn/apm-common` to maintain backwards compatibility. The package is placed under `x-pack/` since its only consumer is the APM plugin, which is already in x-pack. This is the second PR in a stack: - **PR 1:** [01 - Spacetime apm types](#268981) - **PR 2 (this):** Move agent configuration definitions to `@kbn/apm-common` - **PR 3:** [03 - Spacetime apm api shared](#268992) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fa33f18 commit 22ee5d0

73 files changed

Lines changed: 1084 additions & 1258 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ x-pack/platform/packages/shared/kbn-ai-assistant @elastic/search-kibana @elastic
10181018
x-pack/platform/packages/shared/kbn-ai-tools @elastic/appex-ai-infra
10191019
x-pack/platform/packages/shared/kbn-ai-tools-cli @elastic/appex-ai-infra
10201020
x-pack/platform/packages/shared/kbn-alerting-comparators @elastic/response-ops
1021+
x-pack/platform/packages/shared/kbn-apm-common @elastic/obs-presentation-team @elastic/obs-exploration-team
10211022
x-pack/platform/packages/shared/kbn-apm-types @elastic/obs-presentation-team @elastic/obs-exploration-team
10221023
x-pack/platform/packages/shared/kbn-change-history @elastic/security-detection-rule-management
10231024
x-pack/platform/packages/shared/kbn-classic-stream-flyout @elastic/kibana-management

.i18nrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"alertsUIShared": "src/platform/packages/shared/kbn-alerts-ui-shared/src",
77
"alertingTypes": "src/platform/packages/shared/kbn-alerting-types",
88
"apmOss": "src/plugins/apm_oss",
9+
"apmCommon": "x-pack/platform/packages/shared/kbn-apm-common",
10+
"apmTypes": "x-pack/platform/packages/shared/kbn-apm-types",
911
"autocomplete": "x-pack/solutions/security/packages/kbn-securitysolution-autocomplete/src",
1012
"avcBanner": "src/platform/packages/shared/kbn-avc-banner/src",
1113
"cases": [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@
240240
"@kbn/anonymization-common": "link:x-pack/platform/packages/shared/ai-infra/anonymization-common",
241241
"@kbn/anonymization-plugin": "link:x-pack/platform/plugins/shared/anonymization",
242242
"@kbn/anonymization-ui": "link:x-pack/platform/packages/shared/ai-infra/anonymization-ui",
243+
"@kbn/apm-common": "link:x-pack/platform/packages/shared/kbn-apm-common",
243244
"@kbn/apm-config-loader": "link:src/platform/packages/private/kbn-apm-config-loader",
244245
"@kbn/apm-data-access-plugin": "link:x-pack/solutions/observability/plugins/apm_data_access",
245246
"@kbn/apm-data-view": "link:src/platform/packages/shared/kbn-apm-data-view",

tsconfig.base.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140
"@kbn/anonymization-ui/*": ["x-pack/platform/packages/shared/ai-infra/anonymization-ui/*"],
141141
"@kbn/api-contracts": ["packages/kbn-api-contracts"],
142142
"@kbn/api-contracts/*": ["packages/kbn-api-contracts/*"],
143+
"@kbn/apm-common": ["x-pack/platform/packages/shared/kbn-apm-common"],
144+
"@kbn/apm-common/*": ["x-pack/platform/packages/shared/kbn-apm-common/*"],
143145
"@kbn/apm-config-loader": ["src/platform/packages/private/kbn-apm-config-loader"],
144146
"@kbn/apm-config-loader/*": ["src/platform/packages/private/kbn-apm-config-loader/*"],
145147
"@kbn/apm-data-access-plugin": ["x-pack/solutions/observability/plugins/apm_data_access"],
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
// Configuration types
9+
export type {
10+
AgentConfigurationIntake,
11+
AgentConfiguration,
12+
} from './src/agent_configuration/configuration_types';
13+
14+
// Constants
15+
export {
16+
AgentConfigurationPageStep,
17+
agentConfigurationPageStepRt,
18+
} from './src/agent_configuration/constants';
19+
20+
// All option
21+
export {
22+
ALL_OPTION_VALUE,
23+
ALL_OPTION,
24+
getOptionLabel,
25+
omitAllOption,
26+
} from './src/agent_configuration/all_option';
27+
28+
// Amount and unit
29+
export {
30+
type AmountAndUnit,
31+
amountAndUnitToObject,
32+
amountAndUnitToString,
33+
} from './src/agent_configuration/amount_and_unit';
34+
35+
// Runtime types
36+
export {
37+
serviceRt,
38+
settingsRt,
39+
agentConfigurationIntakeRt,
40+
} from './src/agent_configuration/runtime_types/agent_configuration_intake_rt';
41+
export { booleanRt } from './src/agent_configuration/runtime_types/boolean_rt';
42+
export { captureBodyRt } from './src/agent_configuration/runtime_types/capture_body_rt';
43+
export { logLevelRt } from './src/agent_configuration/runtime_types/log_level_rt';
44+
export { logEcsReformattingRt } from './src/agent_configuration/runtime_types/log_ecs_reformatting_rt';
45+
export { traceContinuationStrategyRt } from './src/agent_configuration/runtime_types/trace_continuation_strategy_rt';
46+
export { loggingLevelRt } from './src/agent_configuration/runtime_types/logging_level_rt';
47+
export { floatThreeDecimalPlacesRt } from './src/agent_configuration/runtime_types/float_three_decimal_places_rt';
48+
export { floatFourDecimalPlacesRt } from './src/agent_configuration/runtime_types/float_four_decimal_places_rt';
49+
export { getIntegerRt } from './src/agent_configuration/runtime_types/integer_rt';
50+
export { getDurationRt } from './src/agent_configuration/runtime_types/duration_rt';
51+
export { getBytesRt } from './src/agent_configuration/runtime_types/bytes_rt';
52+
export { getStorageSizeRt } from './src/agent_configuration/runtime_types/storage_size_rt';
53+
export { getRangeTypeMessage } from './src/agent_configuration/runtime_types/get_range_type_message';
54+
55+
// Setting definitions
56+
export {
57+
settingDefinitions,
58+
filterByAgent,
59+
validateSetting,
60+
} from './src/agent_configuration/setting_definitions';
61+
export type {
62+
SettingValidation,
63+
RawSettingDefinition,
64+
SettingDefinition,
65+
} from './src/agent_configuration/setting_definitions/types';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
module.exports = {
9+
preset: '@kbn/test',
10+
rootDir: '../../../../..',
11+
roots: ['<rootDir>/x-pack/platform/packages/shared/kbn-apm-common'],
12+
coverageDirectory:
13+
'<rootDir>/target/kibana-coverage/jest/x-pack/platform/packages/shared/kbn-apm-common',
14+
coverageReporters: ['text', 'html'],
15+
collectCoverageFrom: [
16+
'<rootDir>/x-pack/platform/packages/shared/kbn-apm-common/src/**/*.{js,ts,tsx}',
17+
],
18+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"type": "shared-common",
3+
"id": "@kbn/apm-common",
4+
"owner": [
5+
"@elastic/obs-presentation-team",
6+
"@elastic/obs-exploration-team"
7+
],
8+
"group": "platform",
9+
"visibility": "shared"
10+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This file is generated by the @kbn/moon package. Any manual edits will be erased!
2+
# To extend this, write your extensions/overrides to 'moon.extend.yml'
3+
# then regenerate this file with: 'node scripts/regenerate_moon_projects.js --update --filter @kbn/apm-common'
4+
5+
$schema: https://moonrepo.dev/schemas/project.json
6+
id: '@kbn/apm-common'
7+
layer: unknown
8+
owners:
9+
defaultOwner: '@elastic/obs-presentation-team'
10+
toolchains:
11+
default: node
12+
language: typescript
13+
project:
14+
title: '@kbn/apm-common'
15+
description: Moon project for @kbn/apm-common
16+
channel: ''
17+
owner: '@elastic/obs-presentation-team'
18+
sourceRoot: x-pack/platform/packages/shared/kbn-apm-common
19+
dependsOn:
20+
- '@kbn/i18n'
21+
- '@kbn/elastic-agent-utils'
22+
tags:
23+
- shared-common
24+
- package
25+
- prod
26+
- group-platform
27+
- shared
28+
- jest-unit-tests
29+
fileGroups:
30+
src:
31+
- '**/*.ts'
32+
- '**/*.tsx'
33+
- '!target/**/*'
34+
jest-config:
35+
- jest.config.js
36+
tasks: {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@kbn/apm-common",
3+
"private": true,
4+
"version": "1.0.0",
5+
"license": "Elastic License 2.0"
6+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { i18n } from '@kbn/i18n';
9+
10+
export const ALL_OPTION_VALUE = 'ALL_OPTION_VALUE';
11+
12+
export function getOptionLabel(value: string | undefined) {
13+
if (value === undefined || value === ALL_OPTION_VALUE) {
14+
return i18n.translate('apmCommon.agentConfig.allOptionLabel', {
15+
defaultMessage: 'All',
16+
});
17+
}
18+
return value;
19+
}
20+
21+
export function omitAllOption(value?: string) {
22+
return value === ALL_OPTION_VALUE ? undefined : value;
23+
}
24+
25+
export const ALL_OPTION = {
26+
value: ALL_OPTION_VALUE,
27+
label: getOptionLabel(ALL_OPTION_VALUE),
28+
};

0 commit comments

Comments
 (0)