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

Move Datadog to a plugin #261

Merged
merged 13 commits into from
Oct 10, 2017
Merged

Move Datadog to a plugin #261

merged 13 commits into from
Oct 10, 2017

Conversation

cory-stripe
Copy link
Contributor

@cory-stripe cory-stripe commented Sep 26, 2017

Summary

With the stage set, this moves Datadog to being a generic plugin… mostly.

Motivation

We want Datadog to be just another sink rather than the sink you must use. To that end we need to generalize metrics and make an interface for metric sinks. There are two major changes in this PR:

  • Use InterMetric rather than DDMetric from samplers and as the struct that sinks receive
  • Add a metric sink and hardwire it (for now) into the server

Test plan

Included tests! Will also verify with QA running, etc

Notes

  • This is time sensitive, since it's a rather large change and we don't want to do too much merging. Aiming for mid October
  • There's still some work to do to reconcile a metric sink and a plugin. To keep the complexity down, it's not in scope here.

Rollout/monitoring/revert plan

Will do some QA testing in a few weeks.

@cory-stripe cory-stripe changed the title WIP Move Datadog to a plugin Move Datadog to a plugin Sep 29, 2017
@stripe-ci
Copy link

Gerald Rule: Copy Observability on Veneur and Unilog pull requests

cc @stripe/observability
cc @stripe/observability-stripe

@cory-stripe
Copy link
Contributor Author

Copy link
Contributor

@asf-stripe asf-stripe left a comment

Choose a reason for hiding this comment

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

this looks cool to me so far!

s.Statsd.Count("worker.checks_flushed_total", int64(len(checks)), nil, 1.0)

go s.metricSinks[0].FlushEventsChecks(span.Attach(ctx), events, checks) // we can do all of this separately
go s.flushTraces(span.Attach(ctx))
Copy link
Contributor

Choose a reason for hiding this comment

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

feels like we could provide a method to cancel those goroutines somehow, passing in a context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You think it's ok to defer this work until it's no longer a hardcoded s.metricSinks[0]? My next move is to convert plugins into this interface and make this agnostic to backends. That feels like a good time to fix the cancellation.

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds good to me!

@parabuzzle
Copy link
Contributor

I just opened #275 as a stop gap to fix the errors when you try to remove the datadog config.. I like this PR for the longer term fix. Feel free to close my PR if this PR is something we can start using in the next few weeks.

@gphat
Copy link
Contributor

gphat commented Oct 7, 2017

I’d definitely prefer to merge this first. We likely would’ve already if I wasn’t OoO for a bit.

@gphat gphat mentioned this pull request Oct 7, 2017
@cory-stripe cory-stripe force-pushed the cory-more-dd-plugification branch 2 times, most recently from 96f64b5 to d7d27ac Compare October 9, 2017 21:02
@asf-stripe
Copy link
Contributor

LGTM

metrics := c.Flush(10 * time.Second)
assert.Equal(t, 0.5, metrics[0].Value[0][1], "Metric value")
assert.Equal(t, float64(5), metrics[0].Value, "Metric value")
Copy link
Contributor

Choose a reason for hiding this comment

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

So to be clear: the reason this value has changed is that we're now letting the sampler provide the "true" value, and the per-interval rate calculation is being done within the plugin (ie, by Datadog)?

@ChimeraCoder
Copy link
Contributor

lgtm!

@cory-stripe cory-stripe force-pushed the cory-more-dd-plugification branch from 5947001 to 6a1bc97 Compare October 10, 2017 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants