MetricsSinkAdapter(
      String name,
      String description,
      MetricsSink sink,
      String context,
      MetricsFilter sourceFilter,
      MetricsFilter recordFilter,
      MetricsFilter metricFilter,
      int period,
      int queueCapacity,
      int retryDelay,
      float retryBackoff,
      int retryCount) {
    this.name = Contracts.checkNotNull(name, "name");
    this.description = description;
    this.sink = Contracts.checkNotNull(sink, "sink object");
    this.context = context;
    this.sourceFilter = sourceFilter;
    this.recordFilter = recordFilter;
    this.metricFilter = metricFilter;
    this.period = Contracts.checkArg(period, period > 0, "period");
    firstRetryDelay = Contracts.checkArg(retryDelay, retryDelay > 0, "retry delay");
    this.retryBackoff = Contracts.checkArg(retryBackoff, retryBackoff > 1, "backoff factor");
    oobPutTimeout = (long) (firstRetryDelay * Math.pow(retryBackoff, retryCount) * 1000);
    this.retryCount = retryCount;
    this.queue =
        new SinkQueue<MetricsBuffer>(
            Contracts.checkArg(queueCapacity, queueCapacity > 0, "queue capacity"));
    latency =
        registry.newStat("sink." + name + ".latency", "Sink end to end latency", "ops", "time");
    dropped = registry.newCounter("sink." + name + ".dropped", "Dropped updates per sink", 0);
    qsize = registry.newGauge("sink." + name + ".qsize", "Queue size", 0);

    sinkThread =
        new Thread() {
          @Override
          public void run() {
            publishMetricsFromQueue();
          }
        };
    sinkThread.setName(name);
    sinkThread.setDaemon(true);
  }
 void snapshot(MetricsRecordBuilder rb, boolean all) {
   registry.snapshot(rb, all);
 }