Skip to content

Commit 49ed282

Browse files
committed
First group - add imports of diagram images
1 parent b178aff commit 49ed282

8 files changed

Lines changed: 54 additions & 387 deletions

File tree

‎.vscode/settings.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
"openslo",
258258
"optin",
259259
"OSSL",
260+
"outofsync",
260261
"PABC",
261262
"pacticipant",
262263
"PERC",

‎src/content/articles/api-gateway-metrics-traces-logs-debugging/pdf.mdx‎

Lines changed: 13 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ tags: ["apis-and-gateways", "prometheus", "grafana", "aws", "terraform"]
99
featured: true
1010
---
1111

12+
import apiGatewayDiagram from "./diagrams/api-gateway-as-the-central-observation-point-for-all-traffic.png"
13+
import gatewayDashboardDiagram from "./diagrams/gateway-dashboard-layout-with-logical-panel-grouping.jpg"
14+
import requestLifecycleDiagram from "./diagrams/request-lifecycle-showing-gateway-overhead-vs-backend-latency-with-typical-durations_deep-dive.png"
15+
import traceContextDiagram from "./diagrams/trace-context-propagation-creating-connected-spans-across-gateway-boundary.jpg"
16+
1217
*[gRPC]: Google Remote Procedure Call
1318
*[OTEL]: OpenTelemetry
1419
*[P99]: 99th Percentile
@@ -43,26 +48,12 @@ Gateway observability is not the same as service observability, and treating it
4348
The fundamental difference is scope: every request passes through the gateway. When a backend service has a problem, its own metrics show the issue clearly — error rate spikes, latency increases, throughput drops. But the gateway sees that same problem diluted across all the traffic it handles. If one of ten backends is failing, the gateway's aggregate error rate increases by 10%, which might not even trigger an alert.
4449

4550
<Diagram
51+
src={apiGatewayDiagram}
4652
title="API gateway as the central observation point for all traffic"
4753
description={
4854
`Flowchart showing the API gateway positioned between a consumer and multiple downstream components. A Consumer sends requests to the API Gateway. From the gateway, traffic can go to an Auth Service, a Rate Limiter, Backend A, and Backend B. A grouped region labeled Gateway Boundary contains the API Gateway, Auth Service, and Rate Limiter, emphasizing that these components sit at the control point through which all requests pass. The diagram shows why the gateway is a unique observation point: it sees every request before it reaches the backend services and can record both control-plane decisions, such as authentication and rate limiting, and routing decisions to different backends.`
4955
}
50-
>
51-
```mermaid
52-
flowchart LR
53-
A[Consumer] --> B[API Gateway]
54-
B --> C[Auth Service]
55-
B --> D[Rate Limiter]
56-
B --> E[Backend A]
57-
B --> F[Backend B]
58-
59-
subgraph gatewayBoundary[Gateway Boundary]
60-
B
61-
C
62-
D
63-
end
64-
```
65-
</Diagram>
56+
/>
6657

6758
The gateway also adds its own latency that frequently gets blamed on backends. Authentication checks, rate limit lookups, request transformation, response transformation, TLS termination — these all take time. When users complain about slow APIs, the default assumption is that backends are slow, but I have seen gateway overhead account for 200ms+ on requests where the backend responded in 50ms.
6859

