mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-10 05:55:18 +00: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) {
|
func (db *DB) GetLastNContainerMetrics(containerName string, limit int) ([]ContainerMetric, error) {
|
||||||
name := strings.TrimPrefix(containerName, "/")
|
containerName = strings.TrimPrefix(containerName, "/")
|
||||||
parts := strings.Split(name, "-")
|
|
||||||
if len(parts) > 1 {
|
|
||||||
containerName = strings.Join(parts[:len(parts)-1], "-")
|
|
||||||
}
|
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
WITH recent_metrics AS (
|
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) {
|
func (db *DB) GetAllMetricsContainer(containerName string) ([]ContainerMetric, error) {
|
||||||
name := strings.TrimPrefix(containerName, "/")
|
containerName = strings.TrimPrefix(containerName, "/")
|
||||||
parts := strings.Split(name, "-")
|
|
||||||
if len(parts) > 1 {
|
|
||||||
containerName = strings.Join(parts[:len(parts)-1], "-")
|
|
||||||
}
|
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
WITH recent_metrics AS (
|
WITH recent_metrics AS (
|
||||||
|
|||||||
Reference in New Issue
Block a user