Skip to content

Event Analytics Client for Java

Introduction

The Event Analytics Java client allows you to analyze event data. It identifies significant dependencies and helps to get a better understanding of the system's internal processes using statistical analysis. Refer to Event Analytics for more information about the service.

Event Operations

The event operations client statistically analyzes event data to identify the most frequent events.

Client name: EventOperationsClient

Find Top Events

This method finds the N most frequently occurring events and returns them sorted by the number of occurrences in descending order.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Construct the EventOperationsClient object
EventOperationsClient eventOperationsClient = EventOperationsClient.builder()
                                                  .mindsphereCredentials(credentials)
                                                  .restClientConfig(config)
                                                  .build();

// Creating the Events Input Model Events Metadata object
EventsInputModelEventsMetadata eventsMetadata = new EventsInputModelEventsMetadata();
eventsMetadata.setEventTextPropertyName("text");

// Creating a list of events to be analytically
Event firstEvent = new Event();
firstEvent.setText("INTRODUCING FUEL");
firstEvent.setTextQc(0);
firstEvent.setTime("2017-10-01T12:00:00.001Z");

Event secondEvent = new Event();
secondEvent.setText("Status@Flame On");
secondEvent.setTextQc(0);
secondEvent.setTime("2017-10-01T12:02:01.001Z");

List<Event> eventsList = new ArrayList<>();
eventsList.add(firstEvent);
eventsList.add(secondEvent);

// Creating the Top Events Input Data Model object that will be analyzed
TopEventsInputDataModel inputDataModel = new TopEventsInputDataModel();
inputDataModel.setNumberOfTopPositionsRequired(5);
inputDataModel.setEventsMetadata(eventsMetadata);
inputDataModel.setEvents(eventsList);

TopEventOutput topEventsResponse = null;
try {
    topEventsResponse = eventOperationsClient.topEvents(inputDataModel);
} catch (MindsphereException e) {
    // Exception handling
}

Filter Events

This method applies user defined filters to simplify the dataset based on the event text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Create client object "eventOperationsClient" as shown above

// Creating the Events Input Model Events Metadata object
EventsInputModelEventsMetadata eventsMetadata = new EventsInputModelEventsMetadata();
eventsMetadata.setEventTextPropertyName("text");

// Creating a list of events to be analytically
Event firstEvent = new Event();
firstEvent.setText("INTRODUCING FUEL");
firstEvent.setTextQc(0);
firstEvent.setTime("2017-10-01T12:00:00.001Z");

Event secondEvent = new Event();
secondEvent.setText("Status@Flame On");
secondEvent.setTextQc(0);
secondEvent.setTime("2017-10-01T12:02:01.001Z");

List<Event> eventsList = new ArrayList<>();
eventsList.add(firstEvent);
eventsList.add(secondEvent);

// Creating a list of filter criteria
List<String> filterList = new ArrayList<>();
filterList.add("Introduction fuel");

// Creating the Event Search Input Data Model object that will be analyzed
EventSearchInputDataModel inputDataModel = new EventSearchInputDataModel();
inputDataModel.setEvents(eventsList);
inputDataModel.setEventsMetadata(eventsMetadata);
inputDataModel.setFilterList(filterList);

EventArrayOutput filterEventsResponse = null;
try {
    filterEventsResponse = eventOperationsClient.filterEvents(inputDataModel);
} catch (MindsphereException e) {
    // Exception handling
}

Count Events

Determines the number of events per time interval for a user defined interval length.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//Create client object "eventOperationsClient" as shown above

// Creating the Events Input Model Events Metadata object
EventInputEventsMetadata eventsMetadata = new EventInputEventsMetadata();
eventsMetadata.setEventTextPropertyName("text");
eventsMetadata.setSplitInterval(500);

// Creating a list of events to be analytically
Event firstEvent = new Event();
firstEvent.setText("INTRODUCING FUEL");
firstEvent.setTextQc(0);
firstEvent.setTime("2017-10-01T12:00:00.001Z");

Event secondEvent = new Event();
secondEvent.setText("Status@Flame On");
secondEvent.setTextQc(0);
secondEvent.setTime("2017-10-01T12:02:01.001Z");

List<Event> eventsList = new ArrayList<>();
eventsList.add(firstEvent);
eventsList.add(secondEvent);

// Creating the Event Input object that will be analyzed
EventInput eventInput = new EventInput();
eventInput.setEvents(eventsList);
eventInput.setEventsMetadata(eventsMetadata);

EventCountOutput countEventsResponse = null;
try {
    countEventsResponse = eventOperationsClient.countEvents(eventInput);
} catch (MindsphereException e) {
    // Exception handling
}

