[ 
https://issues.apache.org/jira/browse/KAFKA-1723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14263211#comment-14263211
 ] 

Jay Kreps commented on KAFKA-1723:
----------------------------------

Also, I think we do need to add MetricName or something similar. Here is my 
understanding of the current data model for a metric after this change:

Name - The name of the metric, e.g. bytes-per-second
Group - A logical grouping of metrics to which this metric belongs, e.g. 
network-stats
Attributes - Further tags that refine the thing being measured such as 
client-id, node-id, or topic.

The mapping to JMX is that the package is the prefix the JMX reporter is 
configured with. The group + attributes define the Object name.  The metric 
name becomes the field name within the object.

If this is an accurate description of the patch, I think that makes sense.

A couple of issues. The prior code essentially encoded group and name into the 
name string. As a result name was assumed to be unique. In the current patch 
Metrics.java still seems to keep a global map of metrics by name, but now I 
think what is unique is not name (since the name is now just 
input-bytes-per-second but now group+attrs+name. So the map of metrics needs to 
be maintained by metric name and the Metrics apis should probably take that in 
their arguments so that the user has a reference to the proper metric name. 
This will change the public api for the producer which currently gives a map of 
metrics by their string name.

Also the intended usage of that map is to allow the user lookup metrics in it 
to build custom reporting or whatever. However if the metric name includes a 
map of attributes the lookup becomes more expensive. We should map MetricName 
immutable so that we can cache the hash code and avoid recomputing it on every 
lookup (like we do with TopicPartition).

> make the metrics name in new producer more standard
> ---------------------------------------------------
>
>                 Key: KAFKA-1723
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1723
>             Project: Kafka
>          Issue Type: Sub-task
>          Components: clients
>    Affects Versions: 0.8.2
>            Reporter: Jun Rao
>            Assignee: Manikumar Reddy
>            Priority: Blocker
>             Fix For: 0.8.2
>
>         Attachments: KAFKA-1723.patch
>
>
> The jmx name in the new producer looks like the following:
> kafka.producer.myclientid:type=mytopic
> However, this can be ambiguous since we allow "." in client id and topic.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to