Analytics events for plugin management
Summary: Send some analytics events related to plugin management: auto-update, install, uninstall, load. Reviewed By: passy Differential Revision: D25557788 fbshipit-source-id: 14dc9ae5793e9b18be13f2d483069d8d00c8b863
This commit is contained in:
committed by
Facebook GitHub Bot
parent
31ace3bd09
commit
3a65f86c68
@@ -30,7 +30,7 @@ import {requirePlugin} from './plugins';
|
||||
import {registerPluginUpdate, selectPlugin} from '../reducers/connections';
|
||||
import {Button} from 'antd';
|
||||
import React from 'react';
|
||||
import {reportUsage} from '../utils/metrics';
|
||||
import {reportPlatformFailures, reportUsage} from '../utils/metrics';
|
||||
import {addNotification, removeNotification} from '../reducers/notifications';
|
||||
import reloadFlipper from '../utils/reloadFlipper';
|
||||
import {activatePlugin, pluginInstalled} from '../reducers/pluginManager';
|
||||
@@ -55,7 +55,22 @@ export default (store: Store) => {
|
||||
(state, store) => {
|
||||
for (const download of Object.values(state)) {
|
||||
if (download.status === PluginDownloadStatus.QUEUED) {
|
||||
handlePluginDownload(download.plugin, download.startedByUser, store);
|
||||
reportUsage(
|
||||
'plugin-auto-update:download',
|
||||
{
|
||||
version: download.plugin.version,
|
||||
startedByUser: download.startedByUser ? '1' : '0',
|
||||
},
|
||||
download.plugin.id,
|
||||
);
|
||||
reportPlatformFailures(
|
||||
handlePluginDownload(
|
||||
download.plugin,
|
||||
download.startedByUser,
|
||||
store,
|
||||
),
|
||||
'plugin-auto-update:download',
|
||||
).catch(() => {});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -145,6 +160,7 @@ async function handlePluginDownload(
|
||||
`Failed to download plugin "${title}" v${version}.`,
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
dispatch(pluginDownloadFinished({plugin}));
|
||||
await fs.remove(tmpDir);
|
||||
|
||||
@@ -22,6 +22,7 @@ import {sideEffect} from '../utils/sideEffect';
|
||||
import {requirePlugin} from './plugins';
|
||||
import {registerPluginUpdate} from '../reducers/connections';
|
||||
import {showErrorNotification} from '../utils/notifications';
|
||||
import {reportUsage} from '../utils/metrics';
|
||||
|
||||
const maxInstalledPluginVersionsToKeep = 2;
|
||||
|
||||
@@ -47,6 +48,15 @@ export default (store: Store, _logger: Logger) => {
|
||||
(queue, store) => {
|
||||
for (const request of queue) {
|
||||
try {
|
||||
reportUsage(
|
||||
'plugin:activate',
|
||||
{
|
||||
version: request.plugin.version,
|
||||
enable: request.enable ? '1' : '0',
|
||||
notifyIfFailed: request.notifyIfFailed ? '1' : '0',
|
||||
},
|
||||
request.plugin.id,
|
||||
);
|
||||
const plugin = requirePlugin(request.plugin);
|
||||
const enablePlugin = request.enable;
|
||||
store.dispatch(
|
||||
|
||||
@@ -223,6 +223,13 @@ export const requirePlugin = (
|
||||
pluginDetails: ActivatablePluginDetails,
|
||||
reqFn: Function = global.electronRequire,
|
||||
): PluginDefinition => {
|
||||
reportUsage(
|
||||
'plugin:load',
|
||||
{
|
||||
version: pluginDetails.version,
|
||||
},
|
||||
pluginDetails.id,
|
||||
);
|
||||
return tryCatchReportPluginFailures(
|
||||
() => requirePluginInternal(pluginDetails, reqFn),
|
||||
'plugin:load',
|
||||
|
||||
Reference in New Issue
Block a user