in blueprints/apigee/apigee-x-foundations/functions/instance-monitor/index.js [77:109]
async function writeTimeSeriesData(projectId, metricType, resourceType, value, metricLabels) {
const dataPoint = {
interval: {
endTime: {
seconds: Date.now() / 1000,
},
},
value: {
boolValue: value,
},
};
const timeSeriesData = {
metric: {
type: metricType,
labels: metricLabels,
},
resource: {
type: resourceType,
labels: {
project_id: projectId,
},
},
points: [dataPoint],
};
const request = {
name: client.projectPath(projectId),
timeSeries: [timeSeriesData],
};
return await client.createTimeSeries(request);
}