Giter Club home page Giter Club logo

cloud-trace-nodejs's People

Contributors

6utt3rfly avatar aaronfriel avatar bcoe avatar dominickramer avatar draffensperger avatar fhinkel avatar gcf-owl-bot[bot] avatar greenkeeper[bot] avatar jinwoo avatar justinbeckwith avatar kintel avatar kjin avatar matthewloring avatar michaelsafyan avatar misterpoe avatar ofrobots avatar oshalygin avatar piotrmoszkowicz avatar punya avatar release-please[bot] avatar renovate-bot avatar renovate[bot] avatar salakar avatar santima10 avatar sdowding avatar sofisl avatar soldair avatar splaktar avatar surferjeffatgoogle avatar yoshi-automation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-trace-nodejs's Issues

Determine where mongoose time is going that is not attributed to mongodb-core

var agent = require('@google/cloud-trace').start().private_();

var restify = require('restify');
var mongoose = require('mongoose');

var Simple = mongoose.model('Simple', mongoose.Schema({
  name: String
}));

var server = restify.createServer({
  name: 'TestServer'
});

server.get('/', function(req, res, next) {
  var span = agent.startSpan('Database work');
  Simple.findOne(function (err, sim) {
    agent.endSpan(span);
    res.send(200, sim);
    return next();
  });
});

mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.on('open', function() {
  var sim = new Simple({ name: 'Matt' });
  sim.save(function() {
    server.listen(8080);
  });
})

Add GCE VM information as a label to the traces

For people running on Compute Engine, it would be useful to be able to do filtering of the traces by VM. Right now the trace backend has no knowledge of which VM a particular trace was captured on. We should add this as a label on the traces. Once that is available, the UI can offer a way to filter by it. This issue only tracks the former.

require.resolve doesn't find all modules

We patch modules that may not be on the load path for the app running the agent (mongodb-core may not be on the load path if the app is using mongoose). We need to load these uniformly.

Agent cannot be restarted once stopped

Since hooks are loaded on module load, they are not reinstrumented when agent start is called a second time.

This fails:

agent.start();
var http = require('http');
assert(http.request.__unwrap);
agent.stop();
assert(!http.request.__unwrap);
agent.start();
assert(http.request.__unwrap);
agent.stop();
assert(!http.request.__unwrap);

Exception: cannot read property bindEmitter of Null

Run into this just now. Seems like we need a test for the path where we fail to get a project number. We need to completely disable the agent in such cases.

~/src/bookshelf2/bookshelf 2-structured-data
❯ node app.js
App listening at http://:::8080
ERROR:@google/cloud-trace: Unable to acquire the project number from metadata service. Please provide a valid project number as an env. variable, or through config.projectId passed to start().Error: Could not auto-discover project-id. Please export GCLOUD_PROJECT_NUM with your numeric project id
TypeError: Cannot read property 'bindEmitter' of null
    at middleware (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/@google/cloud-trace/lib/hooks/userspace/hook-express.js:40:12)
    at Layer.handle [as handle_request] (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:312:13)
    at /Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:330:12)
    at next (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:271:10)
    at expressInit (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/middleware/init.js:33:5)
    at Layer.handle [as handle_request] (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:312:13)
    at /Users/ofrobots/src/bookshelf2/bookshelf/node_modules/express/lib/router/index.js:280:7

Patch express closer to the public interface

Presently we are patching lazyRouter which is an internal interface. We should patch at the public API level. We are going to be prone to breakages even on point release of express if they change how the lazyRouter works.

Marking this as a bug because unless we fix this we can't be sure that the next patch-level release of express is going to work with us.

Ability to find the package.json from a loaded module

We want to do version checks to make, e.g. that we are patching express v4+. The current mechanism of looking for internal properties that we know have been removed in v4 is a bit too brittle for my taste. It would be much better if we can figure out where the package.json for a loaded module is, and do a check against the version there.

Ability to disable the trace agent using an env. var.

It would be nice to be able to disable the trace agent without having to modify the source. I am thinking an env. var. named GCLOUD_TRACE_DISABLE, which if set, would cause the trace agent to not start.

Similarly, it would be nice to have an environment variable that increases the log-level for the trace agent.

Add support for trace sampling and quotas

A good starting point would be to research what kinds of throttling options the Java trace agent exposes.
See PercentageTraceEnablingPolicy.java, RateLimiterTraceEnablingPolicy.java, as starting points.

config.projectId should be a string

The trace API expects the project Id to be a string, but does accept the numeric project Id. Users get a confusing error message when we try to post the traces to the API if they specific a numeric project Id as a number rather than a string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.