@@ -176,39 +167,12 @@ Be thoughtful about histogram buckets (predefined latency ranges like 0-10ms, 10
176167
The single most useful gateway metric is not total request duration — it is the breakdown of where time went. When someone reports "the API is slow," you need to immediately answer: is the gateway slow, or is the backend slow?
177168

178169
<Diagram
170+
src={requestLifecycleDiagram}
179171
title="Request lifecycle showing gateway vs. backend latency components"
180172
description={
181173
`Flowchart showing a request moving left to right through ten stages. The sequence begins with Request Received, then passes through TLS Handshake, Request Parse, Auth Check, Rate Limit Check, Route Match, Upstream Request, Backend Processing, Response Transform, and Response Sent. Two grouped regions separate where time is spent. A Gateway Time group contains TLS Handshake, Request Parse, Auth Check, Rate Limit Check, Route Match, Upstream Request, Response Transform, and Response Sent, representing work performed or coordinated by the gateway. A separate Backend Time group contains only Backend Processing, representing the actual time spent inside the upstream service. The diagram emphasizes that total latency is a combination of gateway-side work and backend execution, and that debugging requires measuring those components separately.`
182174
}
183-
>
184-
```mermaid
185-
graph LR
186-
A[Request Received] --> B[TLS Handshake]
187-
B --> C[Request Parse]
188-
C --> D[Auth Check]
189-
D --> E[Rate Limit Check]
190-
E --> F[Route Match]
191-
F --> G[Upstream Request]
192-
G --> H[Backend Processing]
193-
H --> I[Response Transform]
194-
I --> J[Response Sent]
195-
196-
subgraph gatewayTime[Gateway Time]
197-
B
198-
C
199-
D
200-
E
201-
F
202-
G
203-
I
204-
J
205-
end
206-
207-
subgraph backendTime[Backend Time]
208-
H
209-
end
210-
```
211-
</Diagram>
175+
/>
212176

213177
At minimum, instrument these separately:
214178

@@ -391,29 +355,12 @@ Code: W3C Trace Context header propagation through API gateway.
391355
The gateway creates its own span as a child of the incoming span, then creates new child spans for each outbound request. The trace ID stays the same throughout — that is what connects all the spans into a single trace. The span IDs change at each hop to distinguish different operations.
392356

393357
<Diagram
358+
src={traceContextDiagram}
394359
title="Trace context propagation creating connected spans across gateway boundary"
395360
description={
396361
`Sequence diagram showing how a single distributed trace continues across a client, gateway, auth service, and backend. The client sends a request to the gateway with a traceparent header containing trace ID abc and span ID 123. The gateway creates its own span as a child of that incoming request. The gateway then calls the auth service with the same trace ID but a new span ID 456, receives the auth response, and forwards the request to the backend with the same trace ID and another new span ID 789. The backend returns a response to the gateway, which then responds to the client. A note across the full diagram states that all spans share the same trace ID abc, emphasizing that the trace remains connected even though each hop creates a new span.`
397362
}
398-
>
399-
```mermaid
400-
sequenceDiagram
401-
participant Client
402-
participant Gateway
403-
participant Auth
404-
participant Backend
405-
406-
Client->>Gateway: Request (traceparent: abc-123)
407-
Gateway->>Gateway: Create span (parent: 123)
408-
Gateway->>Auth: Auth check (traceparent: abc-456)
409-
Auth-->>Gateway: Auth response
410-
Gateway->>Backend: Forward (traceparent: abc-789)
411-
Backend-->>Gateway: Response
412-
Gateway-->>Client: Response
413-
414-
Note over Client,Backend: All spans share trace ID abc
415-
```
416-
</Diagram>
363+
/>
417364

418365
Common propagation failures I have seen:
419366

@@ -825,39 +772,12 @@ The overview dashboard answers three questions that operations teams ask constan
825772
The layout matters. Arrange panels so that related information is grouped and the eye naturally flows from high-level health to specific details:
826773

827774
<Diagram
775+
src={gatewayDashboardDiagram}
828776
title="Gateway dashboard layout with logical panel grouping"
829777
description={
830778
`Top-to-bottom flowchart showing a dashboard organized into four rows. The first row, labeled Row 1 Health Overview, contains Request Rate, Error Rate, and P99 Latency panels for immediate high-level status. The second row, labeled Row 2 Upstream Status, contains Upstream Health Map and Circuit Breaker States panels to show backend health. The third row, labeled Row 3 Traffic Breakdown, contains Top Routes, Top Consumers, and Error Distribution panels for traffic analysis. The fourth row, labeled Row 4 Latency Analysis, contains Gateway vs Backend Latency, Latency by Route, and Slow Request Percent panels for performance investigation. Arrows connect row 1 to row 2, row 2 to row 3, and row 3 to row 4, showing an intended reading order from broad health signals to detailed diagnostic panels.`
831779
}
832-
>
833-
```mermaid
834-
graph TB
835-
subgraph row1[Row 1 Health Overview]
836-
A[Request Rate]
837-
B[Error Rate]
838-
C[P99 Latency]
839-
end
840-
841-
subgraph row2[Row 2 Upstream Status]
842-
D[Upstream Health Map]
843-
E[Circuit Breaker States]
844-
end
845-
846-
subgraph row3[Row 3 Traffic Breakdown]
847-
F[Top Routes]
848-
G[Top Consumers]
849-
H[Error Distribution]
850-
end
851-
852-
subgraph row4[Row 4 Latency Analysis]
853-
I[Gateway vs Backend Latency]
854-
J[Latency by Route]
855-
K[Slow Request %]
856-
end
857-
858-
row1 --> row2 --> row3 --> row4
859-
```
860-
</Diagram>
780+
/>
861781

862782
Row 1 gives you immediate health status — if everything is green, you can stop looking. Row 2 shows backend status, helping you quickly identify if a problem is gateway-side or upstream-side. Rows 3 and 4 provide the detail needed to narrow down issues to specific routes or consumers.
863783

44.8 KB
Loading

0 commit comments

Comments
 (0)