mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 21:18:11 -04:00
perf(metrics): ask Sentinel to bucket metric history rows
Send bucket_ms on the Sentinel metric history reads so Sentinel averages the rows and sends far fewer of them over SSH. Older Sentinels ignore the param and return raw rows, which Coolify still buckets and downsamples. Also quote the history URL in the single-fetch curl command, because the URL now has an & in it.
This commit is contained in:
committed by
Andras Bacsai
parent
1d286427ad
commit
5312ea4dbc
@@ -68,6 +68,21 @@ it('falls back to one fetch per metric when the batch fails', function () {
|
||||
->and($commands)->toHaveCount(2);
|
||||
});
|
||||
|
||||
it('quotes the bucketed history URL in a single fetch for a non-root user', function () {
|
||||
$commands = [];
|
||||
Process::fake(function (PendingProcess $process) use (&$commands) {
|
||||
$commands[] = $process->command;
|
||||
|
||||
return Process::result('[{"time":60000,"percent":5}]');
|
||||
});
|
||||
$this->server->forceFill(['user' => 'deploy'])->saveQuietly();
|
||||
|
||||
expect($this->server->getCpuMetrics(720))->toBe([[60000, 5.0]])
|
||||
->and($commands)->toHaveCount(1)
|
||||
->and($commands[0])->toContain('sudo bash -c')
|
||||
->and($commands[0])->toMatch('/"http:\/\/localhost:8888\/api\/cpu\/history\?from=[^"]+&bucket_ms=60000"/');
|
||||
});
|
||||
|
||||
it('runs the batched metrics script with sudo for a non-root user', function () {
|
||||
$commands = [];
|
||||
Process::fake(function (PendingProcess $process) use (&$commands) {
|
||||
|
||||
Reference in New Issue
Block a user