-
- All Known Implementing Classes:
BiDnsQueryLifecycleObserver
public interface DnsQueryLifecycleObserver
This interface provides visibility into individual DNS queries. The lifecycle of an objects is as follows:- Object creation
queryCancelled(int)
- Object creation
queryWritten(InetSocketAddress, Future)
queryRedirected(List)
orqueryCNAMEd(DnsQuestion)
orqueryNoAnswer(DnsResponseCode)
orqueryCancelled(int)
orqueryFailed(Throwable)
orquerySucceed()
This interface can be used to track metrics for individual DNS servers. Methods which may lead to another DNS query return an object of type
DnsQueryLifecycleObserver
. Implementations may use this to build a query tree to understand the "sub queries" generated by a single query.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
queryCancelled(int queriesRemaining)
The query may have been written but it was cancelled at some point.DnsQueryLifecycleObserver
queryCNAMEd(DnsQuestion cnameQuestion)
The query returned a CNAME which we may attempt to follow with a new query.void
queryFailed(Throwable cause)
The following criteria are possible: IO Error Server responded with an invalid DNS response Server responded with a valid DNS response, but it didn't progress the resolutionDnsQueryLifecycleObserver
queryNoAnswer(DnsResponseCode code)
The response to the query didn't provide the expected response code, but it didn't returnDnsResponseCode.NXDOMAIN
so we may try to query again.DnsQueryLifecycleObserver
queryRedirected(List<InetSocketAddress> nameServers)
The query has been redirected to another list of DNS servers.void
querySucceed()
The query received the expected results.void
queryWritten(InetSocketAddress dnsServerAddress, Future<Void> future)
The query has been written.
-
-
-
Method Detail
-
queryWritten
void queryWritten(InetSocketAddress dnsServerAddress, Future<Void> future)
The query has been written.- Parameters:
dnsServerAddress
- The DNS server address which the query was sent to.future
- The future which represents the status of the write operation for the DNS query.
-
queryCancelled
void queryCancelled(int queriesRemaining)
The query may have been written but it was cancelled at some point.- Parameters:
queriesRemaining
- The number of queries remaining.
-
queryRedirected
DnsQueryLifecycleObserver queryRedirected(List<InetSocketAddress> nameServers)
The query has been redirected to another list of DNS servers.- Parameters:
nameServers
- The name servers the query has been redirected to.- Returns:
- An observer for the new query which we may issue.
-
queryCNAMEd
DnsQueryLifecycleObserver queryCNAMEd(DnsQuestion cnameQuestion)
The query returned a CNAME which we may attempt to follow with a new query.Note that multiple queries may be encountering a CNAME. For example a if both
DnsRecordType.AAAA
andDnsRecordType.A
are supported we may query for both.- Parameters:
cnameQuestion
- the question we would use if we issue a new query.- Returns:
- An observer for the new query which we may issue.
-
queryNoAnswer
DnsQueryLifecycleObserver queryNoAnswer(DnsResponseCode code)
The response to the query didn't provide the expected response code, but it didn't returnDnsResponseCode.NXDOMAIN
so we may try to query again.- Parameters:
code
- the unexpected response code.- Returns:
- An observer for the new query which we may issue.
-
queryFailed
void queryFailed(Throwable cause)
The following criteria are possible:- IO Error
- Server responded with an invalid DNS response
- Server responded with a valid DNS response, but it didn't progress the resolution
- Parameters:
cause
- The cause which for the failure.
-
querySucceed
void querySucceed()
The query received the expected results.
-
-