GitHub user cestella opened a pull request:
https://github.com/apache/incubator-metron/pull/468
METRON-744: Allow Stellar functions to be loaded from HDFS
## Description
The benefit of Stellar is that adding new functionality is as simple as
providing a Jar. This enables people who want to integrate with Metron to easy
add enrichments or other functionality. The snag currently with this is that we
provide a single jar, so all stellar functions that we have available must be
dependencies of the main jar that drives the topology plus what local
directories we can configure via the storm configs. This makes the process of
adding 3rd party jars not as easy as it could be.
Adjust the the following to additionally load classes from a location in
HDFS /apps/metron/stellar using something like accumulo (
https://accumulo.apache.org/blog/2014/05/03/accumulo-classloader.html)
* Profiler topology
* Parser topology
* Enrichment topology
* Enrichment Flat file loader
* Enrichment MR loader
One thing to note about this PR is that we shift the way that we load
classes from the classpath. We now use
[ClassIndex](https://github.com/atteo/classindex) instead of Reflections. This
means that stellar classes are found by analyzing a file dropped in META-INF.
This has a couple of advantages:
* Blazing fast function loading because we're iterating over every jar, not
every class. So fast, there is no noticeable delay for me in starting the REPL.
* Reflections had some serious issues with non-default classloaders that we
ran into
For the Stellar function author, this has no impact to you. You just use
the annotation and make sure to depend on metron-common (provided dependency)
and the file in META-INF is automatically added.
## Testing Plan
TODO
### 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
```
- [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
bin/generate-md.sh
mvn site: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 recommened 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 loader_test
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-metron/pull/468.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 #468
----
commit 6da8baa421ac416eea6bb13717ae883cfd3d8937
Author: cstella <[email protected]>
Date: 2017-02-27T22:50:07Z
UPdating parser to use a custom classloader.
commit 269950caafa9919c113e04faf743381377f49a62
Author: cstella <[email protected]>
Date: 2017-02-28T04:56:13Z
Got VFS and everything integrated.
commit 7c1b1d9df842ffd1ebc0ca2a860471bde6b74f9d
Author: cstella <[email protected]>
Date: 2017-02-28T05:23:19Z
Updating poms.
commit 1fa5c40cfd7016c3cf44fcc1a508cbd96e0bc2ba
Author: cstella <[email protected]>
Date: 2017-02-28T06:33:33Z
Added integration test.
commit 0e6bc70fcb4ca49d551ec78b49fb57e9da31f210
Author: cstella <[email protected]>
Date: 2017-02-28T06:55:25Z
Updating to just depend on accumulo directly
commit b1d21740e197891de369ffcddb4a543e272cd695
Author: cstella <[email protected]>
Date: 2017-02-28T06:57:43Z
Whoops, forgot dependency.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---