-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instrument plan/apply commands with Prometheus metrics
- Loading branch information
1 parent
e4dc33d
commit e7d6dc3
Showing
307 changed files
with
60,179 additions
and
12,445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
"github.com/runatlantis/atlantis/server/logging" | ||
|
||
"net/http" | ||
) | ||
|
||
var ( | ||
OpsProcessedHistogram = promauto.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Name: "atlantis_ops_seconds", | ||
Help: "Histogram for plan/apply operations", | ||
Buckets: []float64{5, 10, 30, 60, 300, 600}, | ||
}, | ||
[]string{"repo", "directory", "workspace", "command", "success"}, | ||
) | ||
OpsInProgress = promauto.NewGaugeVec( | ||
prometheus.GaugeOpts{ | ||
Name: "atlantis_ops_in_progress_total", | ||
Help: "The total number of in-progress plan/apply operations", | ||
}, | ||
[]string{"repository", "directory", "workspace", "operation"}, | ||
) | ||
) | ||
|
||
func Init(logger *logging.SimpleLogger) { | ||
http.Handle("/metrics", promhttp.Handler()) | ||
go func() { | ||
logger.Info("Metrics server started - listening on port 2122") | ||
err := http.ListenAndServe(":2112", nil) | ||
if err != nil { | ||
logger.Err("unable to start metrics server: %s", err) | ||
} | ||
}() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.