kopia lustrzana https://github.com/c9/core
Revert "Revert "Merge pull request +6709 from c9/metrics-plugin""
This reverts commit b62b3ff079
.
pull/64/head
rodzic
b62b3ff079
commit
f445e33be0
|
@ -156,6 +156,10 @@ module.exports = function(options) {
|
||||||
staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic",
|
staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic",
|
||||||
defaultShow: options.local
|
defaultShow: options.local
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
packagePath: "plugins/c9.ide.metrics/metrics",
|
||||||
|
hosted: hosted
|
||||||
|
},
|
||||||
|
|
||||||
// Ace && Commands
|
// Ace && Commands
|
||||||
"plugins/c9.ide.keys/commands",
|
"plugins/c9.ide.keys/commands",
|
||||||
|
|
|
@ -150,6 +150,7 @@ module.exports = function(config, optimist) {
|
||||||
"./c9.nodeapi/nodeapi",
|
"./c9.nodeapi/nodeapi",
|
||||||
{
|
{
|
||||||
packagePath: "./c9.vfs.standalone/standalone",
|
packagePath: "./c9.vfs.standalone/standalone",
|
||||||
|
sdk: config.sdk,
|
||||||
local: config.local,
|
local: config.local,
|
||||||
packed: argv.packed,
|
packed: argv.packed,
|
||||||
collab: config.collab,
|
collab: config.collab,
|
||||||
|
|
|
@ -75,7 +75,9 @@ define(function(require, exports, module) {
|
||||||
/***** Register and define API *****/
|
/***** Register and define API *****/
|
||||||
|
|
||||||
plugin.freezePublicAPI({
|
plugin.freezePublicAPI({
|
||||||
reportError: reportError
|
/** @deprecated Use log() instead. */
|
||||||
|
reportError: reportError,
|
||||||
|
log: reportError
|
||||||
});
|
});
|
||||||
|
|
||||||
register(null, { "error_handler" : plugin });
|
register(null, { "error_handler" : plugin });
|
||||||
|
|
|
@ -108,7 +108,9 @@ define(function(require, exports, module) {
|
||||||
/***** Register and define API *****/
|
/***** Register and define API *****/
|
||||||
|
|
||||||
plugin.freezePublicAPI({
|
plugin.freezePublicAPI({
|
||||||
reportError: reportError
|
/** @deprecated Use log() instead. */
|
||||||
|
reportError: reportError,
|
||||||
|
log: reportError
|
||||||
});
|
});
|
||||||
|
|
||||||
register(null, { "error_handler" : plugin });
|
register(null, { "error_handler" : plugin });
|
||||||
|
|
|
@ -463,7 +463,9 @@ function isPrimitive(arg) {
|
||||||
exports.isPrimitive = isPrimitive;
|
exports.isPrimitive = isPrimitive;
|
||||||
|
|
||||||
function isBuffer(arg) {
|
function isBuffer(arg) {
|
||||||
return arg instanceof Buffer;
|
// Not relevant outside of node
|
||||||
|
// return arg instanceof Buffer;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
exports.isBuffer = isBuffer;
|
exports.isBuffer = isBuffer;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
main.consumes = ["Plugin", "auth", "http", "api", "error_handler"];
|
main.consumes = ["Plugin", "auth", "http", "api", "error_handler", "metrics"];
|
||||||
main.provides = ["vfs.endpoint"];
|
main.provides = ["vfs.endpoint"];
|
||||||
return main;
|
return main;
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ define(function(require, exports, module) {
|
||||||
var http = imports.http;
|
var http = imports.http;
|
||||||
var api = imports.api;
|
var api = imports.api;
|
||||||
var errorHandler = imports.error_handler;
|
var errorHandler = imports.error_handler;
|
||||||
|
var metrics = imports.metrics;
|
||||||
|
|
||||||
/***** Initialization *****/
|
/***** Initialization *****/
|
||||||
|
|
||||||
|
@ -168,8 +169,10 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
// just take the first server that doesn't return an error
|
// just take the first server that doesn't return an error
|
||||||
(function tryNext(i) {
|
(function tryNext(i) {
|
||||||
if (i >= servers.length)
|
if (i >= servers.length) {
|
||||||
|
metrics.increment("connect_failed_all", 1, true);
|
||||||
return callback(new Error("Disconnected: Could not reach your workspace. Please try again later."));
|
return callback(new Error("Disconnected: Could not reach your workspace. Please try again later."));
|
||||||
|
}
|
||||||
|
|
||||||
var server = servers[i];
|
var server = servers[i];
|
||||||
auth.request(server.url + "/" + options.pid, {
|
auth.request(server.url + "/" + options.pid, {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
main.consumes = ["Plugin", "ext", "c9", "vfs"];
|
main.consumes = ["Plugin", "ext", "c9", "vfs", "metrics"];
|
||||||
main.provides = ["vfs.ping"];
|
main.provides = ["vfs.ping"];
|
||||||
return main;
|
return main;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ define(function(require, exports, module) {
|
||||||
var Plugin = imports.Plugin;
|
var Plugin = imports.Plugin;
|
||||||
var c9 = imports.c9;
|
var c9 = imports.c9;
|
||||||
var ext = imports.ext;
|
var ext = imports.ext;
|
||||||
|
var metrics = imports.metrics;
|
||||||
|
|
||||||
/***** Initialization *****/
|
/***** Initialization *****/
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
main.consumes = ["Plugin", "auth", "vfs.endpoint", "dialog.error", "dialog.alert", "error_handler"];
|
main.consumes = [
|
||||||
|
"Plugin", "auth", "vfs.endpoint", "dialog.error",
|
||||||
|
"dialog.alert", "error_handler", "metrics"
|
||||||
|
];
|
||||||
main.provides = ["vfs"];
|
main.provides = ["vfs"];
|
||||||
return main;
|
return main;
|
||||||
|
|
||||||
|
@ -34,6 +37,7 @@ define(function(require, exports, module) {
|
||||||
var hideError = errorDialog.hide;
|
var hideError = errorDialog.hide;
|
||||||
var showAlert = imports["dialog.alert"].show;
|
var showAlert = imports["dialog.alert"].show;
|
||||||
var errorHandler = imports.error_handler;
|
var errorHandler = imports.error_handler;
|
||||||
|
var metrics = imports.metrics;
|
||||||
|
|
||||||
var eio = require("engine.io");
|
var eio = require("engine.io");
|
||||||
var Consumer = require("vfs-socket/consumer").Consumer;
|
var Consumer = require("vfs-socket/consumer").Consumer;
|
||||||
|
@ -50,7 +54,7 @@ define(function(require, exports, module) {
|
||||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||||
var emit = plugin.getEmitter();
|
var emit = plugin.getEmitter();
|
||||||
|
|
||||||
// Give reference to vfs to plugin
|
// Give reference to vfs to plugins
|
||||||
errorDialog.vfs = plugin;
|
errorDialog.vfs = plugin;
|
||||||
|
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
|
@ -209,6 +213,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
vfsEndpoint.get(protocolVersion, function(err, urls) {
|
vfsEndpoint.get(protocolVersion, function(err, urls) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
metrics.increment("connect_failed", 1, true);
|
||||||
if (!showErrorTimer) {
|
if (!showErrorTimer) {
|
||||||
showErrorTimer = setTimeout(function() {
|
showErrorTimer = setTimeout(function() {
|
||||||
showVfsError(showErrorTimerMessage);
|
showVfsError(showErrorTimerMessage);
|
||||||
|
|
|
@ -48,7 +48,7 @@ function plugin(options, imports, register) {
|
||||||
imports.connect.use(api);
|
imports.connect.use(api);
|
||||||
|
|
||||||
api.get("/", function(req, res, next) {
|
api.get("/", function(req, res, next) {
|
||||||
res.writeHead(302, { "Location": "/ide.html" });
|
res.writeHead(302, { "Location": options.sdk ? "/ide.html" : "/static/places.html" });
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -407,6 +407,10 @@ require([
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"metrics": {
|
||||||
|
getLastPing: function() { throw Error("Not implemented"); },
|
||||||
|
getLastest: function() { throw Error("Not implemented"); },
|
||||||
|
},
|
||||||
error_handler: {reportError: function(){}},
|
error_handler: {reportError: function(){}},
|
||||||
installer: {
|
installer: {
|
||||||
show: function(){}
|
show: function(){}
|
||||||
|
|
|
@ -11,6 +11,7 @@ module.exports = function(manifest, installPath) {
|
||||||
var builders = require("../plugins/c9.ide.run.build/builders_list");
|
var builders = require("../plugins/c9.ide.run.build/builders_list");
|
||||||
|
|
||||||
var workspaceDir = path.resolve(__dirname + "/../");
|
var workspaceDir = path.resolve(__dirname + "/../");
|
||||||
|
var sdk = !manifest.sdk;
|
||||||
|
|
||||||
if (process.platform == "win32" && process.env.HOME === undefined) {
|
if (process.platform == "win32" && process.env.HOME === undefined) {
|
||||||
process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH;
|
process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH;
|
||||||
|
@ -37,6 +38,7 @@ module.exports = function(manifest, installPath) {
|
||||||
home: home,
|
home: home,
|
||||||
uid: "-1",
|
uid: "-1",
|
||||||
dev: true,
|
dev: true,
|
||||||
|
sdk: sdk,
|
||||||
pid: process.pid,
|
pid: process.pid,
|
||||||
port: process.env.PORT || 8181,
|
port: process.env.PORT || 8181,
|
||||||
host: process.env.IP || "0.0.0.0",
|
host: process.env.IP || "0.0.0.0",
|
||||||
|
|
Ładowanie…
Reference in New Issue