Retrieve metrics from the past 2 hours for badges with a duration of 1h
This commit is contained in:
		| @ -34,7 +34,7 @@ func UptimeBadge(writer http.ResponseWriter, request *http.Request) { | |||||||
| 	case "24h": | 	case "24h": | ||||||
| 		from = time.Now().Add(-24 * time.Hour) | 		from = time.Now().Add(-24 * time.Hour) | ||||||
| 	case "1h": | 	case "1h": | ||||||
| 		from = time.Now().Add(-time.Hour) | 		from = time.Now().Add(-2 * time.Hour) // Because uptime metrics are stored by hour, we have to cheat a little | ||||||
| 	default: | 	default: | ||||||
| 		http.Error(writer, "Durations supported: 7d, 24h, 1h", http.StatusBadRequest) | 		http.Error(writer, "Durations supported: 7d, 24h, 1h", http.StatusBadRequest) | ||||||
| 		return | 		return | ||||||
| @ -73,7 +73,7 @@ func ResponseTimeBadge(writer http.ResponseWriter, request *http.Request) { | |||||||
| 	case "24h": | 	case "24h": | ||||||
| 		from = time.Now().Add(-24 * time.Hour) | 		from = time.Now().Add(-24 * time.Hour) | ||||||
| 	case "1h": | 	case "1h": | ||||||
| 		from = time.Now().Add(-time.Hour) | 		from = time.Now().Add(-2 * time.Hour) // Because response time metrics are stored by hour, we have to cheat a little | ||||||
| 	default: | 	default: | ||||||
| 		http.Error(writer, "Durations supported: 7d, 24h, 1h", http.StatusBadRequest) | 		http.Error(writer, "Durations supported: 7d, 24h, 1h", http.StatusBadRequest) | ||||||
| 		return | 		return | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user