Commit abf1178
authored
fix(metrics): fix GFE and AFE metrics publishing (#17561)
## Description
This PR enables and properly extracts Spanner Google Front End (GFE) and
Application Front End (AFE) latency metrics.
### Key Changes:
- **Fix Metadata Extraction Logic**: Modified MetricsInterceptor and
AsyncMetricsInterceptor to strictly extract server-timing data from
initial_metadata().
- **Add AFE Metrics Publishing**: Extended MetricsTracer to parse AFE
latency (afe;\s*dur=) from the server-timing header alongside GFE
metrics. Two new OpenTelemetry instruments (afe_latency and
afe_missing_header_count) have been introduced to publish these.
- **Support for Streaming RPCs**: Removed the manual toggle in
SpannerMetricsTracerFactory. GFE and AFE metrics capture is now
always-on whenever OpenTelemetry tracing is enabled.
- **Enable Frontend Metrics by Default**: Removed the `gfe_enabled`
toggle in `SpannerMetricsTracerFactory`. GFE metrics capture is now
always-on whenever OpenTelemetry tracing is enabled.
- **Testing**: Added unit tests and a new mockserver test
(test_frontend_metrics.py) to ensure both GFE and AFE metrics are
correctly published end-to-end.
- Local Testing Screenshot:
https://screenshot.googleplex.com/image/4tmjwuPjzdttcjW.png1 parent 562537a commit abf1178
13 files changed
Lines changed: 919 additions & 69 deletions
File tree
- packages/google-cloud-spanner
- google/cloud/spanner_v1
- metrics
- services/spanner/transports
- tests
- mockserver_tests
- system
- unit
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
707 | 713 | | |
708 | 714 | | |
709 | 715 | | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
710 | 723 | | |
711 | 724 | | |
712 | 725 | | |
| |||
716 | 729 | | |
717 | 730 | | |
718 | 731 | | |
719 | | - | |
| 732 | + | |
| 733 | + | |
720 | 734 | | |
721 | 735 | | |
722 | 736 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
0 commit comments