-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into allow-rules-bulk-upgrade-with-solvable-confl…
…icts
- Loading branch information
Showing
42 changed files
with
1,471 additions
and
422 deletions.
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
src/platform/packages/shared/kbn-elastic-agent-utils/src/agent_ingestion_path.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,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
export const getIngestionPath = (hasOpenTelemetryFields: boolean) => | ||
hasOpenTelemetryFields ? 'otel_native' : 'classic_apm'; |
61 changes: 61 additions & 0 deletions
61
src/platform/packages/shared/kbn-elastic-agent-utils/src/agent_sdk_name_and_language.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,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { getSdkNameAndLanguage } from './agent_sdk_name_and_language'; | ||
|
||
describe('getSdkNameAndLanguage', () => { | ||
it.each([ | ||
{ | ||
agentName: 'java', | ||
result: { sdkName: 'apm', language: 'java' }, | ||
}, | ||
{ | ||
agentName: 'iOS/swift', | ||
result: { sdkName: 'apm', language: 'iOS/swift' }, | ||
}, | ||
{ | ||
agentName: 'android/java', | ||
result: { sdkName: 'apm', language: 'android/java' }, | ||
}, | ||
{ | ||
agentName: 'opentelemetry/java/test/elastic', | ||
result: { sdkName: 'edot', language: 'java' }, | ||
}, | ||
{ | ||
agentName: 'opentelemetry/java/elastic', | ||
result: { sdkName: 'edot', language: 'java' }, | ||
}, | ||
{ | ||
agentName: 'otlp/nodejs', | ||
result: { sdkName: 'otel_other', language: 'nodejs' }, | ||
}, | ||
{ | ||
agentName: 'otlp', | ||
result: { sdkName: 'otel_other', language: undefined }, | ||
}, | ||
{ | ||
agentName: 'test/test/test/something-else/elastic', | ||
result: { sdkName: undefined, language: undefined }, | ||
}, | ||
{ | ||
agentName: 'test/java/test/something-else/', | ||
result: { sdkName: undefined, language: undefined }, | ||
}, | ||
{ | ||
agentName: 'elastic', | ||
result: { sdkName: undefined, language: undefined }, | ||
}, | ||
{ | ||
agentName: 'my-awesome-agent/otel', | ||
result: { sdkName: undefined, language: undefined }, | ||
}, | ||
])('for the agent name $agentName returns $result', ({ agentName, result }) => { | ||
expect(getSdkNameAndLanguage(agentName)).toStrictEqual(result); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
src/platform/packages/shared/kbn-elastic-agent-utils/src/agent_sdk_name_and_language.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,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { isElasticAgentName, isOpenTelemetryAgentName } from './agent_guards'; | ||
|
||
interface SdkNameAndLanguage { | ||
sdkName?: 'apm' | 'edot' | 'otel_other'; | ||
language?: string; | ||
} | ||
|
||
const LANGUAGE_INDEX = 1; | ||
|
||
export const getSdkNameAndLanguage = (agentName: string): SdkNameAndLanguage => { | ||
if (isElasticAgentName(agentName)) { | ||
return { sdkName: 'apm', language: agentName }; | ||
} | ||
const agentNameParts = agentName.split('/'); | ||
|
||
if (isOpenTelemetryAgentName(agentName)) { | ||
if (agentNameParts[agentNameParts.length - 1] === 'elastic') { | ||
return { sdkName: 'edot', language: agentNameParts[LANGUAGE_INDEX] }; | ||
} | ||
return { | ||
sdkName: 'otel_other', | ||
language: agentNameParts[LANGUAGE_INDEX], | ||
}; | ||
} | ||
|
||
return { sdkName: undefined, language: undefined }; | ||
}; |
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.