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

ASF GitHub Bot commented on METRON-1005:
----------------------------------------

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

    https://github.com/apache/metron/pull/622#discussion_r127326080
  
    --- Diff: 
metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/stellar/RowKeyBuilderFactory.java
 ---
    @@ -0,0 +1,125 @@
    +/*
    + *
    + *  Licensed to the Apache Software Foundation (ASF) under one
    + *  or more contributor license agreements.  See the NOTICE file
    + *  distributed with this work for additional information
    + *  regarding copyright ownership.  The ASF licenses this file
    + *  to you under the Apache License, Version 2.0 (the
    + *  "License"); you may not use this file except in compliance
    + *  with the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + *  Unless required by applicable law or agreed to in writing, software
    + *  distributed under the License is distributed on an "AS IS" BASIS,
    + *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.
    + *  See the License for the specific language governing permissions and
    + *  limitations under the License.
    + *
    + */
    +
    +package org.apache.metron.profiler.client.stellar;
    +
    +import org.apache.commons.beanutils.PropertyUtils;
    +import org.apache.commons.lang3.ClassUtils;
    +import org.apache.metron.common.utils.ReflectionUtils;
    +import org.apache.metron.profiler.hbase.RowKeyBuilder;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.lang.reflect.InvocationTargetException;
    +import java.util.Map;
    +import java.util.concurrent.TimeUnit;
    +
    +import static 
org.apache.metron.profiler.client.stellar.ProfilerConfig.PROFILER_PERIOD;
    +import static 
org.apache.metron.profiler.client.stellar.ProfilerConfig.PROFILER_PERIOD_UNITS;
    +import static 
org.apache.metron.profiler.client.stellar.ProfilerConfig.PROFILER_ROW_KEY_BUILDER;
    +import static 
org.apache.metron.profiler.client.stellar.ProfilerConfig.PROFILER_SALT_DIVISOR;
    +
    +/**
    + * A Factory class that can create a RowKeyBuilder based on global 
property values.
    + */
    +public class RowKeyBuilderFactory {
    +
    +  private static final Logger LOG = 
LoggerFactory.getLogger(RowKeyBuilderFactory.class);
    +
    +  /**
    +   * Create a RowKeyBuilder.
    +   * @param global The global properties.
    +   * @return A RowKeyBuilder instantiated using the global property values.
    +   */
    +  public static RowKeyBuilder create(Map<String, Object> global) {
    +    String rowKeyBuilderClass = PROFILER_ROW_KEY_BUILDER.get(global, 
String.class);
    +    LOG.debug("profiler client: {}={}", PROFILER_ROW_KEY_BUILDER, 
rowKeyBuilderClass);
    +
    +    // instantiate the RowKeyBuilder
    +    RowKeyBuilder builder = 
ReflectionUtils.createInstance(rowKeyBuilderClass);
    +    setSaltDivisor(global, builder);
    +    setPeriodDuration(global, builder);
    --- End diff --
    
    I don't really like how I go about setting the salt divisor and period 
duration on the `RowKeyBuilder`.  There are no methods in the `RowKeyBuilder` 
interface to do set these values.  I could add something like 
`RowKeyBuilder.setSaltDivisor`, but I was trying not to pollute that interface 
with variables like salt divisor that may not apply to all RowKeyBuilder 
implementations.


> Create Decodable Row Key for Profiler
> -------------------------------------
>
>                 Key: METRON-1005
>                 URL: https://issues.apache.org/jira/browse/METRON-1005
>             Project: Metron
>          Issue Type: Improvement
>    Affects Versions: 0.3.0
>            Reporter: Nick Allen
>            Assignee: Nick Allen
>             Fix For: Next + 1
>
>
> To be able to answer the types of questions that I outlined in METRON-450, we 
> need a row key that is decodable.  Right now there is no logic to decode a 
> row key, nor is the existing row key easily decodable.  
> Once the row keys can be decoded, you could scan all of the row keys in the 
> Profiler's HBase table, decode each of them and extract things like, the 
> names of all your profiles, the names of entities within a profile, the 
> period duration of a given profile.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to