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

ASF GitHub Bot commented on FLINK-4245:
---------------------------------------

Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2418#discussion_r85146695
  
    --- Diff: 
flink-metrics/flink-metrics-jmx/src/main/java/org/apache/flink/metrics/jmx/JMXReporter.java
 ---
    @@ -206,27 +211,24 @@ public void notifyOfRemovedMetric(Metric metric, 
String metricName, MetricGroup
        //  Utilities 
        // 
------------------------------------------------------------------------
     
    -   static String generateJmxName(String metricName, String[] 
scopeComponents) {
    -           final StringBuilder nameBuilder = new StringBuilder(128);
    -           nameBuilder.append(PREFIX);
    -
    -           for (int x = 0; x < scopeComponents.length; x++) {
    -                   // write keyX=
    -                   nameBuilder.append(KEY_PREFIX);
    -                   nameBuilder.append(x);
    -                   nameBuilder.append("=");
    -
    -                   // write scope component
    -                   
nameBuilder.append(replaceInvalidChars(scopeComponents[x]));
    -                   nameBuilder.append(",");
    +   static Hashtable<String, String> generateJmxTable(Map<String, String> 
variables) {
    +           Hashtable<String, String> ht = new 
Hashtable<>(variables.size());
    +           for (Map.Entry<String, String> variable : variables.entrySet()) 
{
    +                   ht.put(replaceInvalidChars(variable.getKey()), 
replaceInvalidChars(variable.getValue()));
                }
    +           return ht;
    +   }
     
    -           // write the name
    -           
nameBuilder.append("name=").append(replaceInvalidChars(metricName));
    -
    -           return nameBuilder.toString();
    +   static String generateJmxDomain(String metricName, MetricGroup group) {
    +           CharacterFilter filter = new CharacterFilter() {
    --- End diff --
    
    I think this can be a single instance reused across all calls to 
"generateJmxDomain" in the JMX reporter.


> Metric naming improvements
> --------------------------
>
>                 Key: FLINK-4245
>                 URL: https://issues.apache.org/jira/browse/FLINK-4245
>             Project: Flink
>          Issue Type: Improvement
>          Components: Metrics
>            Reporter: Stephan Ewen
>
> A metric currently has two parts to it:
>   - The name of that particular metric
>   - The "scope" (or namespace), defined by the group that contains the metric.
> A metric group actually always implicitly has a map of naming "tags", like:
>   - taskmanager_host : <some-hostname>
>   - taskmanager_id : <id>
>   - task_name : "map() -> filter()"
> We derive the scope from that map, following the defined scope formats.
> For JMX (and some users that use JMX), it would be natural to expose that map 
> of tags. Some users reconstruct that map by parsing the metric scope. JMX, we 
> can expose a metric like:
>   - domain: "taskmanager.task.operator.io"
>   - name: "numRecordsIn"
>   - tags: { "hostname" -> "localhost", "operator_name" -> "map() at 
> X.java:123", ... }
> For many other reporters, the formatted scope makes a lot of sense, since 
> they think only in terms of (scope, metric-name).
> We may even have the formatted scope in JMX as well (in the domain), if we 
> want to go that route. 
> [~jgrier] and [~Zentol] - what do you think about that?
> [~mdaxini] Does that match your use of the metrics?



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

Reply via email to