Stage errors for repo integration#2017
Conversation
|
cc @GoogleCloudPlatform/node-team |
|
This PR brings in the Stackdriver Error Reporting library as a client library. This is currently available as the At the moment this only has support for the 'write' side of the Error Reporting API, but we expect to add the 'read' side of the API in follow-ons. |
|
@GoogleCloudPlatform/node-team ready for a look |
packages/error-reporting/.jshintrc
Outdated
| "undef": true, | ||
| "unused": "vars", | ||
| "globals": { | ||
| /* Mocha-provided globals */ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/.travis.yml
Outdated
| sudo: false | ||
| language: node_js | ||
| node_js: | ||
| - '0.12' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| */ | ||
| CustomStackTrace.prototype.setFilePath = function(filePath) { | ||
|
|
||
| this.filePath = isString(filePath) ? filePath: ''; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
kjin
left a comment
There was a problem hiding this comment.
Looks good from my end (w/ nit).
| Fuzzer.prototype.generate.array = function(len, ofOneType, currentDepth, allowedDepth) { | ||
|
|
||
| var lenChecked = isNumber(len) ? len : random(1, 10); | ||
| var availableTypes = (isString(ofOneType) && (indexOf(this.types(), ofOneType) > -1)) ? [ofOneType]: this.types(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/.travis.yml
Outdated
| @@ -0,0 +1,8 @@ | |||
| sudo: false | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/.npmignore
Outdated
| @@ -0,0 +1,5 @@ | |||
| /bin | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,29 @@ | |||
| # Node.js Agent for Google Cloud Errors ChangeLog | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/bin/test.sh
Outdated
| @@ -0,0 +1,80 @@ | |||
| #!/usr/bin/env bash | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "main": "index.js", | ||
| "repository": "GoogleCloudPlatform/google-cloud-node", | ||
| "scripts": { | ||
| "test": "$(npm bin)/nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,55 @@ | |||
| { | |||
| "name": "@google-cloud/error-reporting", | |||
| "version": "0.1.0", | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,55 @@ | |||
| { | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "scripts": { | ||
| "test": "$(npm bin)/nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", | ||
| "integration-tests": "$(npm bin)/nyc --exclude=\"error-message.js\" $(npm bin)/mocha ./test/system-test/*.js", | ||
| "style": "$(npm bin)/jshint lib index.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "repository": "GoogleCloudPlatform/google-cloud-node", | ||
| "scripts": { | ||
| "test": "$(npm bin)/nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", | ||
| "integration-tests": "$(npm bin)/nyc --exclude=\"error-message.js\" $(npm bin)/mocha ./test/system-test/*.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "@google-cloud/common": "^0.12.0", | ||
| "extend": "^3.0.0", | ||
| "is": "^3.2.0", | ||
| "lodash.has": "^4.5.2" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@stephenplusplus ready for another look |
|
@cristiancavalli thanks! As far as the code of the library itself, I'm going to remain hands-off there and let you guys run it the way you see fit. As long as you're happy with how it looks and acts, I'm not concerned if it doesn't follow the conventions of the other parts of our library. I'm mostly concerned with the details of the integration when it comes to testing, releasing, and docs. Those are the types of questions I've brought up in comments above, attached to their relevant files in the PR. PTAL for those and feel free to elaborate on the expectations for these integrations. |
packages/error-reporting/README.md
Outdated
| > **This is not an official Google product.** This module is experimental and may not be ready for use. | ||
| > This module uses APIs that may be undocumented and are subject to change without notice. | ||
|
|
||
| This modules provides Stackdriver Error Reporting support for Node.js applications. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/README.md
Outdated
|
|
||
| Container Engine nodes need to also be created with the `https://www.googleapis.com/auth/cloud-platform` scope, which is configurable during cluster creation. Alternatively, you can follow the instructions for using a service account under [running elsewhere](#running-elsewhere). It's recommended that you store the service account credentials as [Kubernetes Secret](http://kubernetes.io/v1.1/docs/user-guide/secrets.html). | ||
|
|
||
| ## Running elsewhere |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/README.md
Outdated
| ```JS | ||
| var express = require('express'); | ||
| var app = express(); | ||
| // Will create a errors instance based off env variables |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,230 @@ | |||
| # Node.js module for Stackdriver Error Reporting | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| path: '/error', | ||
| handler: function(request, reply) { | ||
| throw new Error('Custom error message'); | ||
| reply('Something broke!'); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "repository": "GoogleCloudPlatform/google-cloud-node", | ||
| "scripts": { | ||
| "test": "nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", | ||
| "system-test": "nyc --exclude=\"error-message.js\" $(npm bin)/mocha ./test/system-test/*.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,353 @@ | |||
| /** | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "test": "nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", | ||
| "system-test": "nyc --exclude=\"error-message.js\" $(npm bin)/mocha ./test/system-test/*.js", | ||
| "lint": "jshint src/ index.js", | ||
| "docs": "jsdoc -d docs index.js src/", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "main": "index.js", | ||
| "repository": "GoogleCloudPlatform/google-cloud-node", | ||
| "scripts": { | ||
| "test": "nyc --exclude=\"fuzzer.js\" $(npm bin)/mocha ./test/unit/*.js", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| "@google-cloud/common": "^0.12.0", | ||
| "extend": "^3.0.0", | ||
| "is": "^3.2.0", | ||
| "lodash.has": "^4.5.2" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Moving the convo about how we're planning to integrate out here instead of in the code comments section RE: #2017 (comment) Let me know if this sounds right. Before we merge, this is the extent of our process integration. The GCN CI:
|
|
@stephenplusplus Your proposal seems like the best given the current constraints |
|
Cool, then @callmehiphop, can you step in and figure out what we need to do for docs? Also cc @lukesneeringer for any thoughts on the "big picture" plan outlined above. |
|
For the purposes of making progress on this PR, it makes sense to skip CI for now, but I would expect a follow-on refactor to add the unit tests and system tests back into the CI. At least that is my understanding of the integration here. |
That makes me all kinds of nervous. Is there a hard deliverable or OKR to get this done? What is the challenge here? Is it just moving the tests up one level, or something else? |
|
@lukesneeringer The idea was to keep the review burden on y'all for the initial PR low. If that is not a problem, then we can add the CI refactoring here too. I am not too worried though as the origin repo for this code is still running CI, and my expectation is that we will immediately follow-up on with CI support this repo once this PR lands. |
|
@ofrobots Sold. |
|
I am guessing that the 'sold' refers to landing + following up with a PR to enable CI support. @cristiancavalli, @stephenplusplus anything else that remains to be done before proceeding here? |
|
@ofrobots It essentially meant, "I accept what you said and am happy with it." Sorry. :-) |
|
I believe we still need to figure out the docs, which is why this is assigned to @callmehiphop. |
callmehiphop
left a comment
There was a problem hiding this comment.
For a documentation review, we need a few things
Overview configs
Essentially I think we just need the following code added to the OVERVIEW map
'error-reporting': {
title: 'Error Reporting',
instanceName: 'errors'
},Otherwise I found the examples in the index.js file to be kind of lacking? We don't quite follow the ways of JSDoc, so this would be the only file to really show up on our doc site.
A few alterations are also needed within our documentation scripts, but I can put a PR together for that this afternoon.
| * @memberof Configuration | ||
| * @public | ||
| * @function getCredentials | ||
| * @returns {Credentials\Null} - returns the _credentials property |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/index.js
Outdated
| @@ -0,0 +1,97 @@ | |||
| /** | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/index.js
Outdated
| * this function will also return an interface which can be used manually via | ||
| * the `report` function property, with hapi via the `hapi` object property or | ||
| * with express via the `express` function property. | ||
| * @function initConfiguration |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/error-reporting/index.js
Outdated
| uncaughtException(client, config); | ||
|
|
||
| // Build the application interfaces for use by the hosting application | ||
| this.hapi = hapi(client, config); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Adding onto the comment about examples in |
|
@stephenplusplus @callmehiphop Thanks for the feedback gentlemen! Changes are posted cc @ofrobots |
df8c167 to
58af011
Compare
|
@stephenplusplus freshly rebased |
|
Looks like the lint task is failing. Can you run 'npm run lint' from the root directory to take a look? |
|
@stephenplusplus updated |
|
@stephenplusplus @callmehiphop I'm having some trouble with the snippet test, specifically this error from the ci: Would you gentlemen know where this is coming from and how to fix it? |
|
@stephenplusplus @lukesneeringer bump. It would be good to be able to land this soon. |
|
@cristiancavalli sorry I didn't catch this one in my docs review! When we write examples we don't include any snippets on how to require the module itself. This code usually is generated and included within an overview. After which, we assume any requiring of Long story short, the fix would be to remove the |
|
@callmehiphop Thanks for the info! Updated the PR and added fake injection dependencies for snippet tests. |
|
Changes Unknown when pulling 475eedb on cristiancavalli:error-library-integration into ** on GoogleCloudPlatform:master**. |
|
Build is now passing on CircleCI |
|
Hooray!! 🎉 🍰 |
TODOS: