File tree Expand file tree Collapse file tree 7 files changed +18
-15
lines changed Expand file tree Collapse file tree 7 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import (
19
19
"strings"
20
20
"time"
21
21
22
- "github.com/google/cadvisor/info/v2 "
22
+ "github.com/google/cadvisor/info/v1 "
23
23
)
24
24
25
25
type collectorManager struct {
@@ -48,12 +48,12 @@ func (cm *collectorManager) RegisterCollector(collector Collector) error {
48
48
return nil
49
49
}
50
50
51
- func (cm * collectorManager ) Collect () (time.Time , []v2 .Metric , error ) {
51
+ func (cm * collectorManager ) Collect () (time.Time , []v1 .Metric , error ) {
52
52
var errors []error
53
53
54
54
// Collect from all collectors that are ready.
55
55
var next time.Time
56
- var metrics []v2 .Metric
56
+ var metrics []v1 .Metric
57
57
for _ , c := range cm .collectors {
58
58
if c .nextCollectionTime .Before (time .Now ()) {
59
59
nextCollection , newMetrics , err := c .collector .Collect ()
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import (
18
18
"testing"
19
19
"time"
20
20
21
- "github.com/google/cadvisor/info/v2 "
21
+ "github.com/google/cadvisor/info/v1 "
22
22
"github.com/stretchr/testify/assert"
23
23
)
24
24
@@ -28,9 +28,9 @@ type fakeCollector struct {
28
28
collectedFrom int
29
29
}
30
30
31
- func (fc * fakeCollector ) Collect () (time.Time , []v2 .Metric , error ) {
31
+ func (fc * fakeCollector ) Collect () (time.Time , []v1 .Metric , error ) {
32
32
fc .collectedFrom ++
33
- return fc .nextCollectionTime , []v2 .Metric {}, fc .err
33
+ return fc .nextCollectionTime , []v1 .Metric {}, fc .err
34
34
}
35
35
36
36
func (fc * fakeCollector ) Name () string {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ package collector
17
17
import (
18
18
"time"
19
19
20
- "github.com/google/cadvisor/info/v2 "
20
+ "github.com/google/cadvisor/info/v1 "
21
21
)
22
22
23
23
type FakeCollectorManager struct {
@@ -27,7 +27,7 @@ func (fkm *FakeCollectorManager) RegisterCollector(collector Collector) error {
27
27
return nil
28
28
}
29
29
30
- func (fkm * FakeCollectorManager ) Collect () (time.Time , []v2 .Metric , error ) {
30
+ func (fkm * FakeCollectorManager ) Collect () (time.Time , []v1 .Metric , error ) {
31
31
var zero time.Time
32
- return zero , []v2 .Metric {}, nil
32
+ return zero , []v1 .Metric {}, nil
33
33
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import (
19
19
"io/ioutil"
20
20
"time"
21
21
22
- "github.com/google/cadvisor/info/v2 "
22
+ "github.com/google/cadvisor/info/v1 "
23
23
)
24
24
25
25
type GenericCollector struct {
@@ -56,7 +56,7 @@ func (collector *GenericCollector) Name() string {
56
56
}
57
57
58
58
//Returns collected metrics and the next collection time of the collector
59
- func (collector * GenericCollector ) Collect () (time.Time , []v2 .Metric , error ) {
59
+ func (collector * GenericCollector ) Collect () (time.Time , []v1 .Metric , error ) {
60
60
//TO BE IMPLEMENTED
61
61
return time .Now (), nil , nil
62
62
}
Original file line number Diff line number Diff line change 15
15
package collector
16
16
17
17
import (
18
- "github.com/google/cadvisor/info/v2 "
18
+ "github.com/google/cadvisor/info/v1 "
19
19
"time"
20
20
)
21
21
@@ -27,7 +27,7 @@ type Collector interface {
27
27
// Returns the next time this collector should be collected from.
28
28
// Next collection time is always returned, even when an error occurs.
29
29
// A collection time of zero means no more collection.
30
- Collect () (time.Time , []v2 .Metric , error )
30
+ Collect () (time.Time , []v1 .Metric , error )
31
31
32
32
// Name of this collector.
33
33
Name () string
@@ -42,5 +42,5 @@ type CollectorManager interface {
42
42
// at which a collector will be ready to collect from.
43
43
// Next collection time is always returned, even when an error occurs.
44
44
// A collection time of zero means no more collection.
45
- Collect () (time.Time , []v2 .Metric , error )
45
+ Collect () (time.Time , []v1 .Metric , error )
46
46
}
Original file line number Diff line number Diff line change @@ -419,6 +419,9 @@ type ContainerStats struct {
419
419
420
420
// Task load stats
421
421
TaskStats LoadStats `json:"task_stats,omitempty"`
422
+
423
+ //Custom metrics from all collectors
424
+ CustomMetrics []Metric `json:"custom_metrics,omitempty"`
422
425
}
423
426
424
427
func timeEq (t1 , t2 time.Time , tolerance time.Duration ) bool {
Original file line number Diff line number Diff line change 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- package v2
15
+ package v1
16
16
17
17
import (
18
18
"time"
You can’t perform that action at this time.
0 commit comments