-
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 error-case-show-sidebar
- Loading branch information
Showing
52 changed files
with
1,531 additions
and
383 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,4 @@ | |
"name": "security_detection_engine", | ||
"version": "8.4.1" | ||
} | ||
] | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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 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 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { Entity } from '../entity'; | ||
import { ApmFields } from './apm_fields'; | ||
import { MobileDevice } from './mobile_device'; | ||
import { generateLongId } from '../utils/generate_id'; | ||
|
||
type MobileAgentName = 'android/java' | 'iOS/swift'; | ||
|
||
export class MobileApp extends Entity<ApmFields> { | ||
mobileDevice(deviceId?: string) { | ||
return new MobileDevice({ | ||
...this.fields, | ||
'device.id': deviceId ? deviceId : generateLongId(), | ||
'service.language.name': this.fields['agent.name'] === 'iOS' ? 'swift' : 'java', | ||
'service.version': this.fields['service.version'] ?? '1.0', | ||
}).startNewSession(); | ||
} | ||
} | ||
|
||
export function mobileApp(name: string, environment: string, agentName: MobileAgentName): MobileApp; | ||
|
||
export function mobileApp(options: { | ||
name: string; | ||
environment: string; | ||
agentName: MobileAgentName; | ||
}): MobileApp; | ||
|
||
export function mobileApp( | ||
...args: | ||
| [{ name: string; environment: string; agentName: MobileAgentName }] | ||
| [string, string, MobileAgentName] | ||
) { | ||
const [name, environment, agentName] = | ||
args.length === 1 ? [args[0].name, args[0].environment, args[0].agentName] : args; | ||
|
||
return new MobileApp({ | ||
'service.name': name, | ||
'service.environment': environment, | ||
'agent.name': agentName, | ||
}); | ||
} |
Oops, something went wrong.