Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AAEC1200B40 for ; Fri, 1 Jul 2016 12:28:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A9A6D160A6C; Fri, 1 Jul 2016 10:28:17 +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 2BD4A160A61 for ; Fri, 1 Jul 2016 12:28:17 +0200 (CEST) Received: (qmail 83868 invoked by uid 500); 1 Jul 2016 10:28:11 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 83843 invoked by uid 99); 1 Jul 2016 10:28:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2016 10:28:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 1D61A2C02A0 for ; Fri, 1 Jul 2016 10:28:11 +0000 (UTC) Date: Fri, 1 Jul 2016 10:28:11 +0000 (UTC) From: "Igor Stepanov (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (KAFKA-3923) MetricReporter interface depends on final class KafkaMetric instead of Metric interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 01 Jul 2016 10:28:17 -0000 Igor Stepanov created KAFKA-3923: ------------------------------------ Summary: MetricReporter interface depends on final class KafkaMetric instead of Metric interface Key: KAFKA-3923 URL: https://issues.apache.org/jira/browse/KAFKA-3923 Project: Kafka Issue Type: Improvement Components: clients Reporter: Igor Stepanov Hello, I'm working on exposing Kafka's consumer/producer metrics to Spring Actuator. To achieve this, I've implemented Kafka's MetricReporter interface to allow injecting it into the appropriate consumer/producer. No issues with implementation itself, fine for me. But now I've moved to writing unit tests for this implementation and decided to use mocked KafkaMetric instances for this. But mocking of KafkaMetric itself is not so plain - the class is final. The logical step is to use Metric interface for mocking, but MetricReporter accepts only KafkaMetric. I know that technically I can use PowerMock and most probably it will work fine in this case, but talking about Kafka itself, is it a good approach to depend on the exact implementation when interface fulfils most of the needs? -- This message was sent by Atlassian JIRA (v6.3.4#6332)