@@ -146,8 +146,6 @@ Debuglet.normalizeConfig_ = function(config) {
146146 var envConfig = {
147147 logLevel : process . env . GCLOUD_DEBUG_LOGLEVEL ,
148148 serviceContext : {
149- // If running on GKE, we will set service context later once
150- // the cluster name can be retrieved from the metadata service.
151149 service : process . env . GAE_SERVICE || process . env . GAE_MODULE_NAME ,
152150 version : process . env . GAE_VERSION || process . env . GAE_MODULE_VERSION ,
153151 // Debug UI expects GAE_MINOR_VERSION to be available for AppEngine, but
@@ -208,23 +206,14 @@ Debuglet.prototype.start = function() {
208206
209207 that . logger_ . info ( 'Unique ID for this Application: ' + id ) ;
210208
211- that . getMetadataValues_ ( function ( err , values ) {
209+ that . getProjectId_ ( function ( err , project , onGCP ) {
212210 if ( err ) {
213211 that . logger_ . error ( 'Unable to discover projectId. Please provide ' +
214212 'the projectId to be able to use the Debuglet' ,
215213 err ) ;
216214 that . emit ( 'initError' , err ) ;
217215 return ;
218216 }
219- var project = values . project ;
220- var clusterName = values . clusterName ;
221- var onGCP = values . onGCP ;
222-
223- if ( clusterName ) {
224- // If we succeeded to get a cluster name, we must be running on gke.
225- that . config_ . serviceContext . service = clusterName ;
226- that . config_ . serviceContext . version = 'unversioned' ;
227- }
228217
229218 that . getSourceContext_ ( function ( err , sourceContext ) {
230219 if ( err ) {
@@ -330,7 +319,7 @@ Debuglet.createDebuggee =
330319/**
331320 * @private
332321 */
333- Debuglet . prototype . getMetadataValues_ = function ( callback ) {
322+ Debuglet . prototype . getProjectId_ = function ( callback ) {
334323 var that = this ;
335324
336325 // We need to figure out whether we are running on GCP. We can use our ability
@@ -350,11 +339,7 @@ Debuglet.prototype.getMetadataValues_ = function(callback) {
350339 if ( ! project ) {
351340 return callback ( err ) ;
352341 }
353- metadata . instance (
354- 'attributes/cluster-name' , function ( err , response , metadataCluster ) {
355- return callback ( null ,
356- { project : project , clusterName : metadataCluster , onGCP : onGCP } ) ;
357- } ) ;
342+ return callback ( null , project , onGCP ) ;
358343 } ) ;
359344} ;
360345
0 commit comments