mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
Merge pull request #3813 from Dokploy/3463-container-metrics-query-broken-after-like-change-in-3438
refactor: streamline container name processing in metric retrieval fu…
This commit is contained in:
@@ -48,11 +48,7 @@ func (db *DB) SaveContainerMetric(metric *ContainerMetric) error {
|
||||
}
|
||||
|
||||
func (db *DB) GetLastNContainerMetrics(containerName string, limit int) ([]ContainerMetric, error) {
|
||||
name := strings.TrimPrefix(containerName, "/")
|
||||
parts := strings.Split(name, "-")
|
||||
if len(parts) > 1 {
|
||||
containerName = strings.Join(parts[:len(parts)-1], "-")
|
||||
}
|
||||
containerName = strings.TrimPrefix(containerName, "/")
|
||||
|
||||
query := `
|
||||
WITH recent_metrics AS (
|
||||
@@ -88,11 +84,7 @@ func (db *DB) GetLastNContainerMetrics(containerName string, limit int) ([]Conta
|
||||
}
|
||||
|
||||
func (db *DB) GetAllMetricsContainer(containerName string) ([]ContainerMetric, error) {
|
||||
name := strings.TrimPrefix(containerName, "/")
|
||||
parts := strings.Split(name, "-")
|
||||
if len(parts) > 1 {
|
||||
containerName = strings.Join(parts[:len(parts)-1], "-")
|
||||
}
|
||||
containerName = strings.TrimPrefix(containerName, "/")
|
||||
|
||||
query := `
|
||||
WITH recent_metrics AS (
|
||||
|
||||
Reference in New Issue
Block a user