Skip to content

[log] log: add debug logging to proxy/graphql_rewrite.go#2378

Closed
github-actions[bot] wants to merge 1 commit intomainfrom
log/graphql-rewrite-debug-logging-1bef22ed06b415e6
Closed

[log] log: add debug logging to proxy/graphql_rewrite.go#2378
github-actions[bot] wants to merge 1 commit intomainfrom
log/graphql-rewrite-debug-logging-1bef22ed06b415e6

Conversation

@github-actions
Copy link
Contributor

Summary

Adds debug logging to internal/proxy/graphql_rewrite.go using the existing logGraphQL logger (defined in graphql.go, same package). No new logger declaration is needed.

Changes

File modified: internal/proxy/graphql_rewrite.go (1 file, exactly)

Logging added

InjectGuardFields — entry + all early-return paths:

  • Entry log: toolName and bodyLen for traceability
  • Fields-not-needed path: logs when no guard fields apply to the tool
  • Unmarshal error path: logs parse failure with tool name and error
  • All-present / empty-query path: logs skip with reason
  • No-change path: logs when injection produced no diff (no-op)

injectFieldsIntoQuery — injection strategy chosen:

  • Fragment path: logs fragName and injected fields
  • Direct nodes path: logs fields being injected inline
  • No-match path: logs when no injection point was found

Before

InjectGuardFields had a single log call only on the success-injection path. Silent failures (parse errors, no-op injections, wrong tool name) were invisible in debug output.

After

Every significant control-flow branch emits a debug log, making it straightforward to trace why a guard-field injection did or did not happen for a given request.

Quality checklist

  • Exactly 1 file modified
  • No test files modified
  • Reuses existing logGraphQL logger (no duplicate declaration)
  • Logger naming follows pkg:filename convention (proxy:graphql)
  • Log arguments are pure variable references — no side effects
  • Messages are meaningful and useful for debugging
  • No duplication with existing log call (the success-injection log is preserved as-is)
  • Import statements unchanged (no new imports needed)

Generated by Go Logger Enhancement ·

Add debug logging calls to the GraphQL guard field injection logic
using the existing logGraphQL logger from graphql.go.

Logging covers:
- InjectGuardFields entry with toolName and body size
- Early returns (no fields needed, parse error, all fields present)
- Injection outcome (no-op vs actual injection)
- injectFieldsIntoQuery path taken (fragment vs direct nodes)
- No injection point found case

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Mar 23, 2026
@lpcox lpcox closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant