public interface DnsQueryLifecycleObserver
queryCancelled(int)
queryWritten(InetSocketAddress, ChannelFuture)
queryRedirected(List)
or queryCNAMEd(DnsQuestion)
or
queryNoAnswer(DnsResponseCode)
or queryCancelled(int)
or
queryFailed(Throwable)
or querySucceed()
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.
限定符和类型 | 方法和说明 |
---|---|
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(java.lang.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
|
DnsQueryLifecycleObserver |
queryNoAnswer(DnsResponseCode code)
The response to the query didn't provide the expected response code, but it didn't return
DnsResponseCode.NXDOMAIN so we may try to query again. |
DnsQueryLifecycleObserver |
queryRedirected(java.util.List<java.net.InetSocketAddress> nameServers)
The query has been redirected to another list of DNS servers.
|
void |
querySucceed()
The query received the expected results.
|
void |
queryWritten(java.net.InetSocketAddress dnsServerAddress,
ChannelFuture future)
The query has been written.
|
void queryWritten(java.net.InetSocketAddress dnsServerAddress, ChannelFuture future)
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.void queryCancelled(int queriesRemaining)
queriesRemaining
- The number of queries remaining.DnsQueryLifecycleObserver queryRedirected(java.util.List<java.net.InetSocketAddress> nameServers)
nameServers
- The name servers the query has been redirected to.DnsQueryLifecycleObserver queryCNAMEd(DnsQuestion cnameQuestion)
Note that multiple queries may be encountering a CNAME. For example a if both DnsRecordType.AAAA
and
DnsRecordType.A
are supported we may query for both.
cnameQuestion
- the question we would use if we issue a new query.DnsQueryLifecycleObserver queryNoAnswer(DnsResponseCode code)
DnsResponseCode.NXDOMAIN
so we may try to query again.code
- the unexpected response code.void queryFailed(java.lang.Throwable cause)
cause
- The cause which for the failure.void querySucceed()