You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by cestella <gi...@git.apache.org> on 2017/06/21 20:10:09 UTC

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

GitHub user cestella opened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [ ] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [ ] Have you written or updated unit tests and or integration tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

commit e04c1ff142ec81b023a0ce9b3b8998521e12a306
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T19:36:16Z

    Trying to avoid the skadoo of death.

commit 0268d7e333c0595ce3b357c5263b3715b0761827
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T20:00:12Z

    The spout is too sensitive.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123512057
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -118,6 +116,27 @@ protected void initializeStellar() {
         StellarFunctions.initialize(stellarContext);
       }
     
    +  private Map<String, Object> getMetadata(Tuple t, boolean readMetadata) {
    +    Map<String, Object> ret = new HashMap<>();
    +    if(!readMetadata) {
    +      return ret;
    +    }
    +    ret.put(SimpleStormKafkaBuilder.FieldsConfiguration.TOPIC.getFieldName(), t.getString(2));
    --- End diff --
    
    The contract is that the value is the first element in the tuple, the key the 2nd element in the tuple and any metadata from the environment passed in after 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123514965
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyBuilder.java ---
    @@ -132,7 +132,14 @@ public static TopologyBuilder build(String zookeeperUrl,
         if(securityProtocol.isPresent()) {
           kafkaSpoutConfigOptions.putIfAbsent("security.protocol", securityProtocol.get());
         }
    -    return SimpleStormKafkaBuilder.create(inputTopic, zkQuorum, Arrays.asList("value"), kafkaSpoutConfigOptions);
    +    return SimpleStormKafkaBuilder.create( inputTopic
    --- End diff --
    
    fine by me. :)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123413205
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyBuilder.java ---
    @@ -132,7 +132,14 @@ public static TopologyBuilder build(String zookeeperUrl,
         if(securityProtocol.isPresent()) {
           kafkaSpoutConfigOptions.putIfAbsent("security.protocol", securityProtocol.get());
         }
    -    return SimpleStormKafkaBuilder.create(inputTopic, zkQuorum, Arrays.asList("value"), kafkaSpoutConfigOptions);
    +    return SimpleStormKafkaBuilder.create( inputTopic
    --- End diff --
    
    This seems likely to have conflict.  The assumption that these simple names may never already be a part of a message.  In general, the metadata is nebulous.  The metadata fields should be prefixed and discoverable by other processes, without knowing before hand.
    
    Some call Map<?,?> getMetadata(JSONObject message) should be implementable without hard coding.
    



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123594763
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -52,6 +50,8 @@
     
     public class ParserBolt extends ConfiguredParserBolt implements Serializable {
     
    +  private static final int KEY_INDEX = 1;
    +  private static final String METADATA_PREFIX = "metron.metadata.";
    --- End diff --
    
    yeah, another good suggestion.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

commit e04c1ff142ec81b023a0ce9b3b8998521e12a306
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T19:36:16Z

    Trying to avoid the skadoo of death.

commit 0268d7e333c0595ce3b357c5263b3715b0761827
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T20:00:12Z

    The spout is too sensitive.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #621: METRON-1001: Allow metron to ingest parser metadata along...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/621
  
    Hopefully the addition of documentation and a comprehensive test plan will help soothe the rest of the confusion here.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123514768
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyBuilder.java ---
    @@ -132,7 +132,14 @@ public static TopologyBuilder build(String zookeeperUrl,
         if(securityProtocol.isPresent()) {
           kafkaSpoutConfigOptions.putIfAbsent("security.protocol", securityProtocol.get());
         }
    -    return SimpleStormKafkaBuilder.create(inputTopic, zkQuorum, Arrays.asList("value"), kafkaSpoutConfigOptions);
    +    return SimpleStormKafkaBuilder.create( inputTopic
    --- End diff --
    
    metron.metadata



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #621: METRON-1001: Allow metron to ingest parser metadata along...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/621
  
    # TESTING PLAN
    
    Testing Instructions beyond the normal smoke test (i.e. letting data
    flow through to the indices and checking them).
    
    # Preliminaries
    
    Since I will use the squid topology to pass data through in a controlled
    way, we must install squid and generate one point of data:
    * `yum install -y squid`
    * `service squid start`
    * `squidclient http://www.yahoo.com`
    
    Also, set an environment variable to indicate `METRON_HOME`:
    * `export METRON_HOME=/usr/metron/0.4.0` 
    
    # Deploy the squid parser
    * Create the squid kafka topic: `/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper node1:2181 --create --topic squid --partitions 1 --replication-factor 1`
    * Start via `$METRON_HOME/bin/start_parser_topology.sh -k node1:6667 -z node1:2181 -s squid`
    
    # Test Cases
    
    ## Test Case 1: Base Case
    * Send squid data through: `cat /var/log/squid/access.log | /usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list node1:6667 --topic squid`
    * Validate that the message goes through with no fields prefixed with `metadata`: `curl -XPOST 'http://localhost:9200/squid*/_search?pretty'`
    
    ## Test Case 2: Validate Environmental Metadata is available
    * Modify `$METRON_HOME/config/zookeeper/parsers/squid.json` and turn on
      metadata reading:
    ```
    {
      "parserClassName": "org.apache.metron.parsers.GrokParser",
      "sensorTopic": "squid",
      "readMetadata" : true,
      "parserConfig": {
        "grokPath": "/patterns/squid",
        "patternLabel": "SQUID_DELIMITED",
        "timestampField": "timestamp"
      },
      "fieldTransformations" : [
        {
          "transformation" : "STELLAR"
        ,"output" : [ "full_hostname", "domain_without_subdomains", "kafka_topic" ]
        ,"config" : {
          "full_hostname" : "URL_TO_HOST(url)"
          ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
          ,"kafka_topic" : "TO_UPPER(metron.metadata.topic)"
                    }
        }
                               ]
    }
    ```
    * Persist config changes: `$METRON_HOME/bin/zk_load_configs.sh -m PUSH -i $METRON_HOME/config/zookeeper -z node1:2181`
    * Clear indices: `curl -XDELETE "http://localhost:9200/squid*"`
    * Send squid data through: `cat /var/log/squid/access.log | /usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list node1:6667 --topic squid`
    * Validate that the message goes through with a `kafka_topic` field of `SQUID`: 
    ```
    curl -XPOST 'http://localhost:9200/squid*/_search?pretty' -d '
    {
      "_source" : [ "kafka_topic" ]
    }
    '
    ```
    ## Test Case 3: Validate Environmental Metadata is available and is able to be merged
    * Modify `$METRON_HOME/config/zookeeper/parsers/squid.json` and turn on
      metadata reading and merging:
    ```
    {
      "parserClassName": "org.apache.metron.parsers.GrokParser",
      "sensorTopic": "squid",
      "readMetadata" : true,
      "mergeMetadata" : true,
      "parserConfig": {
        "grokPath": "/patterns/squid",
        "patternLabel": "SQUID_DELIMITED",
        "timestampField": "timestamp"
      },
      "fieldTransformations" : [
        {
          "transformation" : "STELLAR"
        ,"output" : [ "full_hostname", "domain_without_subdomains", "kafka_topic" ]
        ,"config" : {
          "full_hostname" : "URL_TO_HOST(url)"
          ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
          ,"kafka_topic" : "TO_UPPER(metron.metadata.topic)"
                    }
        }
                               ]
    }
    ```
    * Persist config changes: `$METRON_HOME/bin/zk_load_configs.sh -m PUSH -i $METRON_HOME/config/zookeeper -z node1:2181`
    * Clear indices: `curl -XDELETE "http://localhost:9200/squid*"`
    * Send squid data through: `cat /var/log/squid/access.log | /usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list node1:6667 --topic squid`
    * Validate that the message goes through with a `kafka_topic` field of `SQUID` and `metron:metadata:topic` of `squid`: 
    ```
    curl -XPOST 'http://localhost:9200/squid*/_search?pretty' -d '
    {
      "_source" : [ "kafka_topic", "metron:metadata:topic" ]
    }
    '
    ```
    ## Test Case 3: Validate Custom Metadata is available 
    We're going to send a custom JSON Map containing metadata along in the key.  The map will have one value `customer_id`
    * Modify `$METRON_HOME/config/zookeeper/parsers/squid.json` and turn on
      metadata reading and turn off merging.  Also, emit a new field called `customer_id` in the field transformation:
    ```
    {
      "parserClassName": "org.apache.metron.parsers.GrokParser",
      "sensorTopic": "squid",
      "readMetadata" : true,
      "mergeMetadata" : false,
      "parserConfig": {
        "grokPath": "/patterns/squid",
        "patternLabel": "SQUID_DELIMITED",
        "timestampField": "timestamp"
      },
      "fieldTransformations" : [
        {
          "transformation" : "STELLAR"
        ,"output" : [ "full_hostname", "domain_without_subdomains", "kafka_topic", "customer_id"]
        ,"config" : {
          "full_hostname" : "URL_TO_HOST(url)"
          ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
          ,"kafka_topic" : "TO_UPPER(metron.metadata.topic)"
          ,"customer_id" : "TO_UPPER(metron.metadata.customer_id)"
                    }
        }
                               ]
    }
    ```
    * Persist config changes: `$METRON_HOME/bin/zk_load_configs.sh -m PUSH -i $METRON_HOME/config/zookeeper -z node1:2181`
    * Clear indices: `curl -XDELETE "http://localhost:9200/squid*"`
    * Send squid data through: `IFS=$'\n';for i in $(cat /var/log/squid/access.log);do METADATA="{\"customer_id\" : \"cust2\"}"; echo $METADATA\;$i;done | /usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list node1:6667 --topic squid --property="parse.key=true" --property "key.separator=;"` 
    * Validate that the message goes through with a `kafka_topic` field of `SQUID` and `customer_id` of `CUST2`: 
    ```
    curl -XPOST 'http://localhost:9200/squid*/_search?pretty' -d '
    {
      "_source" : [ "kafka_topic", "customer_id" ]
    }
    '
    ```
    ## Test Case 4: Validate Custom Metadata is available and able to be merged
    We're going to send a custom JSON Map containing metadata along in the key.  The map will have one value `customer_id`
    * Modify `$METRON_HOME/config/zookeeper/parsers/squid.json` and turn on
      metadata reading and turn back on merging.  Also, emit a custom metadata field called `customer_id` in the field transformation:
    ```
    {
      "parserClassName": "org.apache.metron.parsers.GrokParser",
      "sensorTopic": "squid",
      "readMetadata" : true,
      "mergeMetadata" : true,
      "parserConfig": {
        "grokPath": "/patterns/squid",
        "patternLabel": "SQUID_DELIMITED",
        "timestampField": "timestamp"
      },
      "fieldTransformations" : [
        {
          "transformation" : "STELLAR"
        ,"output" : [ "full_hostname", "domain_without_subdomains", "kafka_topic", "customer_id"]
        ,"config" : {
          "full_hostname" : "URL_TO_HOST(url)"
          ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
          ,"kafka_topic" : "TO_UPPER(metron.metadata.topic)"
          ,"customer_id" : "TO_UPPER(metron.metadata.customer_id)"
                    }
        }
                               ]
    }
    ```
    * Persist config changes: `$METRON_HOME/bin/zk_load_configs.sh -m PUSH -i $METRON_HOME/config/zookeeper -z node1:2181`
    * Clear indices: `curl -XDELETE "http://localhost:9200/squid*"`
    * Send squid data through: `IFS=$'\n';for i in $(cat /var/log/squid/access.log);do METADATA="{\"customer_id\" : \"cust2\"}"; echo $METADATA\;$i;done | /usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list node1:6667 --topic squid --property="parse.key=true" --property "key.separator=;"` 
    * Validate that the message goes through with a `kafka_topic` field of `SQUID` `metron:metadata:customer_id` of `cust2` and `customer_id` of `CUST2`: 
    ```
    curl -XPOST 'http://localhost:9200/squid*/_search?pretty' -d '
    {
      "_source" : [ "kafka_topic", "customer_id", "metron:metadata:customer_id" ]
    }
    '
    ```
    



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123513501
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -129,18 +148,29 @@ public void execute(Tuple tuple) {
           boolean ackTuple = !writer.handleAck();
           int numWritten = 0;
           if(sensorParserConfig != null) {
    +        Map<String, Object> metadata = getMetadata(tuple, sensorParserConfig.readMetadata());
             List<FieldValidator> fieldValidations = getConfigurations().getFieldValidations();
             Optional<List<JSONObject>> messages = parser.parseOptional(originalMessage);
             for (JSONObject message : messages.orElse(Collections.emptyList())) {
               message.put(Constants.SENSOR_TYPE, getSensorType());
    --- End diff --
    
    Will the metadata in parsing be able to be used in enrichment? Can it stay metadata and just keep going along or does it have to be merged with the message? 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #621: METRON-1001: Allow metron to ingest parser metadata along...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/621
  
    @justinleet any other comments or concerns?



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r126156447
  
    --- Diff: metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java ---
    @@ -176,16 +182,48 @@ public SimpleStormKafkaBuilder( Map<String, Object> kafkaProps
                                     , List<String> fieldsConfiguration
                                     )
       {
    +    this(kafkaProps, toSubscription(topic), zkQuorum, fieldsConfiguration);
    +  }
    +
    +  /**
    +   * Create an object with the specified properties and exposing the specified fields.
    +   * @param kafkaProps The special kafka properties
    +   * @param subscription The subscription to the kafka topic(s)
    +   * @param zkQuorum The zookeeper quorum.  We will use this to pull the brokers from this.
    +   * @param fieldsConfiguration The fields to expose in the storm tuple emitted.
    +   */
    +  public SimpleStormKafkaBuilder( Map<String, Object> kafkaProps
    +                                , Subscription subscription
    +                                , String zkQuorum
    +                                , List<String> fieldsConfiguration
    +                                )
    +  {
         super( getBootstrapServers(zkQuorum, kafkaProps)
              , createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG)), DEFAULT_DESERIALIZER)
              , createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG)), DEFAULT_DESERIALIZER)
    -         , topic
    +         , subscription
         );
         setProp(kafkaProps);
         setRecordTranslator(new SpoutRecordTranslator<>(FieldsConfiguration.toList(fieldsConfiguration)));
    -    this.topic = topic;
       }
     
    +
    +  private static Subscription toSubscription(String topicOrSubscription) {
    +    if (StringUtils.isEmpty(topicOrSubscription)) {
    +      throw new IllegalStateException("Topic name is invalid: empty or null");
    --- End diff --
    
    Could you make this IllegalArgumentException? It also might be nice to include the value itself, because empty vs null seem like they could come up in different ways.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123512796
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -129,18 +148,29 @@ public void execute(Tuple tuple) {
           boolean ackTuple = !writer.handleAck();
           int numWritten = 0;
           if(sensorParserConfig != null) {
    +        Map<String, Object> metadata = getMetadata(tuple, sensorParserConfig.readMetadata());
             List<FieldValidator> fieldValidations = getConfigurations().getFieldValidations();
             Optional<List<JSONObject>> messages = parser.parseOptional(originalMessage);
             for (JSONObject message : messages.orElse(Collections.emptyList())) {
               message.put(Constants.SENSOR_TYPE, getSensorType());
    --- End diff --
    
    * If you turn on parsing metadata and do not indicate to merge the metadata, it will be available to stellar field transformations.
    * If you turn on parsing metadata and *do* indicate that you wish to merge the metadata, it will be both merged and available to stellar field transformations.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123524476
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -52,6 +50,8 @@
     
     public class ParserBolt extends ConfiguredParserBolt implements Serializable {
     
    +  private static final int KEY_INDEX = 1;
    +  private static final String METADATA_PREFIX = "metron.metadata.";
    --- End diff --
    
    This should somewhere in common.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

commit e04c1ff142ec81b023a0ce9b3b8998521e12a306
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T19:36:16Z

    Trying to avoid the skadoo of death.

commit 0268d7e333c0595ce3b357c5263b3715b0761827
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T20:00:12Z

    The spout is too sensitive.

commit 86e56ca2ebddf499c26a40d9f674a0513317bc74
Author: cstella <ce...@gmail.com>
Date:   2017-06-26T11:33:30Z

    Cleaning up better.

commit 507bfa317dc4007ba0ba51bf0ec8bf9addb38be3
Author: cstella <ce...@gmail.com>
Date:   2017-06-26T11:35:53Z

    Too aggressive.

commit b404e10d10bd0b59243c7f19f0ad900415b9dbba
Author: cstella <ce...@gmail.com>
Date:   2017-06-26T13:41:16Z

    Updating to only remove our repo entries.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123412881
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -129,18 +148,29 @@ public void execute(Tuple tuple) {
           boolean ackTuple = !writer.handleAck();
           int numWritten = 0;
           if(sensorParserConfig != null) {
    +        Map<String, Object> metadata = getMetadata(tuple, sensorParserConfig.readMetadata());
             List<FieldValidator> fieldValidations = getConfigurations().getFieldValidations();
             Optional<List<JSONObject>> messages = parser.parseOptional(originalMessage);
             for (JSONObject message : messages.orElse(Collections.emptyList())) {
               message.put(Constants.SENSOR_TYPE, getSensorType());
    --- End diff --
    
    Is this merged data indexed?  Optionally indexed ( IE: available to processing and stellar but stripped before indexing )?



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #621: METRON-1001: Allow metron to ingest parser metadata along...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on the issue:

    https://github.com/apache/metron/pull/621
  
    Merging master in to get the unit tests to run.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123411616
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -118,6 +116,27 @@ protected void initializeStellar() {
         StellarFunctions.initialize(stellarContext);
       }
     
    +  private Map<String, Object> getMetadata(Tuple t, boolean readMetadata) {
    +    Map<String, Object> ret = new HashMap<>();
    +    if(!readMetadata) {
    +      return ret;
    +    }
    +    ret.put(SimpleStormKafkaBuilder.FieldsConfiguration.TOPIC.getFieldName(), t.getString(2));
    --- End diff --
    
    What are these magic numbers 2 and 1 ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by ottobackwards <gi...@git.apache.org>.
Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123412506
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -118,6 +116,27 @@ protected void initializeStellar() {
         StellarFunctions.initialize(stellarContext);
       }
     
    +  private Map<String, Object> getMetadata(Tuple t, boolean readMetadata) {
    +    Map<String, Object> ret = new HashMap<>();
    +    if(!readMetadata) {
    +      return ret;
    +    }
    --- End diff --
    
    Why is this tied to Kafka?  The ParserBolt is not, or was not before.  The 'kafka-ness' of this should be abstracted away.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [ ] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [ ] Have you written or updated unit tests and or integration tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123511908
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -118,6 +116,27 @@ protected void initializeStellar() {
         StellarFunctions.initialize(stellarContext);
       }
     
    +  private Map<String, Object> getMetadata(Tuple t, boolean readMetadata) {
    +    Map<String, Object> ret = new HashMap<>();
    +    if(!readMetadata) {
    +      return ret;
    +    }
    --- End diff --
    
    Yeah, I agree, I think I can pick this apart a bit.  Good feedback.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123513984
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/bolt/ParserBolt.java ---
    @@ -129,18 +148,29 @@ public void execute(Tuple tuple) {
           boolean ackTuple = !writer.handleAck();
           int numWritten = 0;
           if(sensorParserConfig != null) {
    +        Map<String, Object> metadata = getMetadata(tuple, sensorParserConfig.readMetadata());
             List<FieldValidator> fieldValidations = getConfigurations().getFieldValidations();
             Optional<List<JSONObject>> messages = parser.parseOptional(originalMessage);
             for (JSONObject message : messages.orElse(Collections.emptyList())) {
               message.put(Constants.SENSOR_TYPE, getSensorType());
    --- End diff --
    
    If you merge it with the message or selectively expose them as stellar transformations, then they will be.  It does not have to be merged.  By default, merging is turned off and things work just as before.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r126377527
  
    --- Diff: metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java ---
    @@ -176,16 +182,48 @@ public SimpleStormKafkaBuilder( Map<String, Object> kafkaProps
                                     , List<String> fieldsConfiguration
                                     )
       {
    +    this(kafkaProps, toSubscription(topic), zkQuorum, fieldsConfiguration);
    +  }
    +
    +  /**
    +   * Create an object with the specified properties and exposing the specified fields.
    +   * @param kafkaProps The special kafka properties
    +   * @param subscription The subscription to the kafka topic(s)
    +   * @param zkQuorum The zookeeper quorum.  We will use this to pull the brokers from this.
    +   * @param fieldsConfiguration The fields to expose in the storm tuple emitted.
    +   */
    +  public SimpleStormKafkaBuilder( Map<String, Object> kafkaProps
    +                                , Subscription subscription
    +                                , String zkQuorum
    +                                , List<String> fieldsConfiguration
    +                                )
    +  {
         super( getBootstrapServers(zkQuorum, kafkaProps)
              , createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG)), DEFAULT_DESERIALIZER)
              , createDeserializer(Optional.ofNullable((String)kafkaProps.get(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG)), DEFAULT_DESERIALIZER)
    -         , topic
    +         , subscription
         );
         setProp(kafkaProps);
         setRecordTranslator(new SpoutRecordTranslator<>(FieldsConfiguration.toList(fieldsConfiguration)));
    -    this.topic = topic;
       }
     
    +
    +  private static Subscription toSubscription(String topicOrSubscription) {
    +    if (StringUtils.isEmpty(topicOrSubscription)) {
    +      throw new IllegalStateException("Topic name is invalid: empty or null");
    --- End diff --
    
    Yep, done.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [ ] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [ ] Have you written or updated unit tests and or integration tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella closed the pull request at:

    https://github.com/apache/metron/pull/621


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron issue #621: METRON-1001: Allow metron to ingest parser metadata along...

Posted by justinleet <gi...@git.apache.org>.
Github user justinleet commented on the issue:

    https://github.com/apache/metron/pull/621
  
    @cestella Nope, I'm good, +1.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/621#discussion_r123512990
  
    --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyBuilder.java ---
    @@ -132,7 +132,14 @@ public static TopologyBuilder build(String zookeeperUrl,
         if(securityProtocol.isPresent()) {
           kafkaSpoutConfigOptions.putIfAbsent("security.protocol", securityProtocol.get());
         }
    -    return SimpleStormKafkaBuilder.create(inputTopic, zkQuorum, Arrays.asList("value"), kafkaSpoutConfigOptions);
    +    return SimpleStormKafkaBuilder.create( inputTopic
    --- End diff --
    
    I think that prefixing the names of the metadata with `metadata.` would correct that, I think.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

commit e04c1ff142ec81b023a0ce9b3b8998521e12a306
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T19:36:16Z

    Trying to avoid the skadoo of death.

commit 0268d7e333c0595ce3b357c5263b3715b0761827
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T20:00:12Z

    The spout is too sensitive.

commit 86e56ca2ebddf499c26a40d9f674a0513317bc74
Author: cstella <ce...@gmail.com>
Date:   2017-06-26T11:33:30Z

    Cleaning up better.

commit 507bfa317dc4007ba0ba51bf0ec8bf9addb38be3
Author: cstella <ce...@gmail.com>
Date:   2017-06-26T11:35:53Z

    Too aggressive.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----
commit a4e85398e28f926682396d4828b7a6fdfbeefb33
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T19:59:52Z

    METRON-1001: Allow metron to ingest parser metadata along with data

commit 26b0422d16c1e330bc2a5e39d7ae80b0837ac3a3
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T20:10:35Z

    turned off ALL metadata reading unless specified.

commit 2ab442757696bf60db82cab43c9790de2eb0def9
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:04:28Z

    Avoid partitioners that use subscribe rather than assign.

commit 0115d877a66c09e33de75cecddb999bbbdc3be8f
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:11:28Z

    Boo, bad storm, partitioners should be serializable.

commit 30830850e79934399508063dbd9b6d9c02524cfa
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:16:15Z

    Reverted to non-manual.  That deserves a separate PR.

commit 5b840a8df11f8e04571752f6e0b2fe9d5abfab0a
Author: cstella <ce...@gmail.com>
Date:   2017-06-21T22:34:09Z

    Updating test.

commit 281779b4ab4b1d663e8bcf4a20194fd3ecf226e2
Author: cstella <ce...@gmail.com>
Date:   2017-06-22T14:13:09Z

    Reacting to Otto's comments: generalized from being kafka-specific

commit 5e383099e99c5db6a1a7cc907e52f45da812ab61
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T00:23:22Z

    Moved constants out.

commit ed03677dfcd4cc3616653aefc1645e8a5414c56d
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:03:54Z

    avoid NPE if possible. heh

commit 6ebfcc05cac0a41d22d06b633007f46012201d25
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T01:35:47Z

    Updated readme

commit 902805b3ea78be0c362f6167dde730453d499455
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T13:23:47Z

    Killing with slightly more prejudice than otherwise.

commit e04c1ff142ec81b023a0ce9b3b8998521e12a306
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T19:36:16Z

    Trying to avoid the skadoo of death.

commit 0268d7e333c0595ce3b357c5263b3715b0761827
Author: cstella <ce...@gmail.com>
Date:   2017-06-23T20:00:12Z

    The spout is too sensitive.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] metron pull request #621: METRON-1001: Allow metron to ingest parser metadat...

Posted by cestella <gi...@git.apache.org>.
GitHub user cestella reopened a pull request:

    https://github.com/apache/metron/pull/621

    METRON-1001: Allow metron to ingest parser metadata along with data

    ## Contributor Comments
    Currently, we only ingest data in Metron. Often, there is valuable metadata constructed up-stream of Metron that is relevant to enrichment and cross-cuts many data formats. Take, for instance, a multi-tenancy case where multiple sources come in and you'd like to tag the data with the customer ID. In this case you're stuck finding ways to add the metadata to each data source's format. Rather than do that, we should allow metadata to be ingested along with the data associated with it.
    
    There are two sources of metadata relevant to support:
    * User defined metadata (e.g. customer IDs)
    * Environmental metadata (e.g. the kafka topic)
    
    In this PR, metadata can be expressed and passed into metron in two manners:
    * As a JSON Map in the key of the message (optional)
    * The kafka topic written.
    
    Metadata is exposed in two ways:
    * As stellar variables for Stellar field transformations
    * Optionally, automatically merged with the message
    
    Two properties were added to the parser config:
    * `mergeMetadata` - default false.  If true, then metadata is merged with the message.
    * `readMetadata` - default false.  If true, then user and environmental metadata are attempted to be read.
    
    Note: This is backwards compatible, so by default, unless specified, your parser topologies will function as before.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
      ```
      mvn -q clean integration-test install && build_utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cestella/incubator-metron METRON-1001

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/621.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #621
    
----

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---