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

Instrument plan/apply commands with Prometheus metrics #790

Closed
wants to merge 1 commit into from

Conversation

psalaberria002
Copy link
Contributor

@psalaberria002 psalaberria002 commented Sep 26, 2019

Solves #258

@codecov
Copy link

codecov bot commented Sep 26, 2019

Codecov Report

Merging #790 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #790      +/-   ##
==========================================
+ Coverage   72.78%   72.85%   +0.06%     
==========================================
  Files          63       63              
  Lines        4807     4819      +12     
==========================================
+ Hits         3499     3511      +12     
  Misses       1050     1050              
  Partials      258      258
Impacted Files Coverage Δ
cmd/server.go 79.42% <ø> (ø) ⬆️
server/events/command_runner.go 55.17% <100%> (+2.23%) ⬆️
server/server.go 64.61% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e4dc33d...1f216df. Read the comment docs.

@psalaberria002 psalaberria002 force-pushed the metrics branch 2 times, most recently from 9f2f99a to e7d6dc3 Compare September 26, 2019 14:14
func Init(logger *logging.SimpleLogger) {
http.Handle("/metrics", promhttp.Handler())
go func() {
logger.Info("Metrics server started - listening on port 2122")
Copy link
Member

Choose a reason for hiding this comment

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

pranked! (it's on 2112 😆 )

Copy link
Member

@lkysow lkysow left a comment

Choose a reason for hiding this comment

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

Is this all the metrics that people need? In your operational experience this is all you need?
Would be nice to add more if there are some to add so we can see what applying this pattern throughout the application will look like.

I'm a little wary to tie ourselves to prometheus this much. Is there not a generic approach we can follow?

@@ -314,13 +316,25 @@ func (c *DefaultCommandRunner) automerge(ctx *CommandContext, pullStatus models.
func (c *DefaultCommandRunner) runProjectCmds(cmds []models.ProjectCommandContext, cmdName models.CommandName) CommandResult {
var results []models.ProjectResult
for _, pCmd := range cmds {
cmdStart := time.Now().UnixNano()
Copy link
Member

Choose a reason for hiding this comment

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

It's going to get ugly adding this for all the different metrics people will want measured. Can you make this cleaner?

},
[]string{"repo", "directory", "workspace", "command", "success"},
)
OpsInProgress = promauto.NewGaugeVec(
Copy link
Member

Choose a reason for hiding this comment

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

I like this metric, good call

)
OpsInProgress = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Name: "atlantis_ops_in_progress_total",
Copy link
Member

Choose a reason for hiding this comment

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

Do we need total? If it's a gauge isn't that implied?

)

func Init(logger *logging.SimpleLogger) {
http.Handle("/metrics", promhttp.Handler())
Copy link

Choose a reason for hiding this comment

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

While /metrics is the default path, /prometheus is an increasingly common standard, so it might be nice to have the path configurable.

@lkysow lkysow added the waiting-on-response Waiting for a response from the user label Nov 7, 2019
@psalaberria002
Copy link
Contributor Author

Prometheus increase function is not accurate when creating new metrics. The first step is not counted. This makes it very unreliable. I will close the PR. If someone wants to pick it up, and change to use a different metric library feel free to do so. I don't have time for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants