Fix imported package names to not use mixedCaps or under_scores
This commit is contained in:
parent
75401d790c
commit
ce001dcd4e
@ -30,7 +30,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/events"
|
||||
httpMux "github.com/google/cadvisor/http/mux"
|
||||
httpmux "github.com/google/cadvisor/http/mux"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager"
|
||||
)
|
||||
@ -39,7 +39,7 @@ const (
|
||||
apiResource = "/api/"
|
||||
)
|
||||
|
||||
func RegisterHandlers(mux httpMux.Mux, m manager.Manager) error {
|
||||
func RegisterHandlers(mux httpmux.Mux, m manager.Manager) error {
|
||||
apiVersions := getApiVersions()
|
||||
supportedApiVersions := make(map[string]ApiVersion, len(apiVersions))
|
||||
for _, v := range apiVersions {
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
cadvisorHttp "github.com/google/cadvisor/http"
|
||||
cadvisorhttp "github.com/google/cadvisor/http"
|
||||
"github.com/google/cadvisor/manager"
|
||||
"github.com/google/cadvisor/utils/sysfs"
|
||||
"github.com/google/cadvisor/version"
|
||||
@ -78,12 +78,12 @@ func main() {
|
||||
mux := http.DefaultServeMux
|
||||
|
||||
// Register all HTTP handlers.
|
||||
err = cadvisorHttp.RegisterHandlers(mux, containerManager, *httpAuthFile, *httpAuthRealm, *httpDigestFile, *httpDigestRealm)
|
||||
err = cadvisorhttp.RegisterHandlers(mux, containerManager, *httpAuthFile, *httpAuthRealm, *httpDigestFile, *httpDigestRealm)
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to register HTTP handlers: %v", err)
|
||||
}
|
||||
|
||||
cadvisorHttp.RegisterPrometheusHandler(mux, containerManager, *prometheusEndpoint, nil)
|
||||
cadvisorhttp.RegisterPrometheusHandler(mux, containerManager, *prometheusEndpoint, nil)
|
||||
|
||||
// Start the manager.
|
||||
if err := containerManager.Start(); err != nil {
|
||||
|
@ -23,11 +23,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/libcontainer/cgroups"
|
||||
cgroup_fs "github.com/docker/libcontainer/cgroups/fs"
|
||||
libcontainerConfigs "github.com/docker/libcontainer/configs"
|
||||
cgroupfs "github.com/docker/libcontainer/cgroups/fs"
|
||||
libcontainerconfigs "github.com/docker/libcontainer/configs"
|
||||
docker "github.com/fsouza/go-dockerclient"
|
||||
"github.com/google/cadvisor/container"
|
||||
containerLibcontainer "github.com/google/cadvisor/container/libcontainer"
|
||||
containerlibcontainer "github.com/google/cadvisor/container/libcontainer"
|
||||
"github.com/google/cadvisor/fs"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/utils"
|
||||
@ -94,7 +94,7 @@ func newDockerContainerHandler(
|
||||
machineInfoFactory info.MachineInfoFactory,
|
||||
fsInfo fs.FsInfo,
|
||||
storageDriver storageDriver,
|
||||
cgroupSubsystems *containerLibcontainer.CgroupSubsystems,
|
||||
cgroupSubsystems *containerlibcontainer.CgroupSubsystems,
|
||||
inHostNamespace bool,
|
||||
) (container.ContainerHandler, error) {
|
||||
// Create the cgroup paths.
|
||||
@ -104,8 +104,8 @@ func newDockerContainerHandler(
|
||||
}
|
||||
|
||||
// Generate the equivalent cgroup manager for this container.
|
||||
cgroupManager := &cgroup_fs.Manager{
|
||||
Cgroups: &libcontainerConfigs.Cgroup{
|
||||
cgroupManager := &cgroupfs.Manager{
|
||||
Cgroups: &libcontainerconfigs.Cgroup{
|
||||
Name: name,
|
||||
},
|
||||
Paths: cgroupPaths,
|
||||
@ -164,15 +164,15 @@ func (self *dockerContainerHandler) ContainerReference() (info.ContainerReferenc
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (self *dockerContainerHandler) readLibcontainerConfig() (*libcontainerConfigs.Config, error) {
|
||||
config, err := containerLibcontainer.ReadConfig(*dockerRootDir, *dockerRunDir, self.id)
|
||||
func (self *dockerContainerHandler) readLibcontainerConfig() (*libcontainerconfigs.Config, error) {
|
||||
config, err := containerlibcontainer.ReadConfig(*dockerRootDir, *dockerRunDir, self.id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read libcontainer config: %v", err)
|
||||
}
|
||||
|
||||
// Replace cgroup parent and name with our own since we may be running in a different context.
|
||||
if config.Cgroups == nil {
|
||||
config.Cgroups = new(libcontainerConfigs.Cgroup)
|
||||
config.Cgroups = new(libcontainerconfigs.Cgroup)
|
||||
}
|
||||
config.Cgroups.Name = self.name
|
||||
config.Cgroups.Parent = "/"
|
||||
@ -180,7 +180,7 @@ func (self *dockerContainerHandler) readLibcontainerConfig() (*libcontainerConfi
|
||||
return config, nil
|
||||
}
|
||||
|
||||
func libcontainerConfigToContainerSpec(config *libcontainerConfigs.Config, mi *info.MachineInfo) info.ContainerSpec {
|
||||
func libcontainerConfigToContainerSpec(config *libcontainerconfigs.Config, mi *info.MachineInfo) info.ContainerSpec {
|
||||
var spec info.ContainerSpec
|
||||
spec.HasMemory = true
|
||||
spec.Memory.Limit = math.MaxUint64
|
||||
@ -274,7 +274,7 @@ func (self *dockerContainerHandler) getFsStats(stats *info.ContainerStats) error
|
||||
|
||||
// TODO(vmarmol): Get from libcontainer API instead of cgroup manager when we don't have to support older Dockers.
|
||||
func (self *dockerContainerHandler) GetStats() (*info.ContainerStats, error) {
|
||||
stats, err := containerLibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid)
|
||||
stats, err := containerlibcontainer.GetStats(self.cgroupManager, self.rootFs, self.pid)
|
||||
if err != nil {
|
||||
return stats, err
|
||||
}
|
||||
@ -318,7 +318,7 @@ func (self *dockerContainerHandler) GetContainerLabels() map[string]string {
|
||||
}
|
||||
|
||||
func (self *dockerContainerHandler) ListProcesses(listType container.ListType) ([]int, error) {
|
||||
return containerLibcontainer.GetProcesses(self.cgroupManager)
|
||||
return containerlibcontainer.GetProcesses(self.cgroupManager)
|
||||
}
|
||||
|
||||
func (self *dockerContainerHandler) WatchSubcontainers(events chan container.SubcontainerEvent) error {
|
||||
@ -331,7 +331,7 @@ func (self *dockerContainerHandler) StopWatchingSubcontainers() error {
|
||||
}
|
||||
|
||||
func (self *dockerContainerHandler) Exists() bool {
|
||||
return containerLibcontainer.Exists(*dockerRootDir, *dockerRunDir, self.id)
|
||||
return containerlibcontainer.Exists(*dockerRootDir, *dockerRunDir, self.id)
|
||||
}
|
||||
|
||||
func DockerInfo() (map[string]string, error) {
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/libcontainer/cgroups"
|
||||
cgroup_fs "github.com/docker/libcontainer/cgroups/fs"
|
||||
cgroupfs "github.com/docker/libcontainer/cgroups/fs"
|
||||
"github.com/docker/libcontainer/configs"
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/container"
|
||||
@ -78,7 +78,7 @@ func newRawContainerHandler(name string, cgroupSubsystems *libcontainer.CgroupSu
|
||||
}
|
||||
|
||||
// Generate the equivalent cgroup manager for this container.
|
||||
cgroupManager := &cgroup_fs.Manager{
|
||||
cgroupManager := &cgroupfs.Manager{
|
||||
Cgroups: &configs.Cgroup{
|
||||
Name: name,
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ package healthz
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
httpMux "github.com/google/cadvisor/http/mux"
|
||||
httpmux "github.com/google/cadvisor/http/mux"
|
||||
)
|
||||
|
||||
func handleHealthz(w http.ResponseWriter, r *http.Request) {
|
||||
@ -26,7 +26,7 @@ func handleHealthz(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Register simple HTTP /healthz handler to return "ok".
|
||||
func RegisterHandler(mux httpMux.Mux) error {
|
||||
func RegisterHandler(mux httpmux.Mux) error {
|
||||
mux.HandleFunc("/healthz", handleHealthz)
|
||||
return nil
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/api"
|
||||
"github.com/google/cadvisor/healthz"
|
||||
httpMux "github.com/google/cadvisor/http/mux"
|
||||
httpmux "github.com/google/cadvisor/http/mux"
|
||||
"github.com/google/cadvisor/manager"
|
||||
"github.com/google/cadvisor/metrics"
|
||||
"github.com/google/cadvisor/pages"
|
||||
@ -31,7 +31,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func RegisterHandlers(mux httpMux.Mux, containerManager manager.Manager, httpAuthFile, httpAuthRealm, httpDigestFile, httpDigestRealm string) error {
|
||||
func RegisterHandlers(mux httpmux.Mux, containerManager manager.Manager, httpAuthFile, httpAuthRealm, httpDigestFile, httpDigestRealm string) error {
|
||||
// Basic health handler.
|
||||
if err := healthz.RegisterHandler(mux); err != nil {
|
||||
return fmt.Errorf("failed to register healthz handler: %s", err)
|
||||
@ -88,7 +88,7 @@ func RegisterHandlers(mux httpMux.Mux, containerManager manager.Manager, httpAut
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterPrometheusHandler(mux httpMux.Mux, containerManager manager.Manager, prometheusEndpoint string, containerNameToLabelsFunc metrics.ContainerNameToLabelsFunc) {
|
||||
func RegisterPrometheusHandler(mux httpmux.Mux, containerManager manager.Manager, prometheusEndpoint string, containerNameToLabelsFunc metrics.ContainerNameToLabelsFunc) {
|
||||
collector := metrics.NewPrometheusCollector(containerManager, containerNameToLabelsFunc)
|
||||
prometheus.MustRegister(collector)
|
||||
mux.Handle(prometheusEndpoint, prometheus.Handler())
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
|
||||
auth "github.com/abbot/go-http-auth"
|
||||
"github.com/golang/glog"
|
||||
httpMux "github.com/google/cadvisor/http/mux"
|
||||
httpmux "github.com/google/cadvisor/http/mux"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
"github.com/google/cadvisor/manager"
|
||||
)
|
||||
@ -109,7 +109,7 @@ func dockerHandler(containerManager manager.Manager) auth.AuthenticatedHandlerFu
|
||||
}
|
||||
|
||||
// Register http handlers
|
||||
func RegisterHandlersDigest(mux httpMux.Mux, containerManager manager.Manager, authenticator *auth.DigestAuth) error {
|
||||
func RegisterHandlersDigest(mux httpmux.Mux, containerManager manager.Manager, authenticator *auth.DigestAuth) error {
|
||||
// Register the handler for the containers page.
|
||||
if authenticator != nil {
|
||||
mux.HandleFunc(ContainersPage, authenticator.Wrap(containerHandler(containerManager)))
|
||||
@ -121,7 +121,7 @@ func RegisterHandlersDigest(mux httpMux.Mux, containerManager manager.Manager, a
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterHandlersBasic(mux httpMux.Mux, containerManager manager.Manager, authenticator *auth.BasicAuth) error {
|
||||
func RegisterHandlersBasic(mux httpmux.Mux, containerManager manager.Manager, authenticator *auth.BasicAuth) error {
|
||||
// Register the handler for the containers and docker age.
|
||||
if authenticator != nil {
|
||||
mux.HandleFunc(ContainersPage, authenticator.Wrap(containerHandler(containerManager)))
|
||||
|
Loading…
Reference in New Issue
Block a user