From issues-return-146616-archive-asf-public=cust-asf.ponee.io@flink.apache.org Mon Jan 8 13:24:08 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id D7ABB180607 for ; Mon, 8 Jan 2018 13:24:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C7A90160C2C; Mon, 8 Jan 2018 12:24:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 18C89160C1E for ; Mon, 8 Jan 2018 13:24:07 +0100 (CET) Received: (qmail 2292 invoked by uid 500); 8 Jan 2018 12:24:07 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 2283 invoked by uid 99); 8 Jan 2018 12:24:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2018 12:24:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id CCF17C13DD for ; Mon, 8 Jan 2018 12:24:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.711 X-Spam-Level: X-Spam-Status: No, score=-100.711 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id CN339l6wUcrh for ; Mon, 8 Jan 2018 12:24:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B6FA55F24E for ; Mon, 8 Jan 2018 12:24:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 17CD3E0352 for ; Mon, 8 Jan 2018 12:24:05 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4B792212F7 for ; Mon, 8 Jan 2018 12:24:03 +0000 (UTC) Date: Mon, 8 Jan 2018 12:24:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-8162) Kinesis Connector to report millisBehindLatest metric MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-8162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16316200#comment-16316200 ] ASF GitHub Bot commented on FLINK-8162: --------------------------------------- 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 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 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. > Kinesis Connector to report millisBehindLatest metric > ----------------------------------------------------- > > Key: FLINK-8162 > URL: https://issues.apache.org/jira/browse/FLINK-8162 > Project: Flink > Issue Type: Improvement > Components: Kinesis Connector > Reporter: Cristian > Priority: Minor > Labels: kinesis > Fix For: 1.5.0 > > Original Estimate: 24h > Remaining Estimate: 24h > > When reading from Kinesis streams, one of the most valuable metrics is "MillisBehindLatest" (see https://github.com/aws/aws-sdk-java/blob/25f0821f69bf94ec456f602f2b83ea2b0ca15643/aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesis/model/GetRecordsResult.java#L187-L201). > Flink should use its metrics mechanism to report this value as a gauge, tagging it with the shard id. -- This message was sent by Atlassian JIRA (v6.4.14#64029)