Sampling

Most recent version: v0.0.1

See the changelog of this Action type here.

Overview

The Sampling Action allows only a specific number of allowed events out of every set of n events to go through it.

Ports

These are the input and output ports of this Action:

Input ports
  • Default port - All the events to be processed by this Action enter through this port.

Output ports
  • Default port - Events are sent through this port if no error occurs while processing them.

  • Error port - Events are sent through this port if an error occurs while processing them.

Configuration

1

Find Sampling in the Actions tab (under the Filtering group) and drag it onto the canvas. Link it to the required Listener and Data sink.

2

To open the configuration, click the Action in the canvas and select Configuration.

3

Enter the required parameters:

Parameter
Description

Allowed Events*

The number of events to sample. The first n events will be filtered from each set of total events indicated.

Total Events*

Out of how many total events that are entering the action. When the number of allowed events is filtered, a new set with this number of total events will be taken again.

4

Click Save to complete.

Example

Let's say we want to filter the first event out of each set of 3 of our input events. To do it:

1

Add the Sampling Action to your Pipeline and link it to your required Listener.

2

Now, double-click the Sampling Action to configure it. You need to set the following config:

Parameter
Description

Allowed Events

Enter 1.

Total Events

Enter 3.

3

Now link the Default output port of the Action to the input port of your Data sink.

4

Finally, click Publish and choose which clusters you want to publish the Pipeline in.

5

Click Test pipeline at the top of the area and choose a specific number of events to test if your data is transformed properly. Click Debug to proceed.

From this set of events:

{
  {
    "IP_Address": "192.168.1.1",
    "GET_Count": 2,
    "POST_Count": 1
  },
  {
    "IP_Address": "192.168.1.2",
    "GET_Count": 5,
    "POST_Count": 7
  },
  {
    "IP_Address": "192.168.1.3",
    "GET_Count": 9,
    "POST_Count": 2
  },
  {
    "IP_Address": "192.168.1.4",
    "GET_Count": 29,
    "POST_Count": 6
  },
  {
    "IP_Address": "192.168.1.5",
    "GET_Count": 98,
    "POST_Count": 6
  },
  {
    "IP_Address": "192.168.1.6",
    "GET_Count": 12,
    "POST_Count": 16
  },
  ...
}

We will get the following (the first event for each set of 3 events):

{
  {
    "IP_Address": "192.168.1.1",
    "GET_Count": 2,
    "POST_Count": 1
  },
  {
    "IP_Address": "192.168.1.4",
    "GET_Count": 29,
    "POST_Count": 6
  },
  ...
}

Last updated

Was this helpful?