@@ -39,10 +39,10 @@ class BuiltInMetricsTracer extends MetricsTracer implements ApiTracer {
3939 private final Map <String , String > attributes = new HashMap <>();
4040 private Float gfeLatency = null ;
4141 private Float afeLatency = null ;
42- private TraceWrapper traceWrapper ;
43- private long gfeHeaderMissingCount = 0 ;
44- private long afeHeaderMissingCount = 0 ;
42+ private final TraceWrapper traceWrapper ;
4543 private final ISpan currentSpan ;
44+ private boolean isDirectPathUsed ;
45+ private boolean isAfeEnabled ;
4646
4747 BuiltInMetricsTracer (
4848 MethodName methodName ,
@@ -66,7 +66,7 @@ public void attemptSucceeded() {
6666 super .attemptSucceeded ();
6767 attributes .put (STATUS_ATTRIBUTE , StatusCode .Code .OK .toString ());
6868 builtInOpenTelemetryMetricsRecorder .recordServerTimingHeaderMetrics (
69- gfeLatency , afeLatency , gfeHeaderMissingCount , afeHeaderMissingCount , attributes );
69+ gfeLatency , afeLatency , attributes , isDirectPathUsed , isAfeEnabled );
7070 }
7171 }
7272
@@ -80,7 +80,7 @@ public void attemptCancelled() {
8080 super .attemptCancelled ();
8181 attributes .put (STATUS_ATTRIBUTE , StatusCode .Code .CANCELLED .toString ());
8282 builtInOpenTelemetryMetricsRecorder .recordServerTimingHeaderMetrics (
83- gfeLatency , afeLatency , gfeHeaderMissingCount , afeHeaderMissingCount , attributes );
83+ gfeLatency , afeLatency , attributes , isDirectPathUsed , isAfeEnabled );
8484 }
8585 }
8686
@@ -98,7 +98,7 @@ public void attemptFailedDuration(Throwable error, java.time.Duration delay) {
9898 super .attemptFailedDuration (error , delay );
9999 attributes .put (STATUS_ATTRIBUTE , extractStatus (error ));
100100 builtInOpenTelemetryMetricsRecorder .recordServerTimingHeaderMetrics (
101- gfeLatency , afeLatency , gfeHeaderMissingCount , afeHeaderMissingCount , attributes );
101+ gfeLatency , afeLatency , attributes , isDirectPathUsed , isAfeEnabled );
102102 }
103103 }
104104
@@ -115,7 +115,7 @@ public void attemptFailedRetriesExhausted(Throwable error) {
115115 super .attemptFailedRetriesExhausted (error );
116116 attributes .put (STATUS_ATTRIBUTE , extractStatus (error ));
117117 builtInOpenTelemetryMetricsRecorder .recordServerTimingHeaderMetrics (
118- gfeLatency , afeLatency , gfeHeaderMissingCount , afeHeaderMissingCount , attributes );
118+ gfeLatency , afeLatency , attributes , isDirectPathUsed , isAfeEnabled );
119119 }
120120 }
121121
@@ -132,24 +132,16 @@ public void attemptPermanentFailure(Throwable error) {
132132 super .attemptPermanentFailure (error );
133133 attributes .put (STATUS_ATTRIBUTE , extractStatus (error ));
134134 builtInOpenTelemetryMetricsRecorder .recordServerTimingHeaderMetrics (
135- gfeLatency , afeLatency , gfeHeaderMissingCount , afeHeaderMissingCount , attributes );
135+ gfeLatency , afeLatency , attributes , isDirectPathUsed , isAfeEnabled );
136136 }
137137 }
138138
139- void recordGFELatency (Float gfeLatency ) {
139+ public void recordServerTimingHeaderMetrics (
140+ Float gfeLatency , Float afeLatency , boolean isDirectPathUsed , boolean isAfeEnabled ) {
140141 this .gfeLatency = gfeLatency ;
141- }
142-
143- void recordAFELatency (Float afeLatency ) {
142+ this .isDirectPathUsed = isDirectPathUsed ;
144143 this .afeLatency = afeLatency ;
145- }
146-
147- void recordGfeHeaderMissingCount (Long value ) {
148- this .gfeHeaderMissingCount = value ;
149- }
150-
151- void recordAfeHeaderMissingCount (Long value ) {
152- this .afeHeaderMissingCount = value ;
144+ this .isAfeEnabled = isAfeEnabled ;
153145 }
154146
155147 @ Override
0 commit comments