Skip to content

Commit 2617c6f

Browse files
author
Fix Ralph
committed
fix(datasetQuality): downgrade registry 404 log from error to debug
When fetchDatasets calls packageClient.getPackage() and the Fleet registry returns a 404 (Unknown resource), the RegistryResponseError was being logged at ERROR level. These 4xx responses are user-facing conditions (package not found in registry), not Kibana server faults. Log RegistryResponseError with status < 500 and FleetUnauthorizedError at debug level instead.
1 parent 91f739d commit 2617c6f

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

x-pack/platform/plugins/shared/dataset_quality/server/routes/integrations/get_integrations.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
import { Logger } from '@kbn/core/server';
99
import { PackageClient } from '@kbn/fleet-plugin/server';
10-
import { PackageNotFoundError } from '@kbn/fleet-plugin/server/errors';
10+
import {
11+
FleetUnauthorizedError,
12+
PackageNotFoundError,
13+
RegistryResponseError,
14+
} from '@kbn/fleet-plugin/server/errors';
1115
import { PackageInfo, RegistryDataStream } from '@kbn/fleet-plugin/common';
1216
import { IntegrationType } from '../../../common/api_types';
1317

@@ -89,9 +93,21 @@ const fetchDatasets = async (options: {
8993
}
9094

9195
const { name, version, logger } = options;
92-
logger.error(
93-
`There was an error when trying to fetch information about package ${name} version ${version}: ${error}`
94-
);
96+
const message = `There was an error when trying to fetch information about package ${name} version ${version}: ${error}`;
97+
98+
// Registry 4xx / Fleet permission denials are user-facing, not Kibana faults.
99+
// A registry error without a status stays at error so transient failures stay visible.
100+
const shouldLogAsDebug =
101+
(error instanceof RegistryResponseError &&
102+
error.status !== undefined &&
103+
error.status < 500) ||
104+
error instanceof FleetUnauthorizedError;
105+
106+
if (shouldLogAsDebug) {
107+
logger.debug(message);
108+
} else {
109+
logger.error(message);
110+
}
95111

96112
return {};
97113
}

0 commit comments

Comments
 (0)