Skip to content

Commit

Permalink
Remove agent isRunning/trace isActive (#368)
Browse files Browse the repository at this point in the history
PR-URL: #368
  • Loading branch information
matthewloring authored Feb 8, 2017
1 parent ad18074 commit b41e921
Show file tree
Hide file tree
Showing 10 changed files with 596 additions and 585 deletions.
11 changes: 1 addition & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ var initConfig = function(projectConfig) {
*/
var publicAgent = {
isActive: function() {
// TODO: The use of agent.isRunning() is only needed because the
// _private() function is used in testing.
// Remove the _private() function so that agent.isRunning()
// can be removed.
return agent !== phantomTraceAgent && agent.isRunning();
return agent !== phantomTraceAgent;
},

startSpan: function(name, labels) {
Expand Down Expand Up @@ -248,18 +244,13 @@ function start(config) {
return publicAgent;
}

function isActive() {
return publicAgent.isActive();
}

function get() {
return publicAgent.get();
}

global._google_trace_agent = publicAgent;
module.exports = {
start: start,
isActive: isActive,
get: get
};

Expand Down
9 changes: 0 additions & 9 deletions src/trace-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ var traceAgent;
function TraceAgent(config, logger) {
this.config_ = config;
this.logger = logger;
this.running = true;

hooks.activate(this);
pluginLoader.activate(this);
Expand All @@ -61,18 +60,10 @@ function TraceAgent(config, logger) {
logger.info('trace agent activated');
}

TraceAgent.prototype.isRunning = function() {
return this.running;
};

/**
* Halts this agent and unpatches any patched modules.
*/
TraceAgent.prototype.stop = function() {
// TODO: This property is only needed because of the way the tests are
// implemented. Change the tests so that this property is not
// needed.
this.running = false;
hooks.deactivate();
pluginLoader.deactivate();
cls.destroyNamespace();
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/preloaded-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
var assert = require('assert');
var agent = require('../../');

assert(agent.isActive());
assert(agent.get().isActive());
agent.get().stop();
console.log('Preload test passed.');
Loading

0 comments on commit b41e921

Please sign in to comment.