flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zentol <...@git.apache.org>
Subject [GitHub] flink pull request #5182: [FLINK-8162] [kinesis-connector] Emit Kinesis' mil...
Date Mon, 08 Jan 2018 12:23:39 GMT
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5182#discussion_r160131414
  
    --- Diff: flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java
---
    @@ -70,35 +71,45 @@
     
     	private Date initTimestamp;
     
    +	private long millisBehindLatest;
    +
     	/**
     	 * Creates a shard consumer.
     	 *
     	 * @param fetcherRef reference to the owning fetcher
     	 * @param subscribedShardStateIndex the state index of the shard this consumer is subscribed
to
     	 * @param subscribedShard the shard this consumer is subscribed to
     	 * @param lastSequenceNum the sequence number in the shard to start consuming
    +	 * @param kinesisMetricGroup the metric group to report to
     	 */
     	public ShardConsumer(KinesisDataFetcher<T> fetcherRef,
     						Integer subscribedShardStateIndex,
     						StreamShardHandle subscribedShard,
    -						SequenceNumber lastSequenceNum) {
    +						SequenceNumber lastSequenceNum,
    +						MetricGroup kinesisMetricGroup) {
     		this(fetcherRef,
     			subscribedShardStateIndex,
     			subscribedShard,
     			lastSequenceNum,
    -			KinesisProxy.create(fetcherRef.getConsumerConfiguration()));
    +			KinesisProxy.create(fetcherRef.getConsumerConfiguration()),
    +			kinesisMetricGroup);
     	}
     
     	/** This constructor is exposed for testing purposes. */
     	protected ShardConsumer(KinesisDataFetcher<T> fetcherRef,
     							Integer subscribedShardStateIndex,
     							StreamShardHandle subscribedShard,
     							SequenceNumber lastSequenceNum,
    -							KinesisProxyInterface kinesis) {
    +							KinesisProxyInterface kinesis,
    +							MetricGroup kinesisMetricGroup) {
     		this.fetcherRef = checkNotNull(fetcherRef);
     		this.subscribedShardStateIndex = checkNotNull(subscribedShardStateIndex);
     		this.subscribedShard = checkNotNull(subscribedShard);
     		this.lastSequenceNum = checkNotNull(lastSequenceNum);
    +
    +		checkNotNull(kinesisMetricGroup)
    +			.gauge("millisBehindLatest", () -> millisBehindLatest);
    --- End diff --
    
    yes you can use lambdas.


---

Mime
View raw message