Skip to main content

FleetAMP Program Structure

This document explains how the FleetAMP repository is organized and how the main source files participate in the control-plane runtime.

Runtime flow​

FleetAMP runtime flow from Collector or Supervisor connection to domain services, storage, API and UI

FleetAMP is the management/control plane. Telemetry continues to flow from applications through OpenTelemetry Collectors to observability backends independently of FleetAMP.

Repository structure​

FleetAMP/
├── cmd/fleetamp/ # Executable, REST API, web UI and runtime orchestration
├── internal/agents/ # Protocol-neutral managed-agent domain
├── internal/configs/ # Configuration, deployment, drift and rollback domain
├── internal/events/ # Agent lifecycle event model
├── internal/groups/ # Controlled group identity and dynamic membership
├── internal/management/ # Protocol-neutral management adapter contract
├── internal/opamp/ # OpenTelemetry OpAMP adapter/server
├── internal/providers/ # Future external config/enrichment provider contracts
├── internal/storage/ # Persistence interfaces and implementations
│ ├── file/ # JSONL event persistence
│ ├── memory/ # In-memory stores, mainly runtime/tests
│ └── sqlite/ # Default persistent configuration/group database
├── deploy/ # Runtime deployment and lab assets
├── scripts/ # Installation and upgrade automation
├── go.mod # Go module and direct dependency declarations
├── go.sum # Locked Go dependency checksums
└── README.md # Project overview and documentation links

cmd/fleetamp — application runtime​

FileResponsibility
main.goFleetAMP executable entry point. Opens stores, starts OpAMP and HTTP servers, wires configuration delivery/status handling, REST routes and the main Managed Agents UI.
groups.goGroup and label REST/UI handlers. Implements group CRUD, generated names, enable/disable, agent assignment, membership checks and protected deletion.
lifecycle.goAgent lifecycle transitions, retirement loop, snapshot persistence, Active/Offline/Retired filtering, last-connected group summary, and guarded managed-metadata reassociation through fleetamp.agent.id.
deployment_summary_test.goTests the operational deployment summary shown for managed agents.

internal/agents — managed-agent domain​

FileResponsibility
collector.goDefines ManagedAgent, agent/runtime types, lifecycle status, deployment context, attributes, controlled group fields, labels and capabilities. Collector remains a compatibility alias.
registry.goLightweight concurrency-safe in-memory registry retained for compatibility/simple inventory helpers.
server.goReserved extension point for future protocol-independent agent server behavior.
doc.goPackage-level documentation.

internal/configs — desired configuration lifecycle​

FileResponsibility
configuration.goImmutable versioned configuration artifact with content hash and deterministic identity.
assignment.goCurrent desired configuration relationship between an agent and configuration artifact.
deployment.goAppend-only audit model for deploy and rollback attempts and their timestamps/status.
status.goProtocol-neutral remote-configuration status reported back by a management adapter.
validation.goYAML validation and optional distribution-aware otelcol-contrib validate execution.
drift.goSemantic subset comparison between desired and reported effective Collector configuration.
rollback.goSafety validation ensuring rollback uses an older artifact from the same configuration lineage.
metadata.goMerges fleetamp.group.* and fleetamp.label.* metadata into service.telemetry.resource without replacing unrelated Collector configuration.
*_test.goUnit tests for validation, drift and rollback behavior.
doc.goPackage-level documentation.

Groups, events and management adapters​

FileResponsibility
internal/groups/group.goGroup model, enabled state, effective controlled identity, optional labels and exact dynamic membership matching.
internal/groups/group_test.goTests managed/reported identity precedence, label separation and disabled groups.
internal/events/event.goAppend-only connected/disconnected/retired/health-change event model.
internal/management/adapter.goVendor/protocol-neutral contract FleetAMP core uses to observe agents and deliver remote configuration.
internal/opamp/server.goOpAMP WebSocket server/adapter. Converts AgentDescription into ManagedAgent state, parses FleetAMP metadata, caches effective config and sends remote config.
internal/opamp/doc.goOpAMP package documentation.

internal/storage — persistence boundary​

The files directly under internal/storage define interfaces. Business logic should depend on these contracts rather than directly on SQLite.

FileResponsibility
agent_store.goCurrent ManagedAgent state contract.
config_store.goImmutable configuration artifact contract.
assignment_store.goDesired assignment and delivery-status contract.
deployment_store.goAppend-only deployment history contract.
event_store.goAgent lifecycle history contract.
group_store.goControlled group persistence contract.
file/event_store.goJSONL lifecycle-event persistence (agent-events.jsonl).
memory/*.goIn-memory implementations used by current runtime components and tests.
sqlite/database.goOpens FleetAMP SQLite, configures pragmas, initializes/migrates schema and exposes stores.
sqlite/config_store.goSQLite configuration artifact persistence.
sqlite/assignment_store.goSQLite assignment persistence.
sqlite/deployment_store.goSQLite deployment history persistence.
sqlite/group_store.goSQLite group selector and enabled-state persistence.
*_test.goStore/schema persistence tests.

internal/providers — external integrations​

config.go defines a vendor-neutral interface for future configuration sources such as GitHub or Azure DevOps. enrichment.go defines a separate metadata-enrichment boundary for future inventory/CMDB integrations. Keeping these interfaces separate prevents external products from becoming part of the FleetAMP core domain.

Runtime persistence​

By default FleetAMP uses ./data relative to its working directory. Production can set FLEETAMP_DATA_DIR and FLEETAMP_DATABASE_PATH.

data/
├── fleetamp.db # SQLite configurations, assignments, deployments and groups
├── fleetamp.db-wal # SQLite WAL runtime file
├── fleetamp.db-shm # SQLite shared-memory runtime file
├── agents.json # Current agent snapshot for restart recovery
└── agent-events.jsonl # Append-only agent lifecycle history

These runtime files are operational state and are not source code that should normally be committed to Git.