mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
refactor(Telemetry): Move telemetry handling to scripts/serverless.js
This commit is contained in:
parent
fac47cfa23
commit
4cab803ccd
@ -16,6 +16,13 @@ if (require('../lib/utils/tabCompletion/isSupported') && process.argv[2] === 'co
|
||||
const handleError = require('../lib/cli/handle-error');
|
||||
const humanizePropertyPathKeys = require('../lib/configuration/variables/humanize-property-path-keys');
|
||||
|
||||
const {
|
||||
storeLocally: storeTelemetryLocally,
|
||||
send: sendTelemetry,
|
||||
} = require('../lib/utils/telemetry');
|
||||
const generateTelemetryPayload = require('../lib/utils/telemetry/generatePayload');
|
||||
const processBackendNotificationRequest = require('../lib/utils/processBackendNotificationRequest');
|
||||
|
||||
let serverless;
|
||||
|
||||
process.once('uncaughtException', (error) =>
|
||||
@ -634,6 +641,16 @@ const processSpanPromise = (async () => {
|
||||
// Run command
|
||||
await serverless.run();
|
||||
}
|
||||
await storeTelemetryLocally(await generateTelemetryPayload(serverless));
|
||||
let backendNotificationRequest;
|
||||
if (commands.join(' ') === 'deploy') {
|
||||
backendNotificationRequest = await sendTelemetry({
|
||||
serverlessExecutionSpan: processSpanPromise,
|
||||
});
|
||||
}
|
||||
if (backendNotificationRequest) {
|
||||
await processBackendNotificationRequest(backendNotificationRequest);
|
||||
}
|
||||
} catch (error) {
|
||||
// If Dashboard Plugin, capture error
|
||||
const dashboardPlugin =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user