Skip to content

Reorganize cAdvisor package / directory hierarchy #1176

Open
@timstclair

Description

@timstclair

Problem: The cAdvisor directory / package organization is flat and lacks intuitive structure. This makes it hard for new developers to find and understand the relevant parts of the code, and it makes it difficult for users to separate code from utility and API.

Proposed changes:

  • Rename ‘info’ to ‘api’ - more intuitive, matches k8s structure
  • Group together server code under a single “server” parent package
    • Includes: api (current definition, not info), pages (UI), http, healthz, validate
    • Rename ‘pages’ to ‘ui’
  • Non-code - due to flat structure, tests, build and deploy all live on the same level. Would be nice to have a little more structure to separate
  • Clients - Tracked in Clean up go clients #1180
  • Organize cAdvisor root
    • Move *.go to ‘cmd’ or ‘main’ package
    • Add a ‘test’ directory, move ‘integration’ to ‘test/integration’, move ‘test.http*’ to ‘test/’
  • Rename ‘metrics’ to ‘prometheus’
  • Consider: move internal packages (manager, container, fs, collector, etc.) under a common root (e.g. ‘internal’, ‘lib’, or ‘pkg’) - this will make finding the integration points easier for new users

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions