Skip to content

Commit

Permalink
[Debug] Add some logging to test installation times in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich committed Feb 15, 2022
1 parent 840c4ec commit 513dcc1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function _installPackage({
installSource: InstallSource;
spaceId: string;
}): Promise<AssetReference[]> {
const start = Date.now();
const { name: pkgName, version: pkgVersion } = packageInfo;

try {
Expand Down Expand Up @@ -236,6 +237,10 @@ export async function _installPackage({
await packagePolicyService.upgrade(savedObjectsClient, esClient, policyIdsToUpgrade.items);
}

const end = Date.now();

logger.debug(`Installation of ${pkgName}-${pkgVersion} took ${end - start}ms`);

return [
...installedKibanaAssetsRefs,
...installedPipelines,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function bulkInstallPackages({
});

if (installedPackageResult) {
logger.debug(`Retrieved installed package for ${pkgKeyProps.name}-${pkgKeyProps.version}`);
const {
name,
version,
Expand All @@ -84,6 +85,8 @@ export async function bulkInstallPackages({

const pkgkey = Registry.pkgToPkgKey(pkgKeyProps);

const start = Date.now();
logger.debug(`Installing ${pkgkey} as part of bulk install`);
const installResult = await installPackage({
savedObjectsClient,
esClient,
Expand All @@ -100,6 +103,9 @@ export async function bulkInstallPackages({
installType: installResult.installType,
};
}

const end = Date.now();
logger.debug(`Installed ${pkgkey} in ${end - start}ms`);
return {
name: packageName,
version: pkgKeyProps.version,
Expand Down
8 changes: 8 additions & 0 deletions x-pack/plugins/fleet/server/services/epm/packages/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export async function getPackageInfo(options: {
}): Promise<PackageInfo> {
const { savedObjectsClient, pkgName, pkgVersion } = options;

const logger = appContextService.getLogger();
const start = Date.now();
logger.debug(`Getting package info for ${pkgName}-${pkgVersion}`);

const [savedObject, latestPackage] = await Promise.all([
getInstallationObject({ savedObjectsClient, pkgName }),
Registry.fetchFindLatestPackageWithFallbackToBundled(pkgName),
Expand Down Expand Up @@ -176,6 +180,10 @@ export async function getPackageInfo(options: {
};
const updated = { ...packageInfo, ...additions };

const end = Date.now();

logger.debug(`Retrieved package info in ${end - start}ms`);

return createInstallableFrom(updated, savedObject);
}

Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/security_solution_endpoint/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
// always install Endpoint package by default when Fleet sets up
`--xpack.fleet.packages.0.name=endpoint`,
`--xpack.fleet.packages.0.version=latest`,
'--logging.loggers[0].name=plugins.fleet',
'--logging.loggers[0].level=debug',
'--logging.loggers[0].appenders[0]=console',
],
},
layout: {
Expand Down

0 comments on commit 513dcc1

Please sign in to comment.