From 466b91ecde6577daf7e2e4c5470954b445829865 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Mar 2026 15:49:09 +0000 Subject: [PATCH] difc/agent: add debug logging to bulk label operations Add logAgent debug logging calls to the AgentLabels and AgentRegistry functions that previously lacked them, making them consistent with the existing logging pattern in the file. Changes: - DropIntegrityTags: log count of tags being dropped - AddSecrecyTags: log count of tags being added - AddIntegrityTags: log count of tags being added - Clone: log when cloning agent labels - NewAgentRegistryWithDefaults: log registry creation with default counts - SetDefaultLabels: log new default label values These additions fill in missing debug context for bulk label operations and constructor helpers, enabling DEBUG=difc:agent tracing for label propagation and registry initialization flows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- internal/difc/agent.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/difc/agent.go b/internal/difc/agent.go index 1e177fdd..e380ceaa 100644 --- a/internal/difc/agent.go +++ b/internal/difc/agent.go @@ -79,6 +79,7 @@ func (a *AgentLabels) DropIntegrityTag(tag Tag) { // DropIntegrityTags removes multiple integrity tags from the agent func (a *AgentLabels) DropIntegrityTags(tags []Tag) { + logAgent.Printf("Agent %s dropping %d integrity tags", a.AgentID, len(tags)) a.mu.Lock() defer a.mu.Unlock() a.Integrity.Label.RemoveAll(tags) @@ -89,6 +90,7 @@ func (a *AgentLabels) DropIntegrityTags(tags []Tag) { // AddSecrecyTags adds multiple secrecy tags to the agent func (a *AgentLabels) AddSecrecyTags(tags []Tag) { + logAgent.Printf("Agent %s adding %d secrecy tags", a.AgentID, len(tags)) a.mu.Lock() defer a.mu.Unlock() a.Secrecy.Label.AddAll(tags) @@ -99,6 +101,7 @@ func (a *AgentLabels) AddSecrecyTags(tags []Tag) { // AddIntegrityTags adds multiple integrity tags to the agent func (a *AgentLabels) AddIntegrityTags(tags []Tag) { + logAgent.Printf("Agent %s adding %d integrity tags", a.AgentID, len(tags)) a.mu.Lock() defer a.mu.Unlock() a.Integrity.Label.AddAll(tags) @@ -169,6 +172,7 @@ func (a *AgentLabels) AccumulateFromRead(resource *LabeledResource) { // Clone creates a copy of the agent labels func (a *AgentLabels) Clone() *AgentLabels { + logAgent.Printf("Cloning agent labels: agentID=%s", a.AgentID) a.mu.RLock() defer a.mu.RUnlock() @@ -215,6 +219,7 @@ func NewAgentRegistry() *AgentRegistry { // NewAgentRegistryWithDefaults creates a registry with default labels for new agents func NewAgentRegistryWithDefaults(defaultSecrecy []Tag, defaultIntegrity []Tag) *AgentRegistry { + logAgent.Printf("Creating agent registry with defaults: secrecyTags=%d, integrityTags=%d", len(defaultSecrecy), len(defaultIntegrity)) return &AgentRegistry{ agents: make(map[string]*AgentLabels), defaultSecrecy: defaultSecrecy, @@ -309,6 +314,7 @@ func (r *AgentRegistry) GetAllAgentIDs() []string { // SetDefaultLabels sets the default labels for new agents func (r *AgentRegistry) SetDefaultLabels(secrecy []Tag, integrity []Tag) { + logAgent.Printf("Setting default labels: secrecyTags=%v, integrityTags=%v", secrecy, integrity) r.mu.Lock() defer r.mu.Unlock() r.defaultSecrecy = secrecy