-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: feat: Add Stackdriver integration #59
Conversation
} | ||
|
||
// Start Trace | ||
trace.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the trace-agent needed to be started as the very first part of the app:
require('@google-cloud/trace-agent').start();
See https://www.npmjs.com/package/@google-cloud/trace-agent#usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's a hard requirement, we have it imported after http
and on-finish
modules, which I don't think have a starter script like this.
I think that suggestion is just added to ensure that the full trace is added rather than a partial trace.
d.run(() => { | ||
d.run(async () => { | ||
// Start the debugger (if not alreay started) | ||
const tools = startTooling(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is overhead both in starting the tooling, and ongoing performance overhead. Is there a way for the user to opt out of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ease in turning instrumentation on and off, it would be nice to toggle this with an environment variable instead of something requiring a redeployment (e.g., adjusted container entrypoint)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The PRD specifies the following semantics:
Enable/disable Stackdriver APM
As a developer, I can enable or disable individual Stackdriver APM features. The on/off state is controlled by an environment variable as follows:
Stackdriver APM feature | Environment variable |
---|---|
Stackdriver Trace | GOOGLE_CLOUD_TRACE_ENABLED |
If the environment variable is set to false
or if it is not set, the feature should be disabled by default.
By default, Stackdriver APM features are enabled on Cloud Functions
As a developer on Cloud Functions, when I deploy my function Stackdriver Trace is enabled by default. The container into which my function is deployed will, e.g., automatically set the value of the GOOGLE_CLOUD_TRACE_ENABLED
environment variable to true
.
@@ -26,6 +26,8 @@ import * as express from 'express'; | |||
import * as http from 'http'; | |||
import * as onFinished from 'on-finished'; | |||
|
|||
import { startTooling } from './tools'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: diagnostics
instead of tools
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if the specific file name matters.
@@ -0,0 +1,60 @@ | |||
import * as debugAgent from '@google-cloud/debug-agent'; | |||
import * as profiler from '@google-cloud/profiler'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that profiler currently has limitations on working with musl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Do you recommend removing it? Or what is the suggestion?
In terms of fixing this PR, we need to setup gcloud with Travis and add the env var. |
This PR needs more of a design doc and solution across all FFs. Let's continue in the GitHub issue. |
WIP: Adds StackDriver Debug, Trace, and Profiler support.
TODO:
Open Questions
Fixes: #57