Function
howie
(w http.ResponseWriter, r *http.Request)
Source from the content-addressed store, hash-verified
| 45 | } |
| 46 | |
| 47 | func howie(w http.ResponseWriter, r *http.Request) { |
| 48 | httpRequestCount.WithLabelValues(r.URL.Path).Inc() |
| 49 | start := time.Now() |
| 50 | n := rand.Intn(100) |
| 51 | if n >= 90 { |
| 52 | orderNum.Dec() |
| 53 | time.Sleep(100 * time.Millisecond) |
| 54 | } else { |
| 55 | orderNum.Inc() |
| 56 | time.Sleep(50 * time.Millisecond) |
| 57 | } |
| 58 | |
| 59 | elapsed := (float64)(time.Since(start) / time.Millisecond) |
| 60 | httpRequestDuration.WithLabelValues(r.URL.Path).Observe(elapsed) |
| 61 | w.Write([]byte("ok")) |
| 62 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected