From b98d7fb4c2e7bfb9c42f93e9595758a511fe8f44 Mon Sep 17 00:00:00 2001 From: Achyut Jhunjhunwala Date: Fri, 13 Oct 2023 16:49:33 +0200 Subject: [PATCH] [APM] Fix issue with onboarding page around java agent (#168816) ## Summary Closes - https://github.com/elastic/kibana/issues/168659 Closes - https://github.com/elastic/kibana/issues/168348 ### After Screenshot 2023-10-13 at 10 27 44 --- .../commands/get_apm_agent_commands.test.ts | 12 ++++++------ .../components/app/onboarding/commands/java.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/onboarding/commands/get_apm_agent_commands.test.ts b/x-pack/plugins/apm/public/components/app/onboarding/commands/get_apm_agent_commands.test.ts index b26c8da82d916..1938cf7722cb0 100644 --- a/x-pack/plugins/apm/public/components/app/onboarding/commands/get_apm_agent_commands.test.ts +++ b/x-pack/plugins/apm/public/components/app/onboarding/commands/get_apm_agent_commands.test.ts @@ -25,10 +25,10 @@ describe('getCommands', () => { }); expect(commands).toMatchInlineSnapshot(` "java -javaagent:/path/to/elastic-apm-agent-.jar \\\\ - -Delastic.apm.service_name= \\\\\\\\ + -Delastic.apm.service_name= \\\\ -Delastic.apm.api_key= \\\\ -Delastic.apm.server_url= \\\\ - -Delastic.apm.environment= \\\\\\\\ + -Delastic.apm.environment= \\\\ -Delastic.apm.application_packages=org.example \\\\ -jar my-service-name.jar" `); @@ -42,10 +42,10 @@ describe('getCommands', () => { expect(commands).not.toBe(''); expect(commands).toMatchInlineSnapshot(` "java -javaagent:/path/to/elastic-apm-agent-.jar \\\\ - -Delastic.apm.service_name= \\\\\\\\ + -Delastic.apm.service_name= \\\\ -Delastic.apm.secret_token=foobar \\\\ -Delastic.apm.server_url=localhost:8220 \\\\ - -Delastic.apm.environment= \\\\\\\\ + -Delastic.apm.environment= \\\\ -Delastic.apm.application_packages=org.example \\\\ -jar my-service-name.jar" `); @@ -60,10 +60,10 @@ describe('getCommands', () => { expect(commands).not.toBe(''); expect(commands).toMatchInlineSnapshot(` "java -javaagent:/path/to/elastic-apm-agent-.jar \\\\ - -Delastic.apm.service_name= \\\\\\\\ + -Delastic.apm.service_name= \\\\ -Delastic.apm.secret_token=foobar \\\\ -Delastic.apm.server_url=localhost:8220 \\\\ - -Delastic.apm.environment= \\\\\\\\ + -Delastic.apm.environment= \\\\ -Delastic.apm.application_packages=org.example \\\\ -jar my-service-name.jar" `); diff --git a/x-pack/plugins/apm/public/components/app/onboarding/commands/java.ts b/x-pack/plugins/apm/public/components/app/onboarding/commands/java.ts index fd8ffec78e29d..590e62b42d68d 100644 --- a/x-pack/plugins/apm/public/components/app/onboarding/commands/java.ts +++ b/x-pack/plugins/apm/public/components/app/onboarding/commands/java.ts @@ -6,17 +6,17 @@ */ import { - serviceNameHint, + apiKeyHint, secretTokenHint, serverUrlHint, serviceEnvironmentHint, - apiKeyHint, + serviceNameHint, } from './shared_hints'; export const javaVariables = (secretToken?: string) => ({ - ...(secretToken && { secretToken: 'Delastic.apm.secret_token' }), - ...(!secretToken && { apiKey: 'Delastic.apm.api_key' }), - apmServerUrl: 'Delastic.apm.server_url', + ...(secretToken && { secretToken: 'elastic.apm.secret_token' }), + ...(!secretToken && { apiKey: 'elastic.apm.api_key' }), + apmServerUrl: 'elastic.apm.server_url', }); export const javaHighlightLang = 'java'; @@ -32,7 +32,7 @@ export const javaLineNumbers = (apiKey?: string | null) => ({ }, }); export const java = `java -javaagent:/path/to/elastic-apm-agent-.jar \\ --Delastic.apm.service_name= \\\\ +-Delastic.apm.service_name= \\ {{^secretToken}} -Delastic.apm.api_key={{{apiKey}}} \\ {{/secretToken}} @@ -40,6 +40,6 @@ export const java = `java -javaagent:/path/to/elastic-apm-agent-.jar \\ -Delastic.apm.secret_token={{{secretToken}}} \\ {{/secretToken}} -Delastic.apm.server_url={{{apmServerUrl}}} \\ --Delastic.apm.environment= \\\\ +-Delastic.apm.environment= \\ -Delastic.apm.application_packages=org.example \\ -jar my-service-name.jar`;