Interface DnsQueryLifecycleObserver

All Known Implementing Classes:
BiDnsQueryLifecycleObserver

public interface DnsQueryLifecycleObserver
This interface provides visibility into individual DNS queries. The lifecycle of an objects is as follows:
  1. Object creation
  2. queryCancelled(int)
OR
  1. Object creation
  2. queryWritten(InetSocketAddress, ChannelFuture)
  3. 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.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    queryCancelled(int queriesRemaining)
    The query may have been written but it was cancelled at some point.
    queryCNAMEd(io.netty.handler.codec.dns.DnsQuestion cnameQuestion)
    The query returned a CNAME which we may attempt to follow with a new query.
    void
    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
    queryNoAnswer(io.netty.handler.codec.dns.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.
    The query has been redirected to another list of DNS servers.
    void
    The query received the expected results.
    void
    queryWritten(InetSocketAddress dnsServerAddress, io.netty.channel.ChannelFuture future)
    The query has been written.
  • Method Details

    • queryWritten

      void queryWritten(InetSocketAddress dnsServerAddress, io.netty.channel.ChannelFuture 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(io.netty.handler.codec.dns.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 and DnsRecordType.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(io.netty.handler.codec.dns.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.
      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.