@@ -40,15 +40,12 @@ public final class HttpRequest implements Serializable {
4040 private final Long responseSize ;
4141 private final String userAgent ;
4242 private final String remoteIp ;
43- // todo(mziccard) uncomment when #1042 gets fixed
44- // private final String serverIp;
43+ private final String serverIp ;
4544 private final String referer ;
46- // todo(mziccard) uncomment when #1042 gets fixed
47- // private final boolean cacheLookup;
45+ private final boolean cacheLookup ;
4846 private final boolean cacheHit ;
4947 private final boolean cacheValidatedWithOriginServer ;
50- // todo(mziccard) uncomment when #1042 gets fixed
51- // private final Long cacheFillBytes;
48+ private final Long cacheFillBytes ;
5249
5350 /**
5451 * The HTTP request method.
@@ -72,15 +69,12 @@ public static final class Builder {
7269 private Long responseSize ;
7370 private String userAgent ;
7471 private String remoteIp ;
75- // todo(mziccard) uncomment when #1042 gets fixed
76- // private String serverIp;
72+ private String serverIp ;
7773 private String referer ;
78- // todo(mziccard) uncomment when #1042 gets fixed
79- // private boolean cacheLookup;
74+ private boolean cacheLookup ;
8075 private boolean cacheHit ;
8176 private boolean cacheValidatedWithOriginServer ;
82- // todo(mziccard) uncomment when #1042 gets fixed
83- // private Long cacheFillBytes;
77+ private Long cacheFillBytes ;
8478
8579 Builder () {}
8680
@@ -92,15 +86,12 @@ public static final class Builder {
9286 this .responseSize = request .responseSize ;
9387 this .userAgent = request .userAgent ;
9488 this .remoteIp = request .remoteIp ;
95- // todo(mziccard) uncomment when #1042 gets fixed
96- // this.serverIp = request.serverIp;
89+ this .serverIp = request .serverIp ;
9790 this .referer = request .referer ;
98- // todo(mziccard) uncomment when #1042 gets fixed
99- // this.cacheLookup = request.cacheLookup;
91+ this .cacheLookup = request .cacheLookup ;
10092 this .cacheHit = request .cacheHit ;
10193 this .cacheValidatedWithOriginServer = request .cacheValidatedWithOriginServer ;
102- // todo(mziccard) uncomment when #1042 gets fixed
103- // this.cacheFillBytes = request.cacheFillBytes;
94+ this .cacheFillBytes = request .cacheFillBytes ;
10495 }
10596
10697 /**
@@ -169,11 +160,10 @@ public Builder remoteIp(String remoteIp) {
169160 * Sets the IP address (IPv4 or IPv6) of the origin server that the request was sent to.
170161 * Examples: {@code 192.168.1.1}, {@code FE80::0202:B3FF:FE1E:8329}.
171162 */
172- // todo(mziccard) uncomment when #1042 gets fixed
173- //public Builder serverIp(String serverIp) {
174- // this.serverIp = serverIp;
175- // return this;
176- //}
163+ public Builder serverIp (String serverIp ) {
164+ this .serverIp = serverIp ;
165+ return this ;
166+ }
177167
178168 /**
179169 * Sets the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.
@@ -189,11 +179,10 @@ public Builder referer(String referer) {
189179 /**
190180 * Sets whether or not a cache lookup was attempted. If not set, {@code false} is used.
191181 */
192- // todo(mziccard) uncomment when #1042 gets fixed
193- //public Builder cacheLookup(boolean cacheLookup) {
194- // this.cacheLookup = cacheLookup;
195- // return this;
196- //}
182+ public Builder cacheLookup (boolean cacheLookup ) {
183+ this .cacheLookup = cacheLookup ;
184+ return this ;
185+ }
197186
198187 /**
199188 * Sets whether or not an entity was served from cache (with or without validation). If not set,
@@ -218,11 +207,10 @@ public Builder cacheValidatedWithOriginServer(boolean cacheValidatedWithOriginSe
218207 * Sets the number of HTTP response bytes inserted into cache. Set only when a cache fill was
219208 * attempted.
220209 */
221- // todo(mziccard) uncomment when #1042 gets fixed
222- //public Builder cacheFillBytes(long cacheFillBytes) {
223- // this.cacheFillBytes = cacheFillBytes;
224- // return this;
225- //}
210+ public Builder cacheFillBytes (long cacheFillBytes ) {
211+ this .cacheFillBytes = cacheFillBytes ;
212+ return this ;
213+ }
226214
227215 /**
228216 * Creates a {@code HttpRequest} object for this builder.
@@ -240,15 +228,12 @@ public HttpRequest build() {
240228 this .responseSize = builder .responseSize ;
241229 this .userAgent = builder .userAgent ;
242230 this .remoteIp = builder .remoteIp ;
243- // todo(mziccard) uncomment when #1042 gets fixed
244- // this.serverIp = builder.serverIp;
231+ this .serverIp = builder .serverIp ;
245232 this .referer = builder .referer ;
246- // todo(mziccard) uncomment when #1042 gets fixed
247- // this.cacheLookup = builder.cacheLookup;
233+ this .cacheLookup = builder .cacheLookup ;
248234 this .cacheHit = builder .cacheHit ;
249235 this .cacheValidatedWithOriginServer = builder .cacheValidatedWithOriginServer ;
250- // todo(mziccard) uncomment when #1042 gets fixed
251- // this.cacheFillBytes = builder.cacheFillBytes;
236+ this .cacheFillBytes = builder .cacheFillBytes ;
252237 }
253238
254239 /**
@@ -310,10 +295,9 @@ public String remoteIp() {
310295 * Returns the IP address (IPv4 or IPv6) of the origin server that the request was sent to.
311296 * Examples: {@code 192.168.1.1}, {@code FE80::0202:B3FF:FE1E:8329}.
312297 */
313- // todo(mziccard) uncomment when #1042 gets fixed
314- //public String serverIp() {
315- // return serverIp;
316- //}
298+ public String serverIp () {
299+ return serverIp ;
300+ }
317301
318302 /**
319303 * Returns the referer URL of the request, as defined in HTTP/1.1 Header Field Definitions.
@@ -329,10 +313,9 @@ public String referer() {
329313 * Returns whether or not a cache lookup was attempted. If not set, this method returns
330314 * {@code false}.
331315 */
332- // todo(mziccard) uncomment when #1042 gets fixed
333- //public boolean cacheLookup() {
334- // return cacheLookup;
335- //}
316+ public boolean cacheLookup () {
317+ return cacheLookup ;
318+ }
336319
337320 /**
338321 * Returns whether or not an entity was served from cache (with or without validation). If not
@@ -355,17 +338,15 @@ public boolean cacheValidatedWithOriginServer() {
355338 * Returns the number of HTTP response bytes inserted into cache. Set only when a cache fill was
356339 * attempted.
357340 */
358- // todo(mziccard) uncomment when #1042 gets fixed
359- //public Long cacheFillBytes() {
360- // return cacheFillBytes;
361- //}
341+ public Long cacheFillBytes () {
342+ return cacheFillBytes ;
343+ }
362344
363345 @ Override
364346 public int hashCode () {
365347 return Objects .hash (requestMethod , requestUrl , requestSize , status , responseSize , userAgent ,
366- // todo(mziccard) uncomment when #1042 gets fixed
367- // serverIp, cacheLookup, cacheFillBytes
368- remoteIp , referer , cacheHit , cacheValidatedWithOriginServer );
348+ serverIp , cacheLookup , cacheFillBytes , remoteIp , referer , cacheHit ,
349+ cacheValidatedWithOriginServer );
369350 }
370351
371352 @ Override
@@ -378,15 +359,12 @@ public String toString() {
378359 .add ("responseSize" , responseSize )
379360 .add ("userAgent" , userAgent )
380361 .add ("remoteIp" , remoteIp )
381- // todo(mziccard) uncomment when #1042 gets fixed
382- // .add("serverIp", serverIp)
362+ .add ("serverIp" , serverIp )
383363 .add ("referer" , referer )
384- // todo(mziccard) uncomment when #1042 gets fixed
385- // .add("cacheLookup", cacheLookup)
364+ .add ("cacheLookup" , cacheLookup )
386365 .add ("cacheHit" , cacheHit )
387366 .add ("cacheValidatedWithOriginServer" , cacheValidatedWithOriginServer )
388- // todo(mziccard) uncomment when #1042 gets fixed
389- // .add("cacheFillBytes", cacheFillBytes)
367+ .add ("cacheFillBytes" , cacheFillBytes )
390368 .toString ();
391369 }
392370
@@ -406,15 +384,12 @@ public boolean equals(Object obj) {
406384 && Objects .equals (responseSize , other .responseSize )
407385 && Objects .equals (userAgent , other .userAgent )
408386 && Objects .equals (remoteIp , other .remoteIp )
409- // todo(mziccard) uncomment when #1042 gets fixed
410- // && Objects.equals(serverIp, other.serverIp)
387+ && Objects .equals (serverIp , other .serverIp )
411388 && Objects .equals (referer , other .referer )
412- // todo(mziccard) uncomment when #1042 gets fixed
413- // && cacheLookup == other.cacheLookup
389+ && cacheLookup == other .cacheLookup
414390 && cacheHit == other .cacheHit
415- && cacheValidatedWithOriginServer == other .cacheValidatedWithOriginServer ;
416- // todo(mziccard) uncomment when #1042 gets fixed
417- // && Objects.equals(cacheFillBytes, other.cacheFillBytes);
391+ && cacheValidatedWithOriginServer == other .cacheValidatedWithOriginServer
392+ && Objects .equals (cacheFillBytes , other .cacheFillBytes );
418393 }
419394
420395 /**
@@ -448,21 +423,18 @@ com.google.logging.type.HttpRequest toPb() {
448423 if (remoteIp != null ) {
449424 builder .setRemoteIp (remoteIp );
450425 }
451- // todo(mziccard) uncomment when #1042 gets fixed
452- // if (serverIp != null) {
453- // builder.setServerIp(serverIp);
454- //}
426+ if (serverIp != null ) {
427+ builder .setServerIp (serverIp );
428+ }
455429 if (referer != null ) {
456430 builder .setReferer (referer );
457431 }
458- // todo(mziccard) uncomment when #1042 gets fixed
459- // builder.setCacheLookup(cacheLookup);
432+ builder .setCacheLookup (cacheLookup );
460433 builder .setCacheHit (cacheHit );
461434 builder .setCacheValidatedWithOriginServer (cacheValidatedWithOriginServer );
462- // todo(mziccard) uncomment when #1042 gets fixed
463- //if (cacheFillBytes != null) {
464- // builder.setCacheFillBytes(cacheFillBytes);
465- //}
435+ if (cacheFillBytes != null ) {
436+ builder .setCacheFillBytes (cacheFillBytes );
437+ }
466438 return builder .build ();
467439 }
468440
@@ -493,24 +465,21 @@ static HttpRequest fromPb(com.google.logging.type.HttpRequest requestPb) {
493465 if (requestPb .getUserAgent () != null && !requestPb .getRequestUrl ().equals ("" )) {
494466 builder .userAgent (requestPb .getUserAgent ());
495467 }
496- // todo(mziccard) uncomment when #1042 gets fixed
497- //if (requestPb.getServerIp() != null && !requestPb.getServerIp().equals("")) {
498- // builder.serverIp(requestPb.getServerIp());
499- //}
468+ if (requestPb .getServerIp () != null && !requestPb .getServerIp ().equals ("" )) {
469+ builder .serverIp (requestPb .getServerIp ());
470+ }
500471 if (requestPb .getRemoteIp () != null && !requestPb .getRemoteIp ().equals ("" )) {
501472 builder .remoteIp (requestPb .getRemoteIp ());
502473 }
503474 if (requestPb .getReferer () != null && !requestPb .getReferer ().equals ("" )) {
504475 builder .referer (requestPb .getReferer ());
505476 }
506- // todo(mziccard) uncomment when #1042 gets fixed
507- // builder.cacheLookup(requestPb.getCacheLookup());
477+ builder .cacheLookup (requestPb .getCacheLookup ());
508478 builder .cacheHit (requestPb .getCacheHit ());
509479 builder .cacheValidatedWithOriginServer (requestPb .getCacheValidatedWithOriginServer ());
510- // todo(mziccard) uncomment when #1042 gets fixed
511- //if (requestPb.getCacheFillBytes() != 0L) {
512- // builder.cacheFillBytes(requestPb.getCacheFillBytes());
513- //}
480+ if (requestPb .getCacheFillBytes () != 0L ) {
481+ builder .cacheFillBytes (requestPb .getCacheFillBytes ());
482+ }
514483 return builder .build ();
515484 }
516485}
0 commit comments