Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackdriver Monitoring v4.0.0 raising errors when try to write TimeSeries #5348

Open
jonnysgomes-ia opened this issue May 15, 2024 · 0 comments

Comments

@jonnysgomes-ia
Copy link

Environment details

  • which product (packages/*): Stackdriver Monitoring v4.0.0
  • OS: Ubuntu 22.04 LTS
  • Node.js version: v20.8.1
  • npm version:
  • google-cloud-node version: 4.0.0

Steps to reproduce

  const monitoring = require('@google-cloud/monitoring');

  const client = new monitoring.MetricServiceClient();

  const jobBillableTimeInMinutes = (job.billable_time_ms / 1000) / 60;
  const metricType = `custom.googleapis.com/workflow/${resource_name}/job-duration`;

  const dataPoint = {
    interval: {
      endTime: {
        seconds: Date.now() / 1000
      },
    },
    value: {
      doubleValue: jobBillableTimeInMinutes
    },
  };

  const timeSeriesData = {
    metric: {
      type: metricType,
      labels: {
        run_id: run_id,
        job_name: job.name
      },
    },
    resource: {
      type: 'global',
      labels: {
        project_id: project_id,
      },
    },
    points: [dataPoint],
  };

  const request = {
    name: client.projectPath(project_id),
    timeSeries: [timeSeriesData],
  };

  console.log("Sending data to Google Cloud Monitoring")
  await client.createTimeSeries(request);

The provided code snippet throws the following error:

Error: 3 INVALID_ARGUMENT: One or more TimeSeries could not be written: One or more points were written more frequently than the maximum sampling period configured for the metric.: global{} timeSeries[0]:

The same code works with @google-cloud/monitoring: 3.0.5.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant