Skip to content

Commit

Permalink
add support for stackdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Sep 30, 2018
1 parent 1fb4f53 commit 711dd56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
'use strict';
if (process.env.EDGEMICRO_STACKDRIVER) {
if (!process.env.GCP_PROJECT_ID || !process.env.GCP_KEY_FILE) {
console.log("env GCP_PROJECT_ID or GCP_KEY_FILE is missing, skipping trace");
} else {
require('@google-cloud/trace-agent').start({
projectId: process.env.GCP_PROJECT_ID,
keyFilename: process.env.GCP_KEY_FILE,
logLevel: 4,
enabled: true,
flushDelaySeconds: 5
});
}
}

var request = require('request');
var url = require('url');
Expand All @@ -16,6 +29,12 @@ options.org = process.env.EDGEMICRO_ORG;
options.configDir = process.env.EDGEMICRO_CONFIG_DIR || os.homedir()+"/.edgemicro";
options.configUrl = process.env.EDGEMICRO_CONFIG_URL;
options.processes = process.env.EDGEMICRO_PROCESSES || os.cpus().length;
options.pluginDir = process.env.EDGEMICRO_PLUGIN_DIR;
options.apiProxyName = process.env.EDGEMICRO_API_PROXYNAME;
options.revision = process.env.EDGEMICRO_API_REVISION;
options.basepath = process.env.EDGEMICRO_API_BASEPATH;
options.target = process.env.EDGEMICRO_API_TARGET;

options.port = process.env.PORT || 8000;

if (!options.key ) { console.log('key is required'); process.exit(1);}
Expand Down
2 changes: 1 addition & 1 deletion app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#
# [START runtime]
service: microgateway
runtime: nodejs
runtime: nodejs8
env: flex
automatic_scaling:
min_num_instances: 1
Expand Down

0 comments on commit 711dd56

Please sign in to comment.