Package io.netty.resolver.dns
Interface DnsQueryLifecycleObserver
- All Known Implementing Classes:
BiDnsQueryLifecycleObserver
,LoggingDnsQueryLifecycleObserver
,NoopDnsQueryLifecycleObserver
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, ChannelFuture)
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
Modifier and TypeMethodDescriptionvoid
queryCancelled
(int queriesRemaining) The query may have been written but it was cancelled at some point.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 resolutionqueryNoAnswer
(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.queryRedirected
(List<InetSocketAddress> nameServers) The query has been redirected to another list of DNS servers.void
The query received the expected results.void
queryWritten
(InetSocketAddress dnsServerAddress, ChannelFuture future) The query has been written.
-
Method Details
-
queryWritten
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
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
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
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
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.
-