Skip to content

Commit 3e53234

Browse files
authored
[log] Add debug logging to expandTracingVariables in config/expand.go (#5138)
## Summary Adds meaningful debug logging calls to the `expandTracingVariables` function in `internal/config/expand.go`. ## Changes The `expandTracingVariables` function previously had no log calls despite performing non-trivial variable expansion across multiple tracing config fields. The rest of `config/expand.go` and its sibling `config/validation.go` already use the `logValidation` logger extensively. **New logging added:** - Function entry log showing which tracing config fields are present (`hasEndpoint`, `hasTraceID`, `hasSpanID`, `hasHeaders`) - Individual expansion log per field (endpoint, traceId, spanId, headers) — only emitted when that field is non-empty - Function completion log ## Why This File - The `logValidation` logger (`config:validation` namespace) is already declared in the same package (`config/validation.go`), so no new logger declaration is needed - `expandTracingVariables` is called for TOML-loaded configs during startup — logging here helps diagnose tracing misconfiguration where `\$\{VAR}` syntax is used in OpenTelemetry settings - The 5 new log calls are proportionate and non-redundant; each message adds distinct value ## Validation - `go build` ✅ - `go vet` ✅ - `go test ./...` ✅ (pre-existing `TestFetchAndFixSchema_NetworkError` network failure unrelated to this change) > [!WARNING] > **⚠️ Firewall blocked 1 domain** > > The following domain was blocked by the firewall during workflow execution: > > - `invalidhostthatdoesnotexist12345.com` > > To allow these domains, add them to the `network.allowed` list in your workflow frontmatter: > > ```yaml > network: > allowed: > - defaults > - "invalidhostthatdoesnotexist12345.com" > ``` > > See [Network Configuration](https://github.github.com/gh-aw/reference/network/) for more information. > Generated by [Go Logger Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/25359094193/agentic_workflow) · ● 7.3M · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, version: 1.0.21, model: auto, id: 25359094193, workflow_id: go-logger, run: https://github.com/github/gh-aw-mcpg/actions/runs/25359094193 --> <!-- gh-aw-workflow-id: go-logger -->
2 parents 27f2bc2 + 94cc853 commit 3e53234

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/config/expand.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@ func expandTracingVariables(cfg *TracingConfig) error {
9797
return nil
9898
}
9999

100+
logValidation.Printf("Expanding tracing config variables: hasEndpoint=%v, hasTraceID=%v, hasSpanID=%v, hasHeaders=%v",
101+
cfg.Endpoint != "", cfg.TraceID != "", cfg.SpanID != "", cfg.Headers != "")
102+
100103
if cfg.Endpoint != "" {
101104
expanded, err := expandVariables(cfg.Endpoint, "gateway.opentelemetry.endpoint")
102105
if err != nil {
103106
return err
104107
}
108+
logValidation.Printf("Expanded tracing endpoint variable")
105109
cfg.Endpoint = expanded
106110
}
107111

@@ -110,6 +114,7 @@ func expandTracingVariables(cfg *TracingConfig) error {
110114
if err != nil {
111115
return err
112116
}
117+
logValidation.Printf("Expanded tracing traceId variable")
113118
cfg.TraceID = expanded
114119
}
115120

@@ -118,6 +123,7 @@ func expandTracingVariables(cfg *TracingConfig) error {
118123
if err != nil {
119124
return err
120125
}
126+
logValidation.Printf("Expanded tracing spanId variable")
121127
cfg.SpanID = expanded
122128
}
123129

@@ -126,8 +132,10 @@ func expandTracingVariables(cfg *TracingConfig) error {
126132
if err != nil {
127133
return err
128134
}
135+
logValidation.Printf("Expanded tracing headers variable")
129136
cfg.Headers = expanded
130137
}
131138

139+
logValidation.Print("Tracing config variable expansion completed")
132140
return nil
133141
}

0 commit comments

Comments
 (0)