-
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.
- externalizes getApmPackagePolicies for reusability
- parallelizes operations for improved performance
- Loading branch information
Showing
2 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/apm/server/lib/fleet/get_apm_package_policies.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,30 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { | ||
CoreSetup, | ||
CoreStart, | ||
SavedObjectsClientContract, | ||
} from 'kibana/server'; | ||
import { APMPluginStartDependencies } from '../../types'; | ||
import { getInternalSavedObjectsClient } from '../helpers/get_internal_saved_objects_client'; | ||
|
||
export async function getApmPackgePolicies({ | ||
core, | ||
fleetPluginStart, | ||
}: { | ||
core: { setup: CoreSetup; start: () => Promise<CoreStart> }; | ||
fleetPluginStart: NonNullable<APMPluginStartDependencies['fleet']>; | ||
}) { | ||
// @ts-ignore | ||
const savedObjectsClient: SavedObjectsClientContract = await getInternalSavedObjectsClient( | ||
core.setup | ||
); | ||
return await fleetPluginStart.packagePolicyService.list(savedObjectsClient, { | ||
kuery: 'ingest-package-policies.package.name:apm', | ||
}); | ||
} |
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