tipo: modificación del cpanel y gitignore de la carpeta vendor

This commit is contained in:
2026-07-07 11:35:09 -06:00
parent a0c91dc567
commit 676ef0d506
8510 changed files with 1132803 additions and 4 deletions
@@ -0,0 +1,52 @@
<?php
namespace Laravel\Reverb\Pulse\Livewire\Concerns;
use Carbon\CarbonInterval;
trait HasRate
{
/**
* The message send rate.
*/
protected function rate(?float $count): ?float
{
return $count ? round($count * $this->rateMultiplier(), 2) : null;
}
/**
* The rate multiplier.
*/
protected function rateMultiplier(): float
{
return with(match ($this->period) {
'6_hours' => CarbonInterval::minute(),
'24_hours' => CarbonInterval::hour(),
'7_days' => CarbonInterval::day(),
default => CarbonInterval::second(),
}, fn ($period) => $period->totalSeconds > $this->secondsPerBucket()
? $this->secondsPerBucket() / $period->totalSeconds
: $period->totalSeconds / $this->secondsPerBucket());
}
/**
* The seconds per bucket.
*/
protected function secondsPerBucket(): float
{
return $this->periodAsInterval()->totalSeconds / $maxDataPoints = 60;
}
/**
* The rate unit.
*/
protected function rateUnit(): string
{
return match ($this->period) {
'6_hours' => 'minute',
'24_hours' => 'hour',
'7_days' => 'day',
default => 'second',
};
}
}
@@ -0,0 +1,67 @@
<?php
namespace Laravel\Reverb\Pulse\Livewire;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\View;
use Illuminate\Support\HtmlString;
use Laravel\Pulse\Livewire\Card;
use Laravel\Pulse\Livewire\Concerns\HasPeriod;
use Laravel\Pulse\Livewire\Concerns\RemembersQueries;
use Laravel\Reverb\Pulse\Recorders\ReverbConnections;
use Livewire\Attributes\Lazy;
class Connections extends Card
{
use HasPeriod, RemembersQueries;
/**
* The graph colors.
*/
public array $colors = [
'avg' => '#10b981',
'max' => '#9333ea',
];
/**
* Render the component.
*/
#[Lazy]
public function render()
{
[$connections, $time, $runAt] = $this->remember(function () {
return with($this->graph(['reverb_connections'], 'max'), function ($max) {
return $this->graph(['reverb_connections'], 'avg')->map(fn ($readings, $app) => collect([
'reverb_connections:avg' => $readings['reverb_connections'],
'reverb_connections:max' => $max[$app]['reverb_connections'],
]));
});
});
if (Request::hasHeader('X-Livewire')) {
$this->dispatch('reverb-connections-chart-update', connections: $connections);
}
return View::make('reverb::livewire.connections', [
'connections' => $connections,
'time' => $time,
'runAt' => $runAt,
'config' => Config::get('pulse.recorders.'.ReverbConnections::class),
]);
}
/**
* Define any CSS that should be loaded for the component.
*
* @return string|\Illuminate\Contracts\Support\Htmlable|array<int, string|\Illuminate\Contracts\Support\Htmlable>|null
*/
protected function css(): HtmlString
{
return new HtmlString(
'<style>'.
collect($this->colors)->map(fn ($color) => '.bg-\\[\\'.$color.'\\]{background-color:'.$color.'}')->join('').
'</style>'
);
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
namespace Laravel\Reverb\Pulse\Livewire;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\View;
use Illuminate\Support\HtmlString;
use Laravel\Pulse\Livewire\Card;
use Laravel\Pulse\Livewire\Concerns\HasPeriod;
use Laravel\Pulse\Livewire\Concerns\RemembersQueries;
use Laravel\Reverb\Pulse\Recorders\ReverbMessages;
use Livewire\Attributes\Lazy;
class Messages extends Card
{
use Concerns\HasRate,
HasPeriod,
RemembersQueries;
/**
* The graph colors.
*/
public array $colors = [
'received' => '#10b981',
'received:per_rate' => '#78d7b3',
'sent' => '#9333ea',
'sent:per_rate' => '#bc81f1',
];
/**
* Render the component.
*/
#[Lazy]
public function render()
{
[$all, $time, $runAt] = $this->remember(fn () => [
$readings = $this->graph(['reverb_message:sent', 'reverb_message:received'], 'count'),
$readings->map->map(fn ($values) => $values->map($this->rate(...))),
]);
[$messages, $messagesRate] = $all;
if (Request::hasHeader('X-Livewire')) {
$this->dispatch('reverb-messages-chart-update', messages: $messages, messagesRate: $messagesRate);
}
return View::make('reverb::livewire.messages', [
'messages' => $messages,
'messagesRate' => $messagesRate,
'time' => $time,
'runAt' => $runAt,
'config' => Config::get('pulse.recorders.'.ReverbMessages::class),
]);
}
/**
* Define any CSS that should be loaded for the component.
*
* @return string|\Illuminate\Contracts\Support\Htmlable|array<int, string|\Illuminate\Contracts\Support\Htmlable>|null
*/
protected function css(): HtmlString
{
return new HtmlString(
'<style>'.
collect($this->colors)->map(fn ($color) => '.bg-\\[\\'.$color.'\\]{background-color:'.$color.'}')->join('').
'</style>'
);
}
}
@@ -0,0 +1,58 @@
<?php
namespace Laravel\Reverb\Pulse\Recorders;
use Illuminate\Broadcasting\BroadcastManager;
use Illuminate\Contracts\Foundation\Application as Container;
use Laravel\Pulse\Events\IsolatedBeat;
use Laravel\Pulse\Pulse;
use Laravel\Pulse\Recorders\Concerns\Sampling;
use Laravel\Reverb\Application;
use Laravel\Reverb\Contracts\ApplicationProvider;
class ReverbConnections
{
use Sampling;
/**
* The events to listen for.
*
* @var class-string
*/
public string $listen = IsolatedBeat::class;
/**
* Create a new recorder instance.
*/
public function __construct(
protected Pulse $pulse,
protected BroadcastManager $broadcast,
protected Container $app,
) {
//
}
/**
* Record the connection count.
*/
public function record(IsolatedBeat $event): void
{
if ($event->time->second % 15 !== 0) {
return;
}
$this->app->make(ApplicationProvider::class)->all()
->each(function (Application $app) use ($event) {
$connections = $this->broadcast->pusher($app->toArray())
->get('/connections')
->connections;
$this->pulse->record(
type: 'reverb_connections',
key: $app->id(),
value: $connections,
timestamp: $event->time->getTimestamp(),
)->avg()->max()->onlyBuckets();
});
}
}
@@ -0,0 +1,54 @@
<?php
namespace Laravel\Reverb\Pulse\Recorders;
use Carbon\CarbonImmutable;
use Illuminate\Config\Repository;
use Laravel\Pulse\Pulse;
use Laravel\Pulse\Recorders\Concerns\Sampling;
use Laravel\Reverb\Events\MessageReceived;
use Laravel\Reverb\Events\MessageSent;
class ReverbMessages
{
use Sampling;
/**
* The events to listen for.
*
* @var list<class-string>
*/
public array $listen = [
MessageSent::class,
MessageReceived::class,
];
/**
* Create a new recorder instance.
*/
public function __construct(
protected Pulse $pulse,
protected Repository $config
) {
//
}
/**
* Record the message.
*/
public function record(MessageSent|MessageReceived $event): void
{
if (! $this->shouldSample()) {
return;
}
$this->pulse->record(
type: 'reverb_message:'.match ($event::class) {
MessageSent::class => 'sent',
MessageReceived::class => 'received',
},
key: $event->connection->app()->id(),
timestamp: CarbonImmutable::now()->getTimestamp(),
)->onlyBuckets()->count();
}
}