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

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

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

    https://github.com/apache/metron/pull/1209#discussion_r220587103
  
    --- Diff: 
metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeOnlyClockFactory.java
 ---
    @@ -0,0 +1,58 @@
    +/*
    + * 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.clock;
    +
    +import org.apache.metron.common.configuration.profiler.ProfilerConfig;
    +
    +import java.io.Serializable;
    +
    +/**
    + * Creates a {@link Clock} based on the profiler configuration.  This 
should
    + * be used in cases where only event time is accceptable.
    + *
    + * <p>If the Profiler is configured to use event time, a {@link 
EventTimeClock} will
    + * be created.  Otherwise, an {@link IllegalStateException} is thrown.
    + */
    +public class EventTimeOnlyClockFactory implements ClockFactory, 
Serializable {
    +
    +  /**
    +   * If the Profiler is configured to use event time, a {@link 
EventTimeClock} is created.
    +   * Otherwise, an {@link IllegalArgumentException} is thrown.
    +   *
    +   * @param config The profiler configuration.
    +   * @return The appropriate Clock based on the profiler configuration.
    +   * @throws IllegalStateException If the profiler configuration is set to 
system time.
    +   */
    +  @Override
    +  public Clock createClock(ProfilerConfig config) {
    +    Clock clock;
    +
    +    boolean isEventTime = config.getTimestampField().isPresent();
    +    if(isEventTime) {
    +      String timestampField = config.getTimestampField().get();
    +      clock = new EventTimeClock(timestampField);
    --- End diff --
    
    Actually, I can't serialize the Context and Stellar initialization, so I 
don't think I can change how the `MessageRouter` is setup. 
    
    I think what I have in this FB satisfies your feedback.  Let me know if 
there is anything you think can be improved.


> Input Time Constraints for Batch Profiler
> -----------------------------------------
>
>                 Key: METRON-1787
>                 URL: https://issues.apache.org/jira/browse/METRON-1787
>             Project: Metron
>          Issue Type: Sub-task
>            Reporter: Nick Allen
>            Assignee: Nick Allen
>            Priority: Major
>
> A user should be able to constrain the input telemetry based on time.  The 
> user might optionally provide a --begin and/or --end command line argument 
> that defines the time window.
>  
> This was originally [discussed on the mailing 
> list|https://lists.apache.org/thread.html/39b5636c9ae264611aa8aecc426b649682efaf1bd0755848a90ee6b9@%3Cdev.metron.apache.org%3E].



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to