github.com/google/cadvisor@v0.49.1/stats/types.go (about)

     1  // Copyright 2020 Google Inc. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Handling statistics that are fully controlled in cAdvisor
    16  package stats
    17  
    18  import info "github.com/google/cadvisor/info/v1"
    19  
    20  // This is supposed to store global state about an cAdvisor metrics collector.
    21  // cAdvisor manager will call Destroy() when it stops.
    22  // For each container detected by the cAdvisor manager, it will call
    23  // GetCollector() with the devices cgroup path for that container.
    24  // GetCollector() is supposed to return an object that can update
    25  // external stats for that container.
    26  type Manager interface {
    27  	Destroy()
    28  	GetCollector(deviceCgroup string) (Collector, error)
    29  }
    30  
    31  // Collector can update ContainerStats by adding more metrics.
    32  type Collector interface {
    33  	Destroy()
    34  	UpdateStats(*info.ContainerStats) error
    35  }