mirror of
https://github.com/woodchen-ink/random-api-go.git
synced 2025-07-18 05:42:01 +08:00
15 lines
278 B
Go
15 lines
278 B
Go
package handler
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"random-api-go/monitoring"
|
|
)
|
|
|
|
func HandleMetrics(w http.ResponseWriter, r *http.Request) {
|
|
metrics := monitoring.CollectMetrics()
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(metrics)
|
|
}
|