mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
only support latest and remove ring buffer
This commit is contained in:
@@ -341,7 +341,6 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
||||
|
||||
conf.ConsulConfig = a.config.Consul
|
||||
|
||||
conf.StatsDataPoints = a.config.Client.StatsConfig.DataPoints
|
||||
conf.StatsCollectionInterval = a.config.Client.StatsConfig.collectionInterval
|
||||
|
||||
return conf, nil
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
@@ -75,19 +73,13 @@ func (s *HTTPServer) ClientAllocRequest(resp http.ResponseWriter, req *http.Requ
|
||||
}
|
||||
allocID := tokens[0]
|
||||
|
||||
// Get the stats reporter
|
||||
clientStats := s.agent.client.StatsReporter()
|
||||
task := req.URL.Query().Get("task")
|
||||
var since int
|
||||
var err error
|
||||
if sinceTime := req.URL.Query().Get("since"); sinceTime != "" {
|
||||
since, err = strconv.Atoi(sinceTime)
|
||||
if err != nil {
|
||||
return nil, CodedError(400, fmt.Sprintf("can't read the since query parameter: %v", err))
|
||||
}
|
||||
aStats, err := clientStats.GetAllocStats(allocID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if since > 0 {
|
||||
return clientStats.AllocStatsSince(allocID, task, int64(since))
|
||||
}
|
||||
return clientStats.LatestAllocStats(allocID, task)
|
||||
task := req.URL.Query().Get("task")
|
||||
return aStats.LatestAllocStats(task)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/nomad/client/stats"
|
||||
)
|
||||
import "net/http"
|
||||
|
||||
const (
|
||||
invalidSinceErrPrefix = "can't read the since query parameter"
|
||||
@@ -17,20 +11,6 @@ func (s *HTTPServer) ClientStatsRequest(resp http.ResponseWriter, req *http.Requ
|
||||
return nil, clientNotRunning
|
||||
}
|
||||
|
||||
var since int
|
||||
var err error
|
||||
ts := false
|
||||
if sinceTime := req.URL.Query().Get("since"); sinceTime != "" {
|
||||
ts = true
|
||||
since, err = strconv.Atoi(sinceTime)
|
||||
if err != nil {
|
||||
return nil, CodedError(400, fmt.Sprintf("%s: %v", invalidSinceErrPrefix, err))
|
||||
}
|
||||
}
|
||||
|
||||
clientStats := s.agent.client.StatsReporter()
|
||||
if ts {
|
||||
return clientStats.HostStatsSince(int64(since)), nil
|
||||
}
|
||||
return []*stats.HostStats{clientStats.LatestHostStats()}, nil
|
||||
return clientStats.LatestHostStats(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user