mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-24 01:24:26 +01:00
runtime: add new command to collect metrics from Kata containers
Add a new command to collect metrics and return metrics to Prometheus. Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
// Copyright (c) 2020 Ant Financial
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -29,14 +31,3 @@ func GzipAccepted(header http.Header) bool {
|
||||
func String2Pointer(s string) *string {
|
||||
return &s
|
||||
}
|
||||
|
||||
// EnsureFileDir will check if file a in an absolute format and ensure the directory is exits
|
||||
// if not, make the dir like `mkdir -p`
|
||||
func EnsureFileDir(file string) error {
|
||||
if !filepath.IsAbs(file) {
|
||||
return fmt.Errorf("file must be an absolute path")
|
||||
}
|
||||
|
||||
path := filepath.Dir(file)
|
||||
return os.MkdirAll(path, 0755)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user