<commit_before><?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller as BaseController;
use App\Stat;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use DB;

class HealthController extends BaseController
{
    public function main()
    {
        $data = Stat::selectRaw('round(avg(execution_time), 5) as execution_time, count(*) as requests, UNIX_TIMESTAMP(created_at) as date')
                    ->whereDate('created_at', '>=', Carbon::now()->subDay())
                    ->groupBy(DB::raw('UNIX_TIMESTAMP(created_at) div 60'))
                    ->orderBy('created_at', 'asc')
                    ->get();
        return response()->json($data);
    }

    public function endpoints()
    {
        $data = Stat::selectRaw('count(*) as requests, routes.route')
                    ->whereDate('stats.created_at', '>=', Carbon::now()->subDay())
                    ->join('routes', 'routes.id', '=', 'stats.route_id')
                    ->groupBy('route_id')<commit_msg>api health 10 minutes points<commit_after><?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller as BaseController;
use App\Stat;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use DB;

class HealthController extends BaseController
{
    public function main()
    {
        $data = Stat::selectRaw('round(avg(execution_time), 5) as execution_time, count(*) as requests, UNIX_TIMESTAMP(created_at) as date')
                    ->whereDate('created_at', '>=', Carbon::now()->subDay())
                    ->groupBy(DB::raw('UNIX_TIMESTAMP(created_at) div 600'))
                    ->orderBy('created_at', 'asc')
                    ->get();
        return response()->json($data);
    }

    public function endpoints()
    {
        $data = Stat::selectRaw('count(*) as requests, routes.route')
                    ->whereDate('stats.created_at', '>=', Carbon::now()->subDay())
                    ->join('routes', 'routes.id', '=', 'stats.route_id')
                    ->groupBy('route_id')
{'fraction_non_alphanumeric': 0.15678776290630975, 'fraction_numerical': 0.004302103250478011, 'mean_word_length': 2.691358024691358, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3857331', 'n_tokens_mistral': 622, 'n_tokens_neox': 604, 'n_words': 121}