Remove Duplicate Events

This method removes duplicate events. It detects duplicate events within sliding window of user defined width (example 5,000 ms) and reduces the data set by aggregating duplicate events.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Create client object "eventOperationsClient" as shown above

// Creating the Events Input Model Events Metadata object
EventInputEventsMetadata eventsMetadata = new EventInputEventsMetadata();
eventsMetadata.setEventTextPropertyName("text");
eventsMetadata.setSplitInterval(500);

// Creating a list of events to be analytically
Event firstEvent = new Event();
firstEvent.setText("INTRODUCING FUEL");
firstEvent.setTextQc(0);
firstEvent.setTime("2017-10-01T12:00:00.001Z");

Event secondEvent = new Event();
secondEvent.setText("Status@Flame On");
secondEvent.setTextQc(0);
secondEvent.setTime("2017-10-01T12:02:01.001Z");

List<Event> eventsList = new ArrayList<>();
eventsList.add(firstEvent);
eventsList.add(secondEvent);

// Creating a list of filter criteria
List<String> filterList = new ArrayList<>();
filterList.add("Introduction fuel");

// Creating the Event Input object that will be analyzed
EventInput eventInput = new EventInput();
eventInput.setEvents(eventsList);
eventInput.setEventsMetadata(eventsMetadata);

DuplicateEventArrayOutput removeDuplicateResponse = null;
try {
    removeDuplicateResponse = eventOperationsClient.removeDuplicateEvents(eventInput);
} catch (MindsphereException e) {
    // Exception handling
}

Pattern Operations

The Pattern Operations client statistically analyzes the event data to identify the most frequent events.

Client name: PatternOperationsClient

Find Event Patterns

Searches for user defined patterns in a list of events. Detects all events, which match the specified pattern(s).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Construct the PatternOperationsClient object
PatternOperationsClient patternOperationsClient = PatternOperationsClient.builder()
                                                      .mindsphereCredentials(credentials)
                                                      .restClientConfig(config)
                                                      .build();

// Creating the Events Input Model Events Metadata object
EventsInputModelEventsMetadata eventsMetadata = new EventsInputModelEventsMetadata();
eventsMetadata.setEventTextPropertyName("text");

// Creating a list of events to be analytically
Event firstEvent = new Event();
firstEvent.setText("INTRODUCING FUEL");
firstEvent.setTextQc(0);
firstEvent.setTime("2017-10-01T12:00:00.001Z");

Event secondEvent = new Event();
secondEvent.setText("Status@Flame On");
secondEvent.setTextQc(0);
secondEvent.setTime("2017-10-01T12:02:01.001Z");

List<Event> eventsList = new ArrayList<>();
eventsList.add(firstEvent);
eventsList.add(secondEvent);

// Creating the Events Input Model object that will be analyzed.
EventsInputModel eventsInput = new EventsInputModel();
eventsInput.setEvents(events);
eventsInput.setEventsMetadata(eventsMetadata);

//Construct Matching Pattern object
MatchingPattern matchingPattern1 = new MatchingPattern();
matchingPattern1.setEventText("INTRODUCING FUEL");
matchingPattern1.setMaxRepetitions(2);
matchingPattern1.setMinRepetitions(1);

MatchingPattern matchingPattern2 = new MatchingPattern();
matchingPattern2.setEventText("Status@Flame On");
matchingPattern2.setMaxRepetitions(1);
matchingPattern2.setMinRepetitions(0);

//Construct a list of matching patterns
List<MatchingPattern> pattern = new ArrayList<>();
pattern.add(matchingPattern1);
pattern.add(matchingPattern2);

//Construct Pattern Definition object
PatternDefinition patternDefinition = new PatternDefinition();
patternDefinition.setPattern(pattern);

//Construct a list of Pattern Definitions
List<PatternDefinition> patternDefinitionList = new ArrayList<>();
patternDefinitionList.add(patternDefinition);

//Construct a list of Non Event strings
List<String> nonEvents = new ArrayList<>();
nonEvents.add("Error 2.. occurred");
nonEvents.add("STOPPING ENGINE");

// Creating the Pattern Matching Input Data Model object that will be analyzed
PatternMatchingInputDataModel inputDataModel = new PatternMatchingInputDataModel();
inputDataModel.setEventsInput(eventsInput);
inputDataModel.setNonEvents(nonEvents);
inputDataModel.setPatternsList(patternsList);
inputDataModel.setMaxPatternInterval(200000);

PatternMatchingOutput matchPatternResponse = null;
try {
    matchPatternResponse = patternOperationsClient.matchPatternsOverEvents(inputDataModel);
} catch (MindsphereException e) {
    // Exception handling
}

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.