diff --git a/x-pack/platform/plugins/shared/fleet/common/services/policy_template.test.ts b/x-pack/platform/plugins/shared/fleet/common/services/policy_template.test.ts index 770436dc50cd4..850244991dc97 100644 --- a/x-pack/platform/plugins/shared/fleet/common/services/policy_template.test.ts +++ b/x-pack/platform/plugins/shared/fleet/common/services/policy_template.test.ts @@ -351,6 +351,31 @@ describe('getNormalizedDataStreams', () => { }, ]); }); + + it('should add use_apm var with default true for otel traces input', () => { + const result = getNormalizedDataStreams({ + ...integrationPkg, + type: 'input', + policy_templates: [ + { + input: 'otelcol', + type: 'traces', + name: 'otel-traces', + template_path: 'some/path.hbl', + title: 'OTel Traces', + description: 'OTel Traces', + vars: [], + }, + ], + }); + expect(result).toHaveLength(1); + expect(result[0].streams).toHaveLength(1); + const vars = result[0].streams![0].vars; + const useApmVar = vars?.find((v) => v.name === 'use_apm'); + expect(useApmVar).toBeDefined(); + expect(useApmVar?.default).toEqual(true); + expect(useApmVar?.title).toEqual('Use Elastic APM'); + }); }); describe('filterPolicyTemplatesTiles', () => { diff --git a/x-pack/platform/plugins/shared/fleet/common/services/policy_template.ts b/x-pack/platform/plugins/shared/fleet/common/services/policy_template.ts index df32fac648702..1705568d0d7cd 100644 --- a/x-pack/platform/plugins/shared/fleet/common/services/policy_template.ts +++ b/x-pack/platform/plugins/shared/fleet/common/services/policy_template.ts @@ -36,11 +36,12 @@ const DATA_STREAM_DATASET_VAR: RegistryVarsEntry = { const DATA_STREAM_USE_APM_VAR: RegistryVarsEntry = { name: USE_APM_VAR_NAME, type: 'bool', - title: 'Use APM Server', + title: 'Use Elastic APM', description: 'enables the apm collector and processor.', multi: false, required: false, show_user: true, + default: true, }; export function packageHasNoPolicyTemplates(packageInfo: PackageInfo): boolean {