enrich icon indicating copy to clipboard operation
enrich copied to clipboard

Common: explore user-defined enrichments

Open chuwy opened this issue 5 years ago • 1 comments
trafficstars

First attempt: https://github.com/snowplow/snowplow/commit/61ad6f9bfaea7299b21d579289782e54f59c141d#commitcomment-13187113

The current idea is to have users create a class extending IUserEnrichment defining a method which takes an EnrichedEvent and returns Unit, i.e. it mutates the EnrichedEvent in place.

They would specify in the configuration where those classes can be found, what the name of the class is, and whether each class is enabled:

[
  {
    "class": "com.acme.CustomEnrichment",
    "url": "s3://path/to/customenrichment.jar",
    "enabled": true
  }
]

Each enabled class would then be loaded and instantiated at runtime.

Possible extension to this: the method could be given as additional argument json4s objects containing all contexts and unstructured event JSONs, so that users don't have to deserialize the EnrichedEvent JSON strings.

Additionally, the method could optionally derived contexts json4s objects.

chuwy avatar Jun 20 '20 10:06 chuwy

Migrated from https://github.com/snowplow/snowplow/issues/2054 (comments are auto-generated)

chuwy avatar Jun 20 '20 10:06 chuwy