I am trying to add Stackdriver Monitoring/Trace/Debugger/Profiler in my
Google App Engine NodeJs App(Flexible env), now in order to add all of them
i have added below code
// Google Trace API
require('@google-cloud/trace-agent').start();
// Google Trace API
//
require('@google-cloud/profiler').start();
//
// Google Debugger
require('@google-cloud/debug-agent').start();
// Google Debugger
But for Adding Monitoring we have to explicity define *project-id* and
other things.
// Imports the Google Cloud client library
const monitoring = require('@google-cloud/monitoring');
// Your Google Cloud Platform project ID
const projectId = 'YOUR_PROJECT_ID';
// Creates a client
const client = new monitoring.MetricServiceClient();
// Prepares an individual data point
const dataPoint = {
interval: {
endTime: {
seconds: Date.now() / 1000,
},
},
value: {
// The amount of sales
doubleValue: 123.45,
},
};
// Prepares the time series request
const request = {
name: client.projectPath(projectId),
timeSeries: [
{
// Ties the data point to a custom metric
metric: {
type: 'custom.googleapis.com/stores/daily_sales',
labels: {
store_id: 'Pittsburgh',
},
},
resource: {
type: 'global',
labels: {
project_id: projectId,
},
},
points: [dataPoint],
},
],
};
// Writes time series data
client
.createTimeSeries(request)
.then(results => {
console.log(`Done writing time series data.`, results[0]);
})
.catch(err => {
console.error('ERROR:', err);
});
Now i am just wondering are these steps defined for adding CLoud Monitoring
to VM's or other machines *other* than App Engine, or these steps are for
App Engine also.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/f51fb8c1-6211-4e9a-a9e1-cf636f052ccc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.