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

Metrics #953

Merged
merged 7 commits into from
Jul 27, 2016
Merged

Metrics #953

merged 7 commits into from
Jul 27, 2016

Conversation

ejholmes
Copy link
Contributor

@ejholmes ejholmes commented Jul 26, 2016

This sets up a small stats framework, and adds some middleware to all AWS clients that will increment some counters for aws requests and responses. This will allow us to get better visibility into throttling, or other issues.

We can also start using the stats.* methods to generate metrics for the other things, like number of deploys, how long deploys take, etc.

The stats package is just a small layer of abstraction over a statsd'ish client, and I've only provided a datadog implementation for now.

Metrics we should have

  • aws.request.* For outbound AWS requests
  • heroku.request.* For inbound Heroku API requests.
  • runtime.* Golang runtime stats.
  • heroku.auth.error for authorization errors.
  • core.* for core API calls.
  • scheduler.cloudformation.template_size For tracking generated template sizes

@ejholmes ejholmes changed the title AWS API metrics Metrics Jul 27, 2016
@phobologic
Copy link
Contributor

Would be cool if we had an errors metric that we could tag with different types of errors/urls, etc.

@ejholmes
Copy link
Contributor Author

Good call, I can add that to the embedded error reporter 👍

return stats.Null, nil
}

func newDataDogStats(addr string) (stats.Stats, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth at least having a datadog & plain statsd implementation at first. I think the only difference would be removing tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, yeah, I can add a plain statsd backend as well.

tags = append(tags, fmt.Sprintf("error:%s", err.Code()))
stats.Inc(fmt.Sprintf("aws.request.error"), 1, 1.0, tags)
stats.Inc(fmt.Sprintf("aws.request.%s.error", r.ClientInfo.ServiceName), 1, 1.0, tags)
stats.Inc(fmt.Sprintf("aws.request.%s.%s.error", r.ClientInfo.ServiceName, r.Operation.Name), 1, 1.0, tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

nm on the error stat :) sorry for jumping the gun

@phobologic
Copy link
Contributor

So awesome 👍

@ejholmes
Copy link
Contributor Author

ejholmes commented Jul 27, 2016

Added a commit that adds a statsd backend as well, and also changed the flag to --stats, so you can configure it like this:

empire server --stats=statsd://localhost:8125

Or

empire server --stats=dogstatsd://localhost:8126

Or

EMPIRE_STATS=statsd://localhost:8125 empire server

@ejholmes
Copy link
Contributor Author

Also added some sample of the go runtime metrics every 30 seconds as well.

@ejholmes ejholmes merged commit b9ed76e into master Jul 27, 2016
@ejholmes ejholmes deleted the stats branch July 27, 2016 19:13
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.

None yet

2 participants