Skip to content

Commit

Permalink
[Profiling] Fix set up process 8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Sep 22, 2023
1 parent 5e728ad commit 153aa07
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions x-pack/plugins/profiling/server/lib/setup/fleet_policies.ts
Expand Up @@ -9,6 +9,7 @@ import { SavedObjectsClientContract } from '@kbn/core/server';
import { PackagePolicyClient } from '@kbn/fleet-plugin/server';
import { fetchFindLatestPackageOrThrow } from '@kbn/fleet-plugin/server/services/epm/registry';
import { omit } from 'lodash';
import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '@kbn/fleet-plugin/common';
import { PackageInputType } from '../..';
import { PartialSetupState } from '../../../common/setup';
import { ELASTIC_CLOUD_APM_POLICY, getApmPolicy } from './get_apm_policy';
Expand All @@ -27,8 +28,10 @@ async function getPackagePolicy({
soClient: SavedObjectsClientContract;
packageName: string;
}) {
const packagePolicies = await packagePolicyClient.list(soClient, {});
return packagePolicies.items.find((pkg) => pkg.name === packageName);
const packagePolicies = await packagePolicyClient.list(soClient, {
kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.name:${packageName}`,
});
return packagePolicies.items[0];
}

export async function getCollectorPolicy({
Expand Down

0 comments on commit 153aa07

Please sign in to comment.