Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Use setInterval to upload metrics to Stackdriver periodically #168

Conversation

rueian
Copy link
Contributor

@rueian rueian commented Oct 27, 2018

Hi,

I made some changes to let stackdriver monitoring exporter upload metrics periodically, which are related to issue #152. Including:

  1. Use setInterval() to schedule metrics uploading.
  2. Add the close() method which can clear the setInterval timer.
  3. Change the behavior of .onRecord() and related test cases, because metrics will not be uploaded when .onRecord() is called.
  4. Make sure .catch() blocks in some test cases are executed by finishing them with mocha done()
  5. Map all non AggregationType.LAST_VALUE to stackdriver MetricKind.CUMULATIVE.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@rueian rueian force-pushed the stackdriver-monitoring-exporter-setinterval branch from e6d4593 to 55a3709 Compare October 27, 2018 08:04
@googlebot
Copy link

CLAs look good, thanks!

@rueian rueian force-pushed the stackdriver-monitoring-exporter-setinterval branch 9 times, most recently from 9921c51 to a1e32ec Compare October 28, 2018 02:23
return this.createTimeSeriesData(view, measurement);
});
async uploadViews() {
const timeSeries = [] as TimeSeries[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const timeSeries = [] as TimeSeries[];
const timeSeries: TimeSeries[] = [];

@rueian rueian force-pushed the stackdriver-monitoring-exporter-setinterval branch 2 times, most recently from 318cbff to 5fe2702 Compare October 31, 2018 01:53
@rueian rueian force-pushed the stackdriver-monitoring-exporter-setinterval branch from 5fe2702 to 3a81f26 Compare October 31, 2018 02:08
@kjin
Copy link
Contributor

kjin commented Nov 1, 2018

@isaikevych please merge at your leisure.

@rueian thanks for the contribution!

Copy link
Contributor

@isaikevych isaikevych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@isaikevych isaikevych merged commit 2fe600d into census-instrumentation:master Nov 2, 2018
@isaikevych
Copy link
Contributor

Fixes #152

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

Successfully merging this pull request may close these issues.

None yet

5 participants