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 statsd to k8s-run #374

Merged
merged 5 commits into from
Nov 14, 2018
Merged

Add statsd to k8s-run #374

merged 5 commits into from
Nov 14, 2018

Conversation

dturn
Copy link
Contributor

@dturn dturn commented Nov 2, 2018

Add statsd calls to aid in tracking useage.

Copy link
Contributor

@timothysmith0609 timothysmith0609 left a comment

Choose a reason for hiding this comment

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

One question about the entrypoint tag but otherwise lgtm

lib/kubernetes-deploy/runner_task.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@karanthukral karanthukral left a comment

Choose a reason for hiding this comment

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

Same question as Tim since we pay per unique tag combinations too! Rest looks good!

Copy link
Contributor

@KnVerey KnVerey left a comment

Choose a reason for hiding this comment

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

FYI @fw42 this adds statsd to the task runner, in case you have opinions on naming or on tags that would be helpful.

lib/kubernetes-deploy/runner_task.rb Outdated Show resolved Hide resolved
@@ -44,11 +45,14 @@ def run!(task_template:, entrypoint:, args:, env_vars: [], verify_result: true)
else
record_status_once(pod)
end
::StatsD.distribution('run.duration', StatsD.duration(start), tags: tags('success'))
Copy link
Contributor

Choose a reason for hiding this comment

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

why distribution instead of measure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, I only learned this when policial yelled at me. I believe its because https://github.com/Shopify/statsd-instrument#statsddistribution is more efficient (/cost effective)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, those docs say This is only supported by the beta datadog implementatation.--is that going to work for everyone? What was the Policial error exactly? Reading the DD docs about this, I don't really see why Distribution would be the right fit for this kind of metric. These will be really sparse, and we can't do any sampling of them. If we do need to switch, then shouldn't we switch all of our equivalent metrics too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shopify/Datadog: The measure and histogram APIs are no longer the accepted way to submit metrics to Datadog with statsd-instrument. Please prefer StatsD.distribution - a modified guage that submits a distribution of values of a sample period. All arithmetic and calculation happens server side and saves Shopify tons of money on Datadog metric submission counts. See https://github.com/Shopify/statsd-instrument#statsddistribution and https://www.datadoghq.com/blog/summary-graphs-metric-graphs-101/#distributions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, those docs say This is only supported by the beta datadog implementatation.--is that going to work for everyone?

I think so, though other people will have to talk to DD to get it turned on while it's in beta.

Reading the DD docs about this, I don't really see why Distribution would be the right fit for this kind of metric. These will be really sparse, and we can't do any sampling of them. If we do need to switch,

I didn't see anything about them being sparse. Can you link to where you saw that? What I read (https://docs.datadoghq.com/graphing/metrics/distributions/) makes it look like you have to be explicit in DD itself about which tags from built-in integrations we care about.

then shouldn't we switch all of our equivalent metrics too?

Probably, there are only 9 of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, though other people will have to talk to DD to get it turned on while it's in beta.

I watched the internal video about distributions, and now don't see any internal reason not to switch. But forcing other companies to enable a beta feature on their Datadog account to be able to emit metrics from our gem feels wrong to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked to Peer and distributions are in GA, the docs are just out of date.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok. In that case I'm ok with switching them all. This might still count as a breaking change though, since if I understand correctly it will break dashboards until the distribution is configured in Datadog to produce the aggregations we need (and there's no backfill, so we need to be sure to do that right away).

lib/kubernetes-deploy/runner_task.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
Update to use distribution

Use distributions everywhere
@dturn dturn force-pushed the statsd-k8s-run branch 2 times, most recently from 3a4a1e1 to b2e9e4a Compare November 7, 2018 22:35
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
test/integration-serial/serial_task_run_test.rb Outdated Show resolved Hide resolved
@dturn
Copy link
Contributor Author

dturn commented Nov 14, 2018

I've limited the changes to k8s restart & run. Will do deploy later. Last chance for 👀

@KnVerey
Copy link
Contributor

KnVerey commented Nov 14, 2018

👍

@dturn dturn merged commit 2a72399 into master Nov 14, 2018
@dturn dturn deleted the statsd-k8s-run branch November 14, 2018 22:12
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

Successfully merging this pull request may close these issues.

4 participants