How to handle two different event logs in one datasource with two count metrics?

Explanation -

One event log has dimensions - Dim1, Dim2, Dim3

So created a datasource - DS1, which has three dimensions (Dim1, Dim2, Dim3) and count metric as Count1

Second event log file has same - Dim1, Dim2, Dim3

Now I want to have DS1 with Count2 as a count metric for second event logs.

As per my reading I found no way to merge two events into one DataSource having two count metrics -

Dimensions - Dim1, Dim2. Dim3

And metrics - Count1 (for first event file) & Count2 (for second event file) [by default any of these can be zero, if other Count is absent]

Is such thing possible in DRUID?

Why not add ‘event log name’ as a dimension? Then they can share the same ‘count’ metric.

Thanks for the suggestion.

But the use case is - I need both the count metrics for the same Dim1, Dim2, & Dim3.

Just consider - one event logs contains impressions and other log file has clicks events for the Dim1, Dim2, Dim3.

How to achieve this scenario in DRUID?

Hey Akshay,

Two suggestions come to mind:

a) Add another field to your raw data, e.g “type”:“impression” or “type”:“click” and then use filtered aggregators to generate counts of each:

    {
      "type":"filtered",
      "filter": {
        "type": "selector",
        "dimension": "type",
        "value" : "impression"
      },
      "aggregator": {
        "name": "impressionCount",
        "type": "count"
      }
    }

(If you want, you can exclude “type” as an indexable dimension if you don’t need it which may help rollup)

b) Add metric fields to your raw data for isImpression and isClick, e.g. “isImpression”:0, “isClick”:1, and then add longSum aggregators for each:

    {
      "fieldName": "isImpression",
      "name": "impressionCount",
      "type": "longSum"
    }

Hi David,

‘Option b’ was correct (for me), the only additional cost is to use JavaScript Parser and create additional fieldName flags that are missing in the logs.

Thanks.

  • Akshay