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

Add support for importing counters to Stackdriver #13

Closed
knyar opened this issue Nov 20, 2018 · 0 comments
Closed

Add support for importing counters to Stackdriver #13

knyar opened this issue Nov 20, 2018 · 0 comments
Assignees

Comments

@knyar
Copy link
Collaborator

knyar commented Nov 20, 2018

Currently query results get written to Stackdriver as GAUGE metrics.

This does not work well for importing SLIs, since an SLI is typically a ratio of two counters (good_events / valid_events). To allow calculating a ratio over an arbitrary long time window, we'll need ts-bridge to import both counters (good_events and valid_events) to Stackdriver separately as cumulative metrics.

This is not trivial, since CUMULATIVE metrics in Stackdriver require the client to report start_time (metric reset time) with each point. This timestamp is usually set to the start time of the process exporting a counter, and is used by Stackdriver to track counter resets.

I believe we should be able to use Datadog's cumsum function to get a cumulative counter, and then export it to Stackdriver as a CUMULATIVE metric.

This will require keeping some internal state per counter, and I think we can use metric records for that.

@knyar knyar self-assigned this Nov 20, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
MetricRecord is now an interface that is implemented by
DatastoreMetricRecord. This makes testing easier, and will also make it
easier to add alternative data stores for metric records.

I've not changed existing tests to use now-mockable MetricRecord, since
running tests against local datastore emulator works well enough.

This commit also adds a new field to the metric record
(DatadogCounterStart) that is necessary for google#13.
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
MetricRecord is now an interface that is implemented by
DatastoreMetricRecord. This makes testing easier, and will also make it
easier to add alternative data stores for metric records.

I've not changed existing tests to use now-mockable MetricRecord, since
running tests against local datastore emulator works well enough.

This commit also adds a new field to the metric record
(CounterStartTime) that is necessary for google#13.
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 22, 2018
knyar added a commit to knyar/ts-bridge that referenced this issue Nov 23, 2018
knyar added a commit that referenced this issue Nov 23, 2018
MetricRecord is now an interface that is implemented by
DatastoreMetricRecord. This makes testing easier, and will also make it
easier to add alternative data stores for metric records.

I've not changed existing tests to use now-mockable MetricRecord, since
running tests against local datastore emulator works well enough.

This commit also adds a new field to the metric record
(CounterStartTime) that is necessary for #13.
@knyar knyar closed this as completed in 05f48ab Nov 23, 2018
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