internal AbstractFetcherThread(
            string name,
            string clientId,
            Broker sourceBroker,
            int socketTimeout,
            int socketBufferSize,
            int fetchSize,
            int fetcherBrokerId  = -1,
            int maxWait          = 0,
            int minBytes         = 1,
            bool isInterruptible = true)
            : base(name, isInterruptible)
        {
            this.clientId         = clientId;
            this.sourceBroker     = sourceBroker;
            this.socketTimeout    = socketTimeout;
            this.socketBufferSize = socketBufferSize;
            this.fetchSize        = fetchSize;
            this.fetcherBrokerId  = fetcherBrokerId;
            this.maxWait          = maxWait;
            this.minBytes         = minBytes;

            this.partitionMapLock = new ReentrantLock();
            this.partitionMapCond = this.partitionMapLock.NewCondition();
            this.simpleConsumer   = new SimpleConsumer(
                sourceBroker.Host, sourceBroker.Port, socketTimeout, socketBufferSize, clientId);
            this.brokerInfo = string.Format("host_{0}-port_{1}", sourceBroker.Host, sourceBroker.Port);

            this.metricId = new ClientIdAndBroker(clientId, this.brokerInfo);

            this.FetcherStats        = new FetcherStats(this.metricId);
            this.FetcherLagStats     = new FetcherLagStats(this.metricId);
            this.fetchRequestBuilder =
                new FetchRequestBuilder().ClientId(clientId)
                .ReplicaId(fetcherBrokerId)
                .MaxWait(maxWait)
                .MinBytes(minBytes);
        }
 public FetcherStats(ClientIdAndBroker metricId)
 {
     this.RequestRate = MetersFactory.NewMeter(metricId + "-RequestsPerSec", "requests", TimeSpan.FromSeconds(1));
     this.ByteRate    = MetersFactory.NewMeter(metricId + "-BytesPerSec", "bytes", TimeSpan.FromSeconds(1));
 }
 public ProducerRequestMetrics(ClientIdAndBroker metricId)
 {
     this.RequestTimer    = new KafkaTimer(MetersFactory.NewTimer(metricId + "ProducerRequestRateAndTimeMs", TimeSpan.FromMilliseconds(1), TimeSpan.FromSeconds(1)));
     this.RequestSizeHist = MetersFactory.NewHistogram(metricId + "ProducerRequestSize");
 }
 public FetcherLagStats(ClientIdAndBroker metricId)
 {
     this.metricId     = metricId;
     this.valueFactory = k => new FetcherLagMetrics(k);
     this.Stats        = new Pool <ClientIdBrokerTopicPartition, FetcherLagMetrics>(this.valueFactory);
 }
Пример #5
0
 protected bool Equals(ClientIdAndBroker other)
 {
     return this.ClientId == other.ClientId && this.BrokerInfo == other.BrokerInfo;
 }