- Understanding how policies work
- Detecting performance issues
- Debugging
- Examining request/response flow
- Validating transformations
API Proxy-Based Trace
Detailed Tracking
Performance Analysis
Debugging
Starting Trace Mode
Trace mode is started separately for each API Proxy. You can activate trace mode from the API Proxy’s own page.Prerequisites
Before starting trace mode:API Proxy Must Be Loaded
Go to API Proxy Page
Make Environment Selection
Click Start Button

Trace Records
After trace mode is activated, requests coming to the API Proxy are automatically tracked and detailed records are created.
Trace List
The following information is displayed for each record in the trace list:| Information | Description |
|---|---|
| Timestamp | Date and time when the request arrived |
| Method | HTTP method (GET, POST, PUT, DELETE, etc.) |
| Path / Endpoint | Request path and endpoint name |
| Status Code | Response status code (200, 404, 500, etc.) |
| Duration | Total processing time (ms) |
| Policies | Number of policies executed |
| Correlation ID | Request-specific correlation ID |
- Before and after state of the message in the main flow
- Request and response message coming out of the API Call
Trace Operations
The following operations can be performed for each trace record:- Detailed Viewing
- JSON Format Viewing
- Download
- Quick Test


Tracking Policy Flow
Click the Select button to view the detailed log records kept by Apinizer for policies executed for the API Proxy while in step-by-step tracking mode.
- Successful Flow
- Failed Flow

Policy Execution Details
Pre-flow Policies
Pre-flow Policies
- Policy Name: Name of the executed policy
- Execution Time: Policy execution time (ms)
- Status: Success / Failure status
- Changes: Changes made by the policy to the message (header, body, variable changes)
Route Step (Routing)
Route Step (Routing)
- Selected Upstream: Selected upstream target
- Load Balancing Decision: Load balancing algorithm decision
- Connection Time: Connection time to backend (ms)
- Backend Response Time: Backend response time (ms)
- Retry/Failover: Retry or failover status
Post-flow Policies
Post-flow Policies
- Policy Name: Name of the executed policy
- Execution Time: Policy execution time (ms)
- Status: Success / Failure status
- Changes: Changes made to the response message
Fault Handler
Fault Handler
- Error Type: Error type (authentication, routing, policy, etc.)
- Error Message: Error message
- Handler Policies: Executed error handler policies
- Final Response: Final response returned to client
Detailed Log Records
The section displayed when a log record is selected presents a summary of whether the message flow was successful and, if it failed, at which point it occurred.
The following links can be used to view detailed log records:
1 - Client Log Records
1 - Client Log Records



2, 4 - Policy Log Records
2, 4 - Policy Log Records

3 - Backend API Log Records
3 - Backend API Log Records



Request/Response Comparison
Trace mode shows how the message changes along the flow:Before/After
Transformation Analysis
Header Changes
Body Changes
Performance Analysis
Trace mode provides detailed timing metrics to detect performance issues.Timing Metrics
The following metrics are displayed for each trace record:| Metric | Description |
|---|---|
| Total Duration | Total entry-exit time of the request (ms) |
| Pre-flow Duration | Total execution time of pre-flow policies |
| Route Duration | Connection to backend and response receiving time |
| Backend Duration | Backend API response time (net) |
| Post-flow Duration | Total execution time of post-flow policies |
| Gateway Overhead | Time added by Apinizer Gateway (Total - Backend) |
Policy Performance Analysis
To analyze policy performance:Slowest Policies
Policy Count
Average Policy Duration
Policy Execution Order
- Cache Policy: Use cache to reduce backend calls
- Conditional Flow: Conditionally skip unnecessary policies
- Script Optimization: Optimize slow operations in script policies
- Transformation: Remove unnecessary transformations
Backend Performance Metrics
To monitor backend API performance:| Metric | Description |
|---|---|
| Connection Time | TCP connection time to backend server |
| SSL Handshake Time | SSL handshake time for HTTPS connection |
| Response Time | Backend response generation time |
| Total Backend Time | Connection + Response total time |
| Backend Status | Success status of backend call |
| Retry/Failover Count | Number of retries or failovers performed |
Use Cases
Scenario 1: Performance Issue Detection
Situation: Response times of an API Proxy are higher than expected.Start Trace
Examine Slow Requests
Examine Policy Flow
Detect Bottlenecks
- Is backend API slow? → Backend should be optimized
- Are policies slow? → Script/transformation should be optimized
- Is database query slow? → Cache can be used
Perform Optimization
Scenario 2: Debugging
Situation: Some requests return 500 error and the cause is unknown.Start Trace
Find Failed Requests
Find Policy Where Error Occurred
Examine Policy Details
- Examine the message coming to the policy (Before)
- Read the error message
- Examine detailed log records
Perform Root Cause Analysis
- Is data format wrong?
- Is header missing?
- Is it a script error?
- Is backend unreachable?
Fix and Test
Scenario 3: Transformation Validation
Situation: Checking if JSON to XML transformation works correctly.Start Trace
Send Test Request
Select Transformation Policy
Compare Before/After
- Before: Incoming JSON message
- After: Converted XML message
- Check if the transformation is correct
Check Message Going to Backend
Scenario 4: Conditional Flow Testing
Situation: Testing if conditional policies work correctly.Start Trace
Send Requests for Different Conditions
- Request for premium user
- Request for normal user
- Request for guest
Examine Trace for Each Request
Check Condition Evaluation
- What was the condition expression?
- What was the evaluation result?
- Did the correct policies run?
Fix Conditions if Necessary
Best Practices
Trace Usage
Use Frequently in Development Environment
- Trace continuously during development
- Always test with trace when adding new policies
- Validate API changes with trace
Be Careful in Production
- Activate trace in production only when necessary
- Trace automatically closes after 5 minutes
- Consider performance impact
Use Custom Query
- Filter with Custom Query from the filter field next to environment selection
- Trace only relevant endpoints
- Minimize unnecessary trace records
Use on API Proxy Basis
- Start trace separately for each API Proxy
- Activate trace mode from the relevant API Proxy’s page
- Trace records are stored in MongoDB
Performance Monitoring
Regular Monitoring:- Run performance trace once a week
- Perform trend analyses
- Detect slowdowns early
- Detect bottlenecks with trace
- Optimize
- Validate improvement with trace
- Document results
Debugging
Systematic Approach:- Isolate the problem (which endpoint, under which condition?)
- Collect detailed information with trace
- Perform root cause analysis
- Fix
- Validate with trace
- Document the process
- Compare input/output messages for each policy
- Detect unexpected changes
- Check transformation correctness






