async function recordMetric() {
const seconds = Date.now() / 1000
const dataPoint: google.monitoring.v3.IPoint = {
interval: {endTime: {seconds}},
value: {int64Value: 1},
}
const labels: Record<string, string> = {backendVersion}
const timeSeriesData = {
metric: {
labels,
},
resource: {
type: 'global',
labels: {
project_id: projectId!,
},
},
points: [dataPoint],
}
const request = {name: client.projectPath(projectId!), timeSeries: [timeSeriesData]}
await client.createTimeSeries(request)
}
From my research, it looks like this writes immediately and doesn't do any batching of requests. Google doesn't mention anywhere in their instructions for using this client that I'd need to manage batching on my own. Since the Cloud Functions shut down after the request is complete, I think that also means delaying metric submission will delay metrics showing up or even being dropped.
Has anyone else run into this? Am I using the client incorrectly? I don't see any configuration options for batching.