mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
chore: update elastic-agent-nodejs to v4 (#165483)
## Summary Draft PR to see the impact of the new major version of `elastic-apm-node` dependency. Please do not review yet. - elastic-apm-node@4 changelog: https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-4.x.html#release-notes-4.0.0 - elastic-apm-node@4 upgrade guide: https://www.elastic.co/guide/en/apm/agent/nodejs/current/upgrade-to-v4.html ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
bc718d84f6
commit
9a798c7969
17 changed files with 181 additions and 73 deletions
|
@ -873,7 +873,7 @@
|
|||
"deep-freeze-strict": "^1.1.1",
|
||||
"deepmerge": "^4.2.2",
|
||||
"del": "^6.1.0",
|
||||
"elastic-apm-node": "^3.49.1",
|
||||
"elastic-apm-node": "^4.0.0",
|
||||
"email-addresses": "^5.0.0",
|
||||
"execa": "^4.0.2",
|
||||
"expiry-js": "0.1.7",
|
||||
|
|
|
@ -24,7 +24,7 @@ export const getApmConfig = (requestPath: string) => {
|
|||
}
|
||||
|
||||
// Cleanup RUM unsupported attrbiutes from base apm config.
|
||||
const { contextPropagationOnly, logUncaughtExceptions, ...restOfConfig } = baseConfig;
|
||||
const { contextPropagationOnly, ...restOfConfig } = baseConfig;
|
||||
const config: Record<string, any> = {
|
||||
...restOfConfig,
|
||||
pageLoadTransactionName: requestPath,
|
||||
|
|
|
@ -223,7 +223,7 @@ export class Server {
|
|||
|
||||
this.coreApp.preboot(corePreboot, uiPlugins);
|
||||
|
||||
prebootTransaction?.end();
|
||||
prebootTransaction.end();
|
||||
this.uptimePerStep.preboot = { start: prebootStartUptime, end: performance.now() };
|
||||
return corePreboot;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ export class Server {
|
|||
this.registerCoreContext(coreSetup);
|
||||
await this.coreApp.setup(coreSetup, uiPlugins);
|
||||
|
||||
setupTransaction?.end();
|
||||
setupTransaction.end();
|
||||
this.uptimePerStep.setup = { start: setupStartUptime, end: performance.now() };
|
||||
return coreSetup;
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ export class Server {
|
|||
const docLinkStart = this.docLinks.start();
|
||||
const elasticsearchStart = await this.elasticsearch.start();
|
||||
const deprecationsStart = this.deprecations.start();
|
||||
const soStartSpan = startTransaction?.startSpan('saved_objects.migration', 'migration');
|
||||
const soStartSpan = startTransaction.startSpan('saved_objects.migration', 'migration');
|
||||
const savedObjectsStart = await this.savedObjects.start({
|
||||
elasticsearch: elasticsearchStart,
|
||||
pluginsInitialized: this.#pluginsInitialized,
|
||||
|
@ -379,7 +379,7 @@ export class Server {
|
|||
soStartSpan?.end();
|
||||
|
||||
if (this.nodeRoles?.migrator === true) {
|
||||
startTransaction?.end();
|
||||
startTransaction.end();
|
||||
this.log.info('Detected migrator node role; shutting down Kibana...');
|
||||
throw new CriticalError(
|
||||
'Migrations completed, shutting down Kibana',
|
||||
|
@ -420,7 +420,7 @@ export class Server {
|
|||
|
||||
await this.http.start();
|
||||
|
||||
startTransaction?.end();
|
||||
startTransaction.end();
|
||||
|
||||
this.uptimePerStep.start = { start: startStartUptime, end: performance.now() };
|
||||
this.reportKibanaStartedEvents(analyticsStart);
|
||||
|
|
|
@ -91,7 +91,6 @@ describe('ApmConfiguration', () => {
|
|||
"contextPropagationOnly": true,
|
||||
"environment": "development",
|
||||
"globalLabels": Object {},
|
||||
"logUncaughtExceptions": true,
|
||||
"metricsInterval": "30s",
|
||||
"propagateTracestate": true,
|
||||
"secretToken": "JpBCcOQxN81D5yucs2",
|
||||
|
@ -116,7 +115,6 @@ describe('ApmConfiguration', () => {
|
|||
"globalLabels": Object {
|
||||
"git_rev": "sha",
|
||||
},
|
||||
"logUncaughtExceptions": true,
|
||||
"metricsInterval": "120s",
|
||||
"propagateTracestate": true,
|
||||
"secretToken": "JpBCcOQxN81D5yucs2",
|
||||
|
|
|
@ -20,7 +20,6 @@ const DEFAULT_CONFIG: AgentConfigOptions = {
|
|||
active: true,
|
||||
contextPropagationOnly: true,
|
||||
environment: 'development',
|
||||
logUncaughtExceptions: true,
|
||||
globalLabels: {},
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export function runBuildApiDocsCli() {
|
|||
run(
|
||||
async ({ log, flags }) => {
|
||||
const transaction = apm.startTransaction('build-api-docs', 'kibana-cli');
|
||||
const spanSetup = transaction?.startSpan('build_api_docs.setup', 'setup');
|
||||
const spanSetup = transaction.startSpan('build_api_docs.setup', 'setup');
|
||||
|
||||
const collectReferences = flags.references as boolean;
|
||||
const stats = flags.stats && typeof flags.stats === 'string' ? [flags.stats] : flags.stats;
|
||||
|
@ -82,7 +82,7 @@ export function runBuildApiDocsCli() {
|
|||
const outputFolder = Path.resolve(REPO_ROOT, 'api_docs');
|
||||
|
||||
spanSetup?.end();
|
||||
const spanInitialDocIds = transaction?.startSpan('build_api_docs.initialDocIds', 'setup');
|
||||
const spanInitialDocIds = transaction.startSpan('build_api_docs.initialDocIds', 'setup');
|
||||
|
||||
const initialDocIds =
|
||||
!pluginFilter && Fs.existsSync(outputFolder)
|
||||
|
@ -90,7 +90,7 @@ export function runBuildApiDocsCli() {
|
|||
: undefined;
|
||||
|
||||
spanInitialDocIds?.end();
|
||||
const spanPlugins = transaction?.startSpan('build_api_docs.findPlugins', 'setup');
|
||||
const spanPlugins = transaction.startSpan('build_api_docs.findPlugins', 'setup');
|
||||
|
||||
const plugins = findPlugins(stats && pluginFilter ? pluginFilter : undefined);
|
||||
|
||||
|
@ -101,16 +101,13 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
spanPlugins?.end();
|
||||
|
||||
const spanPathsByPackage = transaction?.startSpan(
|
||||
'build_api_docs.getPathsByPackage',
|
||||
'setup'
|
||||
);
|
||||
const spanPathsByPackage = transaction.startSpan('build_api_docs.getPathsByPackage', 'setup');
|
||||
|
||||
const pathsByPlugin = await getPathsByPackage(plugins);
|
||||
|
||||
spanPathsByPackage?.end();
|
||||
|
||||
const spanProject = transaction?.startSpan('build_api_docs.getTsProject', 'setup');
|
||||
const spanProject = transaction.startSpan('build_api_docs.getTsProject', 'setup');
|
||||
|
||||
const project = getTsProject(
|
||||
REPO_ROOT,
|
||||
|
@ -119,7 +116,7 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
spanProject?.end();
|
||||
|
||||
const spanFolders = transaction?.startSpan('build_api_docs.check-folders', 'setup');
|
||||
const spanFolders = transaction.startSpan('build_api_docs.check-folders', 'setup');
|
||||
|
||||
// if the output folder already exists, and we don't have a plugin filter, delete all the files in the output folder
|
||||
if (Fs.existsSync(outputFolder) && !pluginFilter) {
|
||||
|
@ -132,7 +129,7 @@ export function runBuildApiDocsCli() {
|
|||
}
|
||||
|
||||
spanFolders?.end();
|
||||
const spanPluginApiMap = transaction?.startSpan('build_api_docs.getPluginApiMap', 'setup');
|
||||
const spanPluginApiMap = transaction.startSpan('build_api_docs.getPluginApiMap', 'setup');
|
||||
|
||||
const {
|
||||
pluginApiMap,
|
||||
|
@ -154,7 +151,7 @@ export function runBuildApiDocsCli() {
|
|||
continue;
|
||||
}
|
||||
|
||||
const spanApiStatsForPlugin = transaction?.startSpan(
|
||||
const spanApiStatsForPlugin = transaction.startSpan(
|
||||
`build_api_docs.collectApiStatsForPlugin-${id}`,
|
||||
'stats'
|
||||
);
|
||||
|
@ -179,7 +176,7 @@ export function runBuildApiDocsCli() {
|
|||
}
|
||||
|
||||
if (!stats) {
|
||||
const spanWritePluginDirectoryDoc = transaction?.startSpan(
|
||||
const spanWritePluginDirectoryDoc = transaction.startSpan(
|
||||
'build_api_docs.writePluginDirectoryDoc',
|
||||
'write'
|
||||
);
|
||||
|
@ -202,7 +199,7 @@ export function runBuildApiDocsCli() {
|
|||
const pluginStats = allPluginStats[id];
|
||||
const pluginTeam = plugin.manifest.owner.name;
|
||||
|
||||
const spanMetrics = transaction?.startSpan(
|
||||
const spanMetrics = transaction.startSpan(
|
||||
`build_api_docs.collectApiStatsForPlugin-${id}`,
|
||||
'stats'
|
||||
);
|
||||
|
@ -369,7 +366,7 @@ export function runBuildApiDocsCli() {
|
|||
if (pluginStats.apiCount > 0) {
|
||||
log.info(`Writing public API doc for plugin ${pluginApi.id}.`);
|
||||
|
||||
const spanWritePluginDocs = transaction?.startSpan(
|
||||
const spanWritePluginDocs = transaction.startSpan(
|
||||
'build_api_docs.writePluginDocs',
|
||||
'write'
|
||||
);
|
||||
|
@ -381,7 +378,7 @@ export function runBuildApiDocsCli() {
|
|||
log.info(`Plugin ${pluginApi.id} has no public API.`);
|
||||
}
|
||||
|
||||
const spanWriteDeprecationDocByPlugin = transaction?.startSpan(
|
||||
const spanWriteDeprecationDocByPlugin = transaction.startSpan(
|
||||
'build_api_docs.writeDeprecationDocByPlugin',
|
||||
'write'
|
||||
);
|
||||
|
@ -390,7 +387,7 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
spanWriteDeprecationDocByPlugin?.end();
|
||||
|
||||
const spanWriteDeprecationDueByTeam = transaction?.startSpan(
|
||||
const spanWriteDeprecationDueByTeam = transaction.startSpan(
|
||||
'build_api_docs.writeDeprecationDueByTeam',
|
||||
'write'
|
||||
);
|
||||
|
@ -399,7 +396,7 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
spanWriteDeprecationDueByTeam?.end();
|
||||
|
||||
const spanWriteDeprecationDocByApi = transaction?.startSpan(
|
||||
const spanWriteDeprecationDocByApi = transaction.startSpan(
|
||||
'build_api_docs.writeDeprecationDocByApi',
|
||||
'write'
|
||||
);
|
||||
|
@ -424,7 +421,7 @@ export function runBuildApiDocsCli() {
|
|||
await trimDeletedDocsFromNav(log, initialDocIds, outputFolder);
|
||||
}
|
||||
|
||||
transaction?.end();
|
||||
transaction.end();
|
||||
},
|
||||
{
|
||||
log: {
|
||||
|
|
|
@ -6,7 +6,28 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import type { Agent } from 'elastic-apm-node';
|
||||
import type { Agent, Transaction } from 'elastic-apm-node';
|
||||
|
||||
const transaction: jest.Mocked<Transaction> = {
|
||||
addLabels: jest.fn().mockReturnValue(true),
|
||||
ensureParentId: jest.fn().mockReturnValue(''),
|
||||
setLabel: jest.fn().mockReturnValue(true),
|
||||
setOutcome: jest.fn(),
|
||||
setType: jest.fn(),
|
||||
startSpan: jest.fn().mockReturnValue(null),
|
||||
end: jest.fn(),
|
||||
// Following OTel convention
|
||||
// https://github.com/open-telemetry/opentelemetry-js/blob/27897d6c34839ee722d92b12c1d55d8bdab5a0c1/api/src/trace/invalid-span-constants.ts
|
||||
ids: {
|
||||
'trace.id': '00000000000000000000000000000000',
|
||||
'transaction.id': '0000000000000000',
|
||||
},
|
||||
traceparent: '00-00000000000000000000000000000-0000000000000000-00',
|
||||
name: 'Mock Transaction',
|
||||
result: '',
|
||||
outcome: 'unknown',
|
||||
type: null,
|
||||
};
|
||||
|
||||
/**
|
||||
* `elastic-apm-node` patches the runtime at import time
|
||||
|
@ -26,7 +47,7 @@ const agent: jest.Mocked<Agent> = {
|
|||
captureError: jest.fn(),
|
||||
currentTraceparent: null,
|
||||
currentTraceIds: {},
|
||||
startTransaction: jest.fn().mockReturnValue(null),
|
||||
startTransaction: jest.fn().mockReturnValue(transaction),
|
||||
setTransactionName: jest.fn(),
|
||||
endTransaction: jest.fn(),
|
||||
currentTransaction: null,
|
||||
|
@ -43,7 +64,7 @@ const agent: jest.Mocked<Agent> = {
|
|||
addTransactionFilter: jest.fn(),
|
||||
addMetadataFilter: jest.fn(),
|
||||
flush: jest.fn(),
|
||||
destroy: jest.fn(),
|
||||
destroy: jest.fn().mockResolvedValue(undefined),
|
||||
registerMetric: jest.fn(),
|
||||
setTransactionOutcome: jest.fn(),
|
||||
setSpanOutcome: jest.fn(),
|
||||
|
|
|
@ -42,11 +42,11 @@ export function generatePngObservable(
|
|||
}).pipe(
|
||||
tap(({ metrics }) => {
|
||||
if (metrics) {
|
||||
apmTrans?.setLabel('cpu', metrics.cpu, false);
|
||||
apmTrans?.setLabel('memory', metrics.memory, false);
|
||||
apmTrans.setLabel('cpu', metrics.cpu, false);
|
||||
apmTrans.setLabel('memory', metrics.memory, false);
|
||||
}
|
||||
apmScreenshots?.end();
|
||||
apmBuffer = apmTrans?.startSpan('get-buffer', 'output') ?? null;
|
||||
apmBuffer = apmTrans.startSpan('get-buffer', 'output') ?? null;
|
||||
}),
|
||||
map(({ metrics, results }) => ({
|
||||
metrics,
|
||||
|
@ -63,11 +63,11 @@ export function generatePngObservable(
|
|||
})),
|
||||
tap(({ buffer }) => {
|
||||
logger.debug(`PNG buffer byte length: ${buffer.byteLength}`);
|
||||
apmTrans?.setLabel('byte-length', buffer.byteLength, false);
|
||||
apmTrans.setLabel('byte-length', buffer.byteLength, false);
|
||||
}),
|
||||
finalize(() => {
|
||||
apmBuffer?.end();
|
||||
apmTrans?.end();
|
||||
apmTrans.end();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,16 +29,16 @@ export function getTracker(): PdfTracker {
|
|||
|
||||
return {
|
||||
startScreenshots() {
|
||||
apmScreenshots = apmTrans?.startSpan('screenshots-pipeline', SPANTYPE_SETUP) || null;
|
||||
apmScreenshots = apmTrans.startSpan('screenshots-pipeline', SPANTYPE_SETUP) || null;
|
||||
},
|
||||
endScreenshots() {
|
||||
if (apmScreenshots) apmScreenshots.end();
|
||||
},
|
||||
setCpuUsage(cpu: number) {
|
||||
apmTrans?.setLabel('cpu', cpu, false);
|
||||
apmTrans.setLabel('cpu', cpu, false);
|
||||
},
|
||||
setMemoryUsage(memory: number) {
|
||||
apmTrans?.setLabel('memory', memory, false);
|
||||
apmTrans.setLabel('memory', memory, false);
|
||||
},
|
||||
end() {
|
||||
if (apmTrans) apmTrans.end();
|
||||
|
|
|
@ -83,7 +83,7 @@ export class PngExportType extends ExportType<JobParamsPNGV2, TaskPayloadPNGV2>
|
|||
) => {
|
||||
const jobLogger = this.logger.get(`execute-job:${jobId}`);
|
||||
const apmTrans = apm.startTransaction('execute-job-pdf-v2', REPORTING_TRANSACTION_TYPE);
|
||||
const apmGetAssets = apmTrans?.startSpan('get-assets', 'setup');
|
||||
const apmGetAssets = apmTrans.startSpan('get-assets', 'setup');
|
||||
let apmGeneratePng: { end: () => void } | null | undefined;
|
||||
const { encryptionKey } = this.config;
|
||||
|
||||
|
@ -100,7 +100,7 @@ export class PngExportType extends ExportType<JobParamsPNGV2, TaskPayloadPNGV2>
|
|||
const [locatorParams] = payload.locatorParams;
|
||||
|
||||
apmGetAssets?.end();
|
||||
apmGeneratePng = apmTrans?.startSpan('generate-png-pipeline', 'execute');
|
||||
apmGeneratePng = apmTrans.startSpan('generate-png-pipeline', 'execute');
|
||||
|
||||
return generatePngObservable(
|
||||
() =>
|
||||
|
|
|
@ -66,7 +66,7 @@ export class PdfV1ExportType extends ExportType<JobParamsPDFDeprecated, TaskPayl
|
|||
) => {
|
||||
const jobLogger = this.logger.get(`execute-job:${jobId}`);
|
||||
const apmTrans = apm.startTransaction('execute-job-pdf', REPORTING_TRANSACTION_TYPE);
|
||||
const apmGetAssets = apmTrans?.startSpan('get-assets', 'setup');
|
||||
const apmGetAssets = apmTrans.startSpan('get-assets', 'setup');
|
||||
let apmGeneratePdf: { end: () => void } | null | undefined;
|
||||
|
||||
const process$: Observable<TaskRunResult> = of(1).pipe(
|
||||
|
@ -82,7 +82,7 @@ export class PdfV1ExportType extends ExportType<JobParamsPDFDeprecated, TaskPayl
|
|||
const { browserTimezone, layout, title } = job;
|
||||
apmGetAssets?.end();
|
||||
|
||||
apmGeneratePdf = apmTrans?.startSpan('generate-pdf-pipeline', 'execute');
|
||||
apmGeneratePdf = apmTrans.startSpan('generate-pdf-pipeline', 'execute');
|
||||
// make a new function that will call reporting.getScreenshots
|
||||
const snapshotFn = () =>
|
||||
this.startDeps.reporting.getScreenshots({
|
||||
|
@ -123,7 +123,7 @@ export class PdfV1ExportType extends ExportType<JobParamsPDFDeprecated, TaskPayl
|
|||
|
||||
const stop$ = fromEventPattern(cancellationToken.on);
|
||||
|
||||
apmTrans?.end();
|
||||
apmTrans.end();
|
||||
return lastValueFrom(process$.pipe(takeUntil(stop$)));
|
||||
};
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ export class PdfExportType extends ExportType<JobParamsPDFV2, TaskPayloadPDFV2>
|
|||
) => {
|
||||
const jobLogger = this.logger.get(`execute-job:${jobId}`);
|
||||
const apmTrans = apm.startTransaction('execute-job-pdf-v2', REPORTING_TRANSACTION_TYPE);
|
||||
const apmGetAssets = apmTrans?.startSpan('get-assets', 'setup');
|
||||
const apmGetAssets = apmTrans.startSpan('get-assets', 'setup');
|
||||
let apmGeneratePdf: { end: () => void } | null | undefined;
|
||||
const { encryptionKey } = this.config;
|
||||
|
||||
|
@ -103,7 +103,7 @@ export class PdfExportType extends ExportType<JobParamsPDFV2, TaskPayloadPDFV2>
|
|||
|
||||
apmGetAssets?.end();
|
||||
|
||||
apmGeneratePdf = apmTrans?.startSpan('generate-pdf-pipeline', 'execute');
|
||||
apmGeneratePdf = apmTrans.startSpan('generate-pdf-pipeline', 'execute');
|
||||
return generatePdfObservable(
|
||||
this.config,
|
||||
this.getServerInfo(),
|
||||
|
@ -149,7 +149,7 @@ export class PdfExportType extends ExportType<JobParamsPDFV2, TaskPayloadPDFV2>
|
|||
|
||||
const stop$ = Rx.fromEventPattern(cancellationToken.on);
|
||||
|
||||
apmTrans?.end();
|
||||
apmTrans.end();
|
||||
return Rx.firstValueFrom(process$.pipe(takeUntil(stop$)));
|
||||
};
|
||||
}
|
||||
|
|
|
@ -174,8 +174,8 @@ export class EventLogger {
|
|||
public startTransaction(
|
||||
action: Transactions.SCREENSHOTTING | Transactions.PDF
|
||||
): TransactionEndFn {
|
||||
this.transactions[action] = apm.startTransaction(action, PLUGIN_ID);
|
||||
const transaction = this.transactions[action];
|
||||
const transaction = apm.startTransaction(action, PLUGIN_ID);
|
||||
this.transactions[action] = transaction;
|
||||
|
||||
this.startTiming(action);
|
||||
this.logEvent(action, 'start', { action });
|
||||
|
@ -184,10 +184,10 @@ export class EventLogger {
|
|||
Object.entries(labels).forEach(([label]) => {
|
||||
const labelField = label as keyof SimpleEvent;
|
||||
const labelValue = labels[labelField];
|
||||
transaction?.setLabel(label, labelValue, false);
|
||||
transaction.setLabel(label, labelValue, false);
|
||||
});
|
||||
|
||||
transaction?.end();
|
||||
transaction.end();
|
||||
|
||||
this.logEvent(action, 'complete', { ...labels, action }, this.timings[action]);
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ import { CONTEXT_ELEMENTATTRIBUTES } from './constants';
|
|||
* Tests
|
||||
*/
|
||||
describe('Screenshot Observable Pipeline', () => {
|
||||
const originalCreateLayout = Layouts.createLayout;
|
||||
let driver: ReturnType<typeof createMockBrowserDriver>;
|
||||
let driverFactory: jest.Mocked<HeadlessChromiumDriverFactory>;
|
||||
let http: ReturnType<typeof httpServiceMock.createSetupContract>;
|
||||
|
@ -82,13 +83,18 @@ describe('Screenshot Observable Pipeline', () => {
|
|||
|
||||
screenshots = new Screenshots(driverFactory, logger, packageInfo, http, config, cloud);
|
||||
|
||||
jest.spyOn(Layouts, 'createLayout').mockReturnValue(layout);
|
||||
|
||||
// Using this patch instead of using `jest.spyOn`. This way we avoid calling
|
||||
// `jest.restoraAllMocks()` which removes implementations from other mocks not
|
||||
// explicit in this test (like apm mock object)
|
||||
// @ts-expect-error
|
||||
Layouts.createLayout = () => layout;
|
||||
driver.isPageOpen.mockReturnValue(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
// @ts-expect-error
|
||||
Layouts.createLayout = originalCreateLayout;
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('pipelines a single url into screenshot and timeRange', async () => {
|
||||
|
@ -218,10 +224,6 @@ describe('Screenshot Observable Pipeline', () => {
|
|||
cloud.isCloudEnabled = true;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('throws an error when OS memory is under 1GB on cloud', async () => {
|
||||
await expect(
|
||||
lastValueFrom(
|
||||
|
|
|
@ -322,10 +322,10 @@ export class TaskClaiming {
|
|||
max_docs: size,
|
||||
}
|
||||
);
|
||||
apmTrans?.end('success');
|
||||
apmTrans.end('success');
|
||||
return result;
|
||||
} catch (err) {
|
||||
apmTrans?.end('failure');
|
||||
apmTrans.end('failure');
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ export class TaskManagerRunner implements TaskRunner {
|
|||
TASK_MANAGER_TRANSACTION_TYPE_MARK_AS_RUNNING,
|
||||
TASK_MANAGER_TRANSACTION_TYPE
|
||||
);
|
||||
apmTrans?.addLabels({ entityId: this.taskType });
|
||||
apmTrans.addLabels({ entityId: this.taskType });
|
||||
|
||||
const now = new Date();
|
||||
try {
|
||||
|
|
115
yarn.lock
115
yarn.lock
|
@ -15175,10 +15175,10 @@ elastic-apm-node@3.46.0:
|
|||
traverse "^0.6.6"
|
||||
unicode-byte-truncate "^1.0.0"
|
||||
|
||||
elastic-apm-node@^3.49.1:
|
||||
version "3.49.1"
|
||||
resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-3.49.1.tgz#c000936a1b7f062e4dd502cd3617ebe97d4d9786"
|
||||
integrity sha512-k1kQ/exFqodZOoZSRJ3Csbdo7dtRs/uORBlRTyV2takYa1OIN7o9dvZwd8+eEPOUz4qaeRyVY8X9X2krk9GO/g==
|
||||
elastic-apm-node@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/elastic-apm-node/-/elastic-apm-node-4.0.0.tgz#14963e5bc8cdd073400a708bd09517e198c4c605"
|
||||
integrity sha512-0rf5k4UL+oNc6Xr57PKDDGDVuvW9nsLPOEI0YLqPSMBDaMdN1iW0n6MEsa4TPFtXgT1aWCdTSDUVjlgvIWKmFQ==
|
||||
dependencies:
|
||||
"@elastic/ecs-pino-format" "^1.2.0"
|
||||
"@opentelemetry/api" "^1.4.1"
|
||||
|
@ -15186,7 +15186,6 @@ elastic-apm-node@^3.49.1:
|
|||
"@opentelemetry/sdk-metrics" "^1.12.0"
|
||||
after-all-results "^2.0.0"
|
||||
agentkeepalive "^4.2.1"
|
||||
async-cache "^1.1.0"
|
||||
async-value-promise "^1.1.1"
|
||||
basic-auth "^2.0.1"
|
||||
breadth-filter "^2.0.0"
|
||||
|
@ -15200,19 +15199,18 @@ elastic-apm-node@^3.49.1:
|
|||
fast-stream-to-buffer "^1.0.0"
|
||||
http-headers "^3.0.2"
|
||||
import-in-the-middle "1.4.2"
|
||||
is-native "^1.0.1"
|
||||
lru-cache "^6.0.0"
|
||||
lru-cache "^10.0.1"
|
||||
measured-reporting "^1.51.1"
|
||||
module-details-from-path "^1.0.3"
|
||||
monitor-event-loop-delay "^1.0.0"
|
||||
object-filter-sequence "^1.0.0"
|
||||
object-identity-map "^1.0.2"
|
||||
original-url "^1.2.3"
|
||||
pino "^6.11.2"
|
||||
readable-stream "^3.4.0"
|
||||
pino "^8.15.0"
|
||||
readable-stream "^3.6.2"
|
||||
relative-microtime "^2.0.0"
|
||||
require-in-the-middle "^7.1.1"
|
||||
semver "^6.3.1"
|
||||
semver "^7.5.4"
|
||||
shallow-clone-shim "^2.0.0"
|
||||
source-map "^0.8.0-beta.0"
|
||||
sql-summary "^1.0.1"
|
||||
|
@ -16134,7 +16132,7 @@ events@^1.0.2:
|
|||
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
|
||||
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=
|
||||
|
||||
events@^3.0.0, events@^3.2.0:
|
||||
events@^3.0.0, events@^3.2.0, events@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
|
||||
integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==
|
||||
|
@ -16485,6 +16483,11 @@ fast-redact@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.0.0.tgz#ac2f9e36c9f4976f5db9fb18c6ffbaf308cf316d"
|
||||
integrity sha512-a/S/Hp6aoIjx7EmugtzLqXmcNsyFszqbt6qQ99BdG61QjBZF6shNis0BYR6TsZOQ1twYc0FN2Xdhwwbv6+KD0w==
|
||||
|
||||
fast-redact@^3.1.1:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.1.2.tgz#d58e69e9084ce9fa4c1a6fa98a3e1ecf5d7839aa"
|
||||
integrity sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw==
|
||||
|
||||
fast-safe-stringify@^2.0.7:
|
||||
version "2.0.8"
|
||||
resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.8.tgz#dc2af48c46cf712b683e849b2bbd446b32de936f"
|
||||
|
@ -21301,6 +21304,11 @@ lowlight@^1.14.0:
|
|||
fault "^1.0.0"
|
||||
highlight.js "~10.4.0"
|
||||
|
||||
lru-cache@^10.0.1:
|
||||
version "10.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a"
|
||||
integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==
|
||||
|
||||
lru-cache@^4.0.0, lru-cache@^4.1.5:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
|
||||
|
@ -23297,6 +23305,11 @@ octokit-pagination-methods@^1.1.0:
|
|||
resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4"
|
||||
integrity sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==
|
||||
|
||||
on-exit-leak-free@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz#5c703c968f7e7f851885f6459bf8a8a57edc9cc4"
|
||||
integrity sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w==
|
||||
|
||||
on-finished@~2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
|
||||
|
@ -24010,11 +24023,24 @@ pinkie@^2.0.0:
|
|||
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
|
||||
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
|
||||
|
||||
pino-abstract-transport@v1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.1.0.tgz#083d98f966262164504afb989bccd05f665937a8"
|
||||
integrity sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==
|
||||
dependencies:
|
||||
readable-stream "^4.0.0"
|
||||
split2 "^4.0.0"
|
||||
|
||||
pino-std-serializers@^3.1.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671"
|
||||
integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==
|
||||
|
||||
pino-std-serializers@^6.0.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz#307490fd426eefc95e06067e85d8558603e8e844"
|
||||
integrity sha512-KO0m2f1HkrPe9S0ldjx7za9BJjeHqBku5Ch8JyxETxT8dEFGz1PwgrHaOQupVYitpzbFSYm7nnljxD8dik2c+g==
|
||||
|
||||
pino@^6.11.2:
|
||||
version "6.11.3"
|
||||
resolved "https://registry.yarnpkg.com/pino/-/pino-6.11.3.tgz#0c02eec6029d25e6794fdb6bbea367247d74bc29"
|
||||
|
@ -24027,6 +24053,23 @@ pino@^6.11.2:
|
|||
quick-format-unescaped "^4.0.3"
|
||||
sonic-boom "^1.0.2"
|
||||
|
||||
pino@^8.15.0:
|
||||
version "8.15.1"
|
||||
resolved "https://registry.yarnpkg.com/pino/-/pino-8.15.1.tgz#04b815ff7aa4e46b1bbab88d8010aaa2b17eaba4"
|
||||
integrity sha512-Cp4QzUQrvWCRJaQ8Lzv0mJzXVk4z2jlq8JNKMGaixC2Pz5L4l2p95TkuRvYbrEbe85NQsDKrAd4zalf7Ml6WiA==
|
||||
dependencies:
|
||||
atomic-sleep "^1.0.0"
|
||||
fast-redact "^3.1.1"
|
||||
on-exit-leak-free "^2.1.0"
|
||||
pino-abstract-transport v1.1.0
|
||||
pino-std-serializers "^6.0.0"
|
||||
process-warning "^2.0.0"
|
||||
quick-format-unescaped "^4.0.3"
|
||||
real-require "^0.2.0"
|
||||
safe-stable-stringify "^2.3.1"
|
||||
sonic-boom "^3.1.0"
|
||||
thread-stream "^2.0.0"
|
||||
|
||||
pirates@^4.0.1, pirates@^4.0.4, pirates@^4.0.5:
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b"
|
||||
|
@ -24684,6 +24727,11 @@ process-on-spawn@^1.0.0:
|
|||
dependencies:
|
||||
fromentries "^1.2.0"
|
||||
|
||||
process-warning@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-2.1.0.tgz#1e60e3bfe8183033bbc1e702c2da74f099422d1a"
|
||||
integrity sha512-9C20RLxrZU/rFnxWncDkuF6O999NdIf3E1ws4B0ZeY3sRVPzWBMsYDE2lxjxhiXxg464cQTgKUGm8/i6y2YGXg==
|
||||
|
||||
process@^0.11.10:
|
||||
version "0.11.10"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
|
||||
|
@ -25839,6 +25887,25 @@ read-pkg@^5.2.0:
|
|||
isarray "0.0.1"
|
||||
string_decoder "~0.10.x"
|
||||
|
||||
readable-stream@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
|
||||
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@^4.0.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.3.0.tgz#0914d0c72db03b316c9733bb3461d64a3cc50cba"
|
||||
integrity sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==
|
||||
dependencies:
|
||||
abort-controller "^3.0.0"
|
||||
buffer "^6.0.3"
|
||||
events "^3.3.0"
|
||||
process "^0.11.10"
|
||||
|
||||
readdir-glob@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.1.tgz#f0e10bb7bf7bfa7e0add8baffdc54c3f7dbee6c4"
|
||||
|
@ -25863,6 +25930,11 @@ readdirp@~3.6.0:
|
|||
dependencies:
|
||||
picomatch "^2.2.1"
|
||||
|
||||
real-require@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78"
|
||||
integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==
|
||||
|
||||
rechoir@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||
|
@ -26947,6 +27019,13 @@ semver@^7.3.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semve
|
|||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
semver@^7.5.4:
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
send@0.17.2:
|
||||
version "0.17.2"
|
||||
resolved "https://registry.yarnpkg.com/send/-/send-0.17.2.tgz#926622f76601c41808012c8bf1688fe3906f7820"
|
||||
|
@ -27397,7 +27476,7 @@ sonic-boom@^1.0.2:
|
|||
atomic-sleep "^1.0.0"
|
||||
flatstr "^1.0.12"
|
||||
|
||||
sonic-boom@^3.3.0:
|
||||
sonic-boom@^3.1.0, sonic-boom@^3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.3.0.tgz#cffab6dafee3b2bcb88d08d589394198bee1838c"
|
||||
integrity sha512-LYxp34KlZ1a2Jb8ZQgFCK3niIHzibdwtwNUWKg0qQRzsDoJ3Gfgkf8KdBTFU3SkejDEIlWwnSnpVdOZIhFMl/g==
|
||||
|
@ -27666,6 +27745,11 @@ split-string@^3.0.1, split-string@^3.0.2:
|
|||
dependencies:
|
||||
extend-shallow "^3.0.0"
|
||||
|
||||
split2@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809"
|
||||
integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==
|
||||
|
||||
sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
|
@ -28638,6 +28722,13 @@ textarea-caret@^3.1.0:
|
|||
resolved "https://registry.yarnpkg.com/textarea-caret/-/textarea-caret-3.1.0.tgz#5d5a35bb035fd06b2ff0e25d5359e97f2655087f"
|
||||
integrity sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q==
|
||||
|
||||
thread-stream@^2.0.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.3.0.tgz#4fc07fb39eff32ae7bad803cb7dd9598349fed33"
|
||||
integrity sha512-kaDqm1DET9pp3NXwR8382WHbnpXnRkN9xGN9dQt3B2+dmXiW8X1SOwmFOxAErEQ47ObhZ96J6yhZNXuyCOL7KA==
|
||||
dependencies:
|
||||
real-require "^0.2.0"
|
||||
|
||||
throttle-debounce@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-2.1.0.tgz#257e648f0a56bd9e54fe0f132c4ab8611df4e1d5"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue