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

feat: Add stats support for basic operations #2147

Merged
merged 11 commits into from
Mar 18, 2022

Conversation

nishkrishnan
Copy link
Contributor

@nishkrishnan nishkrishnan commented Mar 16, 2022

This implementation uses tally, an OSS library for emitting stats. This implementation supports only statsd currently, however since this lib supports other stats providers (like prometheus) it's relatively straightforward to add support in atlantis for it.

To configure statsd, you can do so via the server config yaml:

ie.

metrics:
  statsd:
    host: '127.0.0.1'
    port: '8125'

Note: this is copied from the lyft fork, hence the large PR. This works internally in production.

TODO:

  • Add docs on this

@nishkrishnan nishkrishnan requested a review from a team as a code owner March 16, 2022 23:44
@nishkrishnan nishkrishnan mentioned this pull request Mar 16, 2022
Copy link
Contributor

@majormoses majormoses left a comment

Choose a reason for hiding this comment

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

LGTM though I wont pretend I am good with golang.

return j.ProjectJobsTemplate.Execute(w, viewData)
}

func (j *JobsController) GetProjectJobs(w http.ResponseWriter, r *http.Request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also be lowercase?

Suggested change
func (j *JobsController) GetProjectJobs(w http.ResponseWriter, r *http.Request) {
func (j *JobsController) getProjectJobs(w http.ResponseWriter, r *http.Request) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, these should be exported ideally to represent that only this function should be called since it has stats associated with it.

return nil
}

func (j *JobsController) GetProjectJobsWS(w http.ResponseWriter, r *http.Request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be lowercase?

Suggested change
func (j *JobsController) GetProjectJobsWS(w http.ResponseWriter, r *http.Request) {
func (j *JobsController) getProjectJobsWS(w http.ResponseWriter, r *http.Request) {

@nishkrishnan nishkrishnan merged commit d1d1539 into runatlantis:master Mar 18, 2022
@nishkrishnan nishkrishnan deleted the nish/add-stats-upstream branch March 18, 2022 22:18
@marceloboeira
Copy link
Contributor

@nishkrishnan if I add:

metrics:
  statsd:
    host: '127.0.0.1'
    port: '8125

to my atlantis yaml it breaks it:

Error: initializing server: parsing atlantis.yaml file: yaml: unmarshal errors:
  line 6: field metrics not found in type raw.GlobalCfg

@evanstachowiak
Copy link

@nishkrishnan if I add:

metrics:
  statsd:
    host: '127.0.0.1'
    port: '8125

to my atlantis yaml it breaks it:

Error: initializing server: parsing atlantis.yaml file: yaml: unmarshal errors:
  line 6: field metrics not found in type raw.GlobalCfg

@marceloboeira you're missing a closing single-quote on your port: line.

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