Unable to parse custom events

30 views
Skip to first unread message

sridh...@gmail.com

unread,
Oct 4, 2018, 4:42:52 PM10/4/18
to divolte-collector
Hi,
Just installed divolte and out of the box getting the default parameters working with no problem.
But unable to parse custom events.Even couldn't get the basic examples from documentation to work. Stuck on this for 3 days. please help.

Added following to Avsc:
        { "name": "fooField",                "type": ["null", "string"], "default": null},
        { "name": "barField",                "type": ["null", "int"], "default": null}

Added following to Groovy:
map eventParameters().value('foo') onto 'fooField'
map { parse eventParameters().value('bar') to int32 } onto 'barField'

And javascript call:
divolte.signal('myEvent', { foo: 'hello', bar: 42 });


The eventType is coming as expected. But the fooField and barField are coming null.
"eventType":"myEvent",
"fooField":null,"barField":null

Please any help greatly appreciated

Thanks,
Sridhar



andre...@godatadriven.com

unread,
Oct 5, 2018, 3:25:12 AM10/5/18
to divolte-collector
Hi Sridhar,

At a glance that looks like it should work. Some simple things to check:
  • Anything in the divolte log files? Mapping issues sometimes turn up there.
  • Are you sure you're trying to decode the correct data and not earlier records? To check, try changing the event type.
You also didn't mention what type of sink you're using.

Cheers,

Andrew

sridh...@gmail.com

unread,
Oct 5, 2018, 12:30:24 PM10/5/18
to divolte-collector
Hi Andrew,

Thanks for your reply.
Sorry to miss mentioning the Sink. I am using HDFS sink.
So I am sure I am looking at latest records only. I also tried changing the eventtype and each time I change, I see new eventtype in HDFS file, but the parameters are always coming null.

The logs show no signs of error.

And not sure if these make any difference, but couple more points that may be of interest

1. I am using divolte 0.8
2. The avsc, I took the default avsc and added my two custom fields to the end of it. I believe that should be ok.

Complete clueless on what to look further.

Thanks,
Sridhar

Alexander Bij

unread,
Oct 7, 2018, 5:46:38 AM10/7/18
to divolte-collector
He Sridhar, 

Make sure that the Groovy script (custom mapping) is beeing used.You should check the logs while starting up.
If you don't specify it correclty it will fallback to the default mapping and not apply the rules for foo and bar.


I think you don't need add your source and sink, only the 'mapping_script_file'.

Greetings,
Alexander

sridh...@gmail.com

unread,
Nov 9, 2018, 4:09:53 PM11/9/18
to divolte-collector
I just changed the order of mappings in groovy script. Moved the eventparams to the starting of the mapping groovy file and that seems to fix the problem.
Not sure how the order made a difference, but glad I was able to get this to working

Thanks all for help,
Sridhar
Reply all
Reply to author
Forward
0 new messages