Skip to content

feature: enable windows agent#32

Merged
tschaefer merged 2 commits intomainfrom
tschaefer/feature/win-mac-agents
Feb 16, 2026
Merged

feature: enable windows agent#32
tschaefer merged 2 commits intomainfrom
tschaefer/feature/win-mac-agents

Conversation

@tschaefer
Copy link
Owner

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds explicit agent “node” (OS/platform) metadata to enable generating Windows-specific telemetry configuration, alongside updating the public API and proto build workflow.

Changes:

  • Add node to the Agent model/controller and expose it via gRPC/protobuf.
  • Extend Alloy config generation to support Windows node exporter and Windows Event Log sources.
  • Simplify make proto to run protoc directly.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/model/agent.go Persist node on agents (defaulting to unix at DB level).
internal/grpc/server.go Plumb node through Register/Get agent RPCs.
internal/controller/agent.go Extend controller Agent input with node.
internal/controller/agent_marshal.go Marshal/persist node; allow event log source scheme.
internal/controller/agent_config.go Generate Windows-specific Alloy config blocks (eventlog + windows exporter).
api/api.proto Add node to RegisterAgentRequest and GetAgentResponse messages.
api/api.pb.go Regenerated protobuf bindings reflecting the new fields.
Makefile Update proto target to run protoc without the prior wrapper check.
Comments suppressed due to low confidence (2)

internal/controller/agent_marshal.go:37

  • Node is persisted exactly as provided. Since callers in the codebase often construct controller.Agent{Hostname, LogSources} without setting Node, this will store an empty node value and later templates will not match either "unix" or "windows". Default Node to "unix" when empty and validate/normalize supported values before creating the model agent.
	agent := &model.Agent{
		Hostname:       data.Hostname,
		Node:           data.Node,
		LogSources:     effectiveLogSources,
		Metrics:        data.Metrics,
		MetricsTargets: effectiveMetricsTargets,
		Profiles:       data.Profiles,
		Labels:         data.Labels,
		ResourceId:     fmt.Sprintf("rid:finch:%s:agent:%s", c.config.Id(), uuid.New().String()),
	}

internal/controller/agent_marshal.go:75

  • event log sources are accepted solely based on URI scheme. This allows values like event:// or event: that parse successfully but provide no event log name, which later renders eventlog_name = "" and produces an invalid Alloy config. Require a non-empty event log name (e.g., uri.Host or uri.Opaque) when uri.Scheme == "event", and consider returning a validation error rather than silently skipping/accepting.
		uri, err := url.Parse(logSource)
		if err != nil {
			continue
		}
		if !slices.Contains([]string{"journal", "docker", "file", "event"}, uri.Scheme) {
			continue
		}

		effectiveLogSources = append(effectiveLogSources, uri.String())
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

internal/controller/agent_marshal.go:78

  • Consider adding validation to ensure log source types are compatible with the node type. For example, 'event' log sources should only be allowed for Windows nodes, while 'journal' and 'docker' sources are typically Unix-specific. Currently, the code accepts any combination, which could result in invalid Alloy configurations that fail at runtime on the agent. Adding this validation in marshalNewAgent would provide earlier feedback to API consumers.
func (c *Controller) __parseLogSources(data *Agent) ([]string, error) {
	if len(data.LogSources) == 0 {
		return nil, fmt.Errorf("at least one log source must be specified")
	}

	var effectiveLogSources []string
	for _, logSource := range data.LogSources {
		uri, err := url.Parse(logSource)
		if err != nil {
			continue
		}
		if !slices.Contains([]string{"journal", "docker", "file", "event"}, uri.Scheme) {
			continue
		}

		effectiveLogSources = append(effectiveLogSources, uri.String())

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tschaefer tschaefer force-pushed the tschaefer/feature/win-mac-agents branch from c5e59fa to 9247c4d Compare February 15, 2026 18:23
@tschaefer tschaefer merged commit 54318ef into main Feb 16, 2026
2 checks passed
@tschaefer tschaefer deleted the tschaefer/feature/win-mac-agents branch February 16, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant