<commit_before>package governor

import (
	"github.com/labstack/echo"
	"net/http"
	"strconv"
	"time"
)

type (
	errRes struct {
		Message string `json:"message"`
	}

	healthRes struct {
		Time int64    `json:"time"`
		Errs []errRes `json:"errs"`
	}
)

func (s *Server) initHealth(r *echo.Group) {
	r.GET("/check", func(c echo.Context) error {
		return c.String(http.StatusOK, strconv.FormatInt(time.Now().Unix(), 10))
	})

	r.GET("/report", func(c echo.Context) error {
		t := time.Now().Unix()
		if errs := s.checkHealthServices(); len(errs) > 0 {
			errReslist := []errRes{}
			for _, i := range errs {
				errReslist = append(errReslist, errRes{
					Message: i.Error(),
				})
			}
			return c.JSON(http.StatusServiceUnavailable, &healthRes{
				Time: t,
				Errs: errReslist,
			})
		}
		return c.JSON(http.StatusOK, &healthRes{
			Time: t,
			Errs: nil,
		})
	})
<commit_msg>Bugfix health check returned status<commit_after>package governor

import (
	"github.com/labstack/echo"
	"net/http"
	"strconv"
	"time"
)

type (
	errRes struct {
		Message string `json:"message"`
	}

	healthRes struct {
		Time int64    `json:"time"`
		Errs []errRes `json:"errs"`
	}
)

func (s *Server) initHealth(r *echo.Group) {
	r.GET("/check", func(c echo.Context) error {
		return c.String(http.StatusOK, strconv.FormatInt(time.Now().Unix(), 10))
	})

	r.GET("/report", func(c echo.Context) error {
		t := time.Now().Unix()
		if errs := s.checkHealthServices(); len(errs) > 0 {
			errReslist := []errRes{}
			for _, i := range errs {
				errReslist = append(errReslist, errRes{
					Message: i.Error(),
				})
			}
			return c.JSON(http.StatusInternalServerError, &healthRes{
				Time: t,
				Errs: errReslist,
			})
		}
		return c.JSON(http.StatusOK, &healthRes{
			Time: t,
			Errs: nil,
		})
	})

{'fraction_non_alphanumeric': 0.17030812324929973, 'fraction_numerical': 0.0056022408963585435, 'mean_word_length': 3.388206388206388, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6219566', 'n_tokens_mistral': 777, 'n_tokens_neox': 685, 'n_words': 144}