@@ -35,20 +35,24 @@ public static void report(String hostname, InetAddress[] inetAddresses) {
3535 // store stats
3636 StatisticsStore .registerCall ("java.net.InetAddress.getAllByName" , OperationKind .OUTGOING_HTTP_OP );
3737
38+ boolean bypassed = BypassedContextStore .isBypassed ();
39+
3840 // Consume pending ports recorded by URLCollector for this hostname.
3941 // Removing them here ensures each (hostname, port) pair is counted exactly once.
4042 Set <Integer > ports = PendingHostnamesStore .getAndRemove (hostname );
41- if (!ports .isEmpty ()) {
42- for (int port : ports ) {
43- HostnamesStore .incrementHits (hostname , port );
43+ if (!bypassed ) {
44+ // Bypassed IPs are trusted — don't report their outbound hostnames in heartbeats.
45+ if (!ports .isEmpty ()) {
46+ for (int port : ports ) {
47+ HostnamesStore .incrementHits (hostname , port );
48+ }
49+ } else {
50+ HostnamesStore .incrementHits (hostname , 0 );
4451 }
45- } else {
46- // We still need to report a hit to the hostname for outbound domain blocking
47- HostnamesStore .incrementHits (hostname , 0 );
4852 }
4953
5054 // Block if the hostname is in the blocked domains list
51- if (ServiceConfigStore .shouldBlockOutgoingRequest (hostname ) && !BypassedContextStore . isBypassed () ) {
55+ if (ServiceConfigStore .shouldBlockOutgoingRequest (hostname ) && !bypassed ) {
5256 logger .debug ("Blocking DNS lookup for domain: %s" , hostname );
5357 throw BlockedOutboundException .get ();
5458 }
0 commit comments