Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/334#discussion_r86206259
--- Diff:
metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/stellar/GetProfile.java
---
@@ -226,14 +262,23 @@ private ColumnBuilder getColumnBuilder(Map<String,
Object> global) {
* @param global The global configuration.
*/
private RowKeyBuilder getRowKeyBuilder(Map<String, Object> global) {
- /*
- * WARNING: the row key builder is not currently configurable. by
invoking
- * the default constructor below, this defaults to generating keys
using a
- * period duration of 15 minutes. this function will NOT be able to
read
- * profiles created by a profiler running with any other period
duration, but
- * 15 minutes.
- */
- return new SaltyRowKeyBuilder();
+
+ // how long is the profile period?
+ String configuredDuration = (String)
global.getOrDefault(PROFILER_PERIOD, PROFILER_PERIOD_DEFAULT);
+ long duration = Long.parseLong(configuredDuration);
+ LOG.debug("profiler client: {}={}", PROFILER_PERIOD, duration);
+
+ // which units are used to define the profile period?
+ String configuredUnits = (String)
global.getOrDefault(PROFILER_PERIOD_UNITS, PROFILER_PERIOD_UNITS_DEFAULT);
+ TimeUnit units = TimeUnit.valueOf(configuredUnits);
+ LOG.debug("profiler client: {}={}", PROFILER_PERIOD_UNITS, units);
+
+ // what is the salt divisor?
+ String configuredSaltDivisor = (String)
global.getOrDefault(PROFILER_SALT_DIVISOR, PROFILER_SALT_DIVISOR_DEFAULT);
+ int saltDivisor = Integer.parseInt(configuredSaltDivisor);
+ LOG.debug("profiler client: {}={}", PROFILER_SALT_DIVISOR,
saltDivisor);
+
+ return new SaltyRowKeyBuilder(saltDivisor, duration, units);
--- End diff --
I think what you are saying makes total sense. It is a good idea. We
should have it. I'd prefer to do it as a follow-on JIRA though. Hey, maybe
you could follow-on with your 'whomp'. Ha.
The one problem in doing it is due to the signature of PROFILE_GET. It
would be ideal to add the period duration, etc as arguments towards the end of
the function. That way the user can decide to pass in those additional args
like duration or not. I'd hate to require the user to pass it in.
The problem is that the last argument is effectively a var arg of the group
names. That makes it difficult to do what you are asking. How do you think we
could work around that?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---