Skip to content

Conversation

@buger
Copy link
Member

@buger buger commented Jan 31, 2026

Summary

  • Add verbose debug logging to trace execution path in API definition compression feature
  • New [RPC-DEBUG] log messages at entry points of saveRPCDefinitionsBackup and compressAPIBackup functions
  • Log the runtime value of CompressAPIDefinitions flag to help diagnose configuration issues

Context

This addresses customer troubleshooting needs for the compress_api_definitions feature (TT-16266). Users have reported that the feature does not appear to be triggered in their local environments, with no debug logs appearing even when the feature is enabled.

The new logs will help determine:

  1. Whether saveRPCDefinitionsBackup is being called during API reloads
  2. The actual runtime value of the CompressAPIDefinitions configuration flag
  3. Whether compressAPIBackup is being invoked

Test plan

  • Build gateway with changes
  • Configure log_level: "debug" and compress_api_definitions: true in tyk.conf
  • Create or reload an API
  • Verify the following log messages appear:
    • [RPC-DEBUG] ==> Entered saveRPCDefinitionsBackup
    • [RPC-DEBUG] ==> Calling compressAPIBackup with CompressAPIDefinitions flag set to: true
    • [RPC-DEBUG] ==> Entered compressAPIBackup

🤖 Generated with Claude Code

Ticket Details

TT-16266
Status In Test
Summary Implement compression of API definitions to reduce Redis usage

Generated at: 2026-01-31 18:37:44

Add verbose debug logging to help diagnose issues with the
compress_api_definitions feature not being triggered in customer
environments. The new logs trace the execution path and show the
runtime configuration value.

New debug messages:
- Entry into saveRPCDefinitionsBackup function
- CompressAPIDefinitions flag value before calling compressAPIBackup
- Entry into compressAPIBackup function

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

🚨 Jira Linter Failed

Commit: 6b37491
Failed at: 2026-01-31 18:37:45 UTC

The Jira linter failed to validate your PR. Please check the error details below:

🔍 Click to view error details
failed to validate Jira issue: jira ticket TT-16266 has status 'In Test' but must be one of: In Dev, In Code Review, Ready For Dev, Dod Check

Next Steps

  • Ensure your branch name contains a valid Jira ticket ID (e.g., ABC-123)
  • Verify your PR title matches the branch's Jira ticket ID
  • Check that the Jira ticket exists and is accessible

This comment will be automatically deleted once the linter passes.

@github-actions
Copy link
Contributor

API Changes

no api changes detected
@probelabs
Copy link

probelabs bot commented Jan 31, 2026

This PR introduces debug-level logging to the API definition compression logic to improve traceability for a feature that has been difficult for users to troubleshoot.

Files Changed Analysis

  • File: gateway/rpc_backup_handlers.go
  • Changes: +3 additions / -0 deletions
  • Summary: The changes are confined to a single file, adding three log.Debug statements at the entry points of saveRPCDefinitionsBackup and compressAPIBackup, and just before the compression logic is invoked. This provides clear visibility into the execution flow and the runtime value of the CompressAPIDefinitions configuration flag.

Architecture & Impact Assessment

  • What this PR accomplishes: It adds verbose logging to the RPC API definition backup process. This directly addresses a user-reported issue where the compress_api_definitions feature appeared inactive, by making its execution path observable.

  • Key technical changes introduced:

    • Three log.Debug statements have been added to trace the execution path.
    • No logical changes have been made, making this a low-risk enhancement.
  • Affected system components: The change impacts the Gateway's API loading mechanism, specifically when it fetches API definitions via RPC. The new logs will appear during gateway startup or API reloads if the log level is set to debug.

  • Flow Diagram:

graph TD
    A[API Reload / Gateway Start] --> B{APIDefinitionLoader.FromRPC};
    B --> C{store.GetApiDefinitions};
    C --> D{"rpc.LoadCount() > 0?"};
    D -- Yes --> E[gw.saveRPCDefinitionsBackup];
    E -- logs --> F[Entered saveRPCDefinitionsBackup];
    E --> G{gw.compressAPIBackup};
    G -- logs --> H[Calling compressAPIBackup with flag value];
    G -- logs --> I[Entered compressAPIBackup];

Loading

Scope Discovery & Context Expansion

The changes are localized to the rpc_backup_handlers.go file. The investigation confirmed that saveRPCDefinitionsBackup is called from APIDefinitionLoader.FromRPC in gateway/api_definition.go. This function is central to loading API configurations into the gateway from an RPC source (like Tyk Dashboard).

The trigger for this entire flow is an API reload or a gateway startup, which causes the gateway to fetch all its assigned API definitions. The new logging will therefore be visible in these scenarios, providing crucial diagnostic information without affecting the core logic of compression or data persistence.

Metadata
  • Review Effort: 1 / 5
  • Primary Label: enhancement

Powered by Visor from Probelabs

Last updated: 2026-01-31T18:39:16.870Z | Triggered by: pr_opened | Commit: 6b37491

💡 TIP: You can chat with Visor using /visor ask <your question>

@probelabs
Copy link

probelabs bot commented Jan 31, 2026

✅ Security Check Passed

No security issues found – changes LGTM.

✅ Architecture Check Passed

No architecture issues found – changes LGTM.

✅ Performance Check Passed

No performance issues found – changes LGTM.

✅ Quality Check Passed

No quality issues found – changes LGTM.


Powered by Visor from Probelabs

Last updated: 2026-01-31T18:39:19.510Z | Triggered by: pr_opened | Commit: 6b37491

💡 TIP: You can chat with Visor using /visor ask <your question>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants