-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wercker fixes Fixing tests with a small sleep to sync state Add release pipeline (let's see if it works) Fixed some whitespace and names Prometheus metrics for some level of stat tracking (needs more work) UUID implementation and fallback upon ratelimt
- Loading branch information
Showing
10 changed files
with
260 additions
and
38 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
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,114 @@ | ||
package main | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
const namespace = "imgd" | ||
|
||
var ( | ||
inFlightGauge = prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: "http", | ||
Name: "in_flight_requests", | ||
Help: "A gauge of requests currently being served.", | ||
}) | ||
|
||
requestDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: "http", | ||
Name: "request_duration_seconds", | ||
Help: "Histogram of the time (in seconds) each HTTP request took.", | ||
Buckets: []float64{.001, .005, 0.0075, .01, .025, .1, .5, 1, 5}, | ||
}, []string{"code"}) | ||
|
||
responseSize = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: "http", | ||
Name: "response_size_bytes", | ||
Help: "A histogram of response sizes (in bytes) for requests.", | ||
Buckets: []float64{100, 500, 1000, 2500, 5000}, | ||
}, []string{}) | ||
|
||
processingDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: "image", | ||
Name: "processing_duration_seconds", | ||
Help: "Histogram of the time (in seconds) image processing took.", | ||
Buckets: []float64{.00025, .0005, 0.001, 0.0025, .005}, | ||
}, []string{"resource"}) | ||
|
||
getDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: "texture", | ||
Name: "get_duration_seconds", | ||
Help: "Histogram of the time (in seconds) each texture GET took.", | ||
Buckets: []float64{.1, .25, .5, 1}, | ||
}, []string{"source"}) | ||
|
||
cacheDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: "cache", | ||
Name: "operation_duration_seconds", | ||
Help: "Histogram of the time (in seconds) each cache operation took.", | ||
Buckets: []float64{.0005, .001, 0.0025, .005, 0.0075, 0.01, 0.1}, | ||
}, []string{"operation"}) | ||
|
||
errorCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: "status", | ||
Name: "errors", | ||
Help: "Error events", | ||
}, | ||
[]string{"event"}, | ||
) | ||
|
||
cacheCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: "status", | ||
Name: "cache", | ||
Help: "Cache status", | ||
}, | ||
[]string{"status"}, | ||
) | ||
|
||
requestCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: "status", | ||
Name: "requests", | ||
Help: "Resource requests", | ||
}, | ||
[]string{"resource"}, | ||
) | ||
|
||
apiCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: "status", | ||
Name: "apirequests", | ||
Help: "Requests to external APIs", | ||
}, | ||
[]string{"call"}, | ||
) | ||
|
||
// Latency on Get (source of skin) :tick: | ||
// Total latency for HTTP request (response code) :tick: | ||
// Latency on cache (has, puul or add) :tick: | ||
// Gauge for cache hit, miss :tick: | ||
// Gauge for request (type) :tick: | ||
// Latency for processing (type) :tick: | ||
) | ||
|
||
func init() { | ||
prometheus.MustRegister(inFlightGauge) | ||
prometheus.MustRegister(requestDuration) | ||
prometheus.MustRegister(responseSize) | ||
prometheus.MustRegister(processingDuration) | ||
prometheus.MustRegister(getDuration) | ||
prometheus.MustRegister(cacheDuration) | ||
prometheus.MustRegister(errorCounter) | ||
prometheus.MustRegister(cacheCounter) | ||
prometheus.MustRegister(requestCounter) | ||
prometheus.MustRegister(apiCounter) | ||
} |
Oops, something went wrong.