Repository navigation
Expand file tree
/
Copy pathModuleEvents.java
More file actions
608 lines (534 loc) · 26.6 KB
/
Copy pathModuleEvents.java
File metadata and controls
608 lines (534 loc) · 26.6 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
package ly.count.sdk.java.internal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import ly.count.sdk.java.Countly;
import ly.count.sdk.java.Session;
import ly.count.sdk.java.View;
public class ModuleEvents extends ModuleBase {
/**
* The keys of the events the SDK records itself, which the custom event settings of the SDK
* behavior settings do not apply to. Any other key is a custom event, one starting with
* {@code [CLY]_} too.
*/
static final Set<String> INTERNAL_EVENT_KEYS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
ModuleViews.KEY_VIEW_EVENT, FeedbackWidgetType.nps.eventKey, FeedbackWidgetType.survey.eventKey, FeedbackWidgetType.rating.eventKey)));
protected EventQueue eventQueue = null;
final Map<String, EventImpl> timedEvents = new ConcurrentHashMap<>();
protected Events eventsInterface = null;
IdGenerator idGenerator = null;
String previousEventId = null;
/**
* Storage IDs of the event requests that carry a journey trigger and are waiting for their first
* response, which decides whether the content zone is refreshed.
*/
final Set<Long> journeyTriggerRequestIds = ConcurrentHashMap.newKeySet();
/**
* The thread ending the timed events and the view of the previous device ID during a device ID
* change without merge; its sends wait, so those events go out in one request under that ID.
*/
private volatile Thread threadEndingEventsOfThePreviousDeviceId = null;
@Override
public void init(InternalConfig config) {
super.init(config);
L.d("[ModuleEvents] init: config = " + config);
eventQueue = new EventQueue(L, config.getEventsBufferSize());
eventQueue.restoreFromDisk();
eventsInterface = new Events();
idGenerator = config.eventIdGenerator;
}
@Override
protected void onTimer() {
addEventsToRequestQ(null);
}
@Override
public Boolean onRequest(Request request) {
return true;
}
/**
* Refreshes the content zone once the server accepted a request that carries a journey trigger.
* The first attempt to send such a request settles it: when it fails, neither it nor its retry
* refreshes anything. A request dropped from the queue unsent settles it the same way.
*
* @param request the request that was sent
* @param response the response body, {@code null} when none could be read
* @param responseCode the response code, {@link Transport#NO_RESPONSE_CODE} when no response arrived
*/
@Override
public void onRequestCompleted(Request request, String response, int responseCode) {
if (request == null || !journeyTriggerRequestIds.remove(request.storageId())) {
return;
}
if (!Transport.isSuccessfulResponse(responseCode, response)) {
L.d("[ModuleEvents] onRequestCompleted, the request [" + request.storageId() + "] carrying a journey trigger failed with code [" + responseCode + "], the content zone is not refreshed");
return;
}
SDKCore core = SDKCore.instance;
ModuleContent content = core == null ? null : core.module(ModuleContent.class);
if (content == null) {
L.d("[ModuleEvents] onRequestCompleted, the server accepted the request [" + request.storageId() + "] carrying a journey trigger, there is no content zone to refresh");
return;
}
L.d("[ModuleEvents] onRequestCompleted, the server accepted the request [" + request.storageId() + "] carrying a journey trigger, refreshing the content zone");
content.refreshContentZoneInternal();
}
/**
* Settles the journey triggers carried by requests that were removed from the queue unread,
* which leaves their owner unknown and untold. No response will ever arrive for them, and none
* of them refreshes the content zone.
*
* @param requestIds storage IDs of the removed requests
*/
void onRequestsDroppedUnread(@Nonnull Collection<Long> requestIds) {
for (Long requestId : requestIds) {
if (journeyTriggerRequestIds.remove(requestId)) {
L.d("[ModuleEvents] onRequestsDroppedUnread, the request [" + requestId + "] carrying a journey trigger was dropped from the queue without being sent, the content zone is not refreshed");
}
}
}
@Override
public void deviceIdChanged(String oldDeviceId, boolean withMerge) {
super.deviceIdChanged(oldDeviceId, withMerge);
L.d("[ModuleEvents] deviceIdChanged: oldDeviceId = " + oldDeviceId + ", withMerge = " + withMerge);
if (!withMerge) {
//the new device ID is already set, so the events ended here are sent below under the old one, never on their own
threadEndingEventsOfThePreviousDeviceId = Thread.currentThread();
try {
for (Map.Entry<String, EventImpl> timedEventEntry : timedEvents.entrySet()) {
L.d("[ModuleEvents] deviceIdChanged, Ending timed event: [" + timedEventEntry.getKey() + "]");
endEventInternal(timedEventEntry.getKey(), timedEventEntry.getValue().segmentation, timedEventEntry.getValue().count, timedEventEntry.getValue().sum);
}
// this part is to end and record the current view if exists
Session session = Countly.session();
if (session != null && session.isActive()) {
View currentView = ((SessionImpl) session).currentView;
if (currentView != null) {
currentView.stop(true);
} else {
Storage.pushAsync(internalConfig, (SessionImpl) Countly.session());
}
}
} finally {
threadEndingEventsOfThePreviousDeviceId = null;
}
addEventsToRequestQ(oldDeviceId);
}
}
@Override
public void stop(InternalConfig config, final boolean clear) {
super.stop(config, clear);
journeyTriggerRequestIds.clear();
if (clear) {
eventQueue.clear();
timedEvents.clear();
}
}
/**
* Moves every queued event into one request.
*
* @param deviceId the device ID the events belong to, {@code null} for the current one
*/
private void addEventsToRequestQ(@Nullable String deviceId) {
addEventsToRequestQ(deviceId, false);
}
/**
* Moves every queued event into one request.
*
* @param deviceId the device ID the events belong to, {@code null} for the current one
* @param journeyTrigger whether the events include a journey trigger, whose request refreshes
* the content zone once the server accepts it
*/
private synchronized void addEventsToRequestQ(@Nullable String deviceId, boolean journeyTrigger) {
L.d("[ModuleEvents] addEventsToRequestQ");
if (eventQueue.getEQ().isEmpty()) {
L.d("[ModuleEvents] addEventsToRequestQ, eventQueueMemoryCache is empty, skipping");
return;
}
Request request = new Request();
if (deviceId != null) {
request.params.add("device_id", deviceId);
}
request.params.arr("events").put(eventQueue.getEQ()).add();
request.own(ModuleEvents.class);
eventQueue.clear();
if (!journeyTrigger) {
ModuleRequests.pushAsync(internalConfig, request);
return;
}
final Long requestId = request.storageId();
journeyTriggerRequestIds.add(requestId);
L.d("[ModuleEvents] addEventsToRequestQ, the request [" + requestId + "] carries a journey trigger, the content zone is refreshed once the server accepts it");
ModuleRequests.pushAsync(internalConfig, request, false, stored -> {
if (!Boolean.TRUE.equals(stored)) {
journeyTriggerRequestIds.remove(requestId);
}
});
}
/**
* Drops the queued events, unsent; timed events are kept. Takes the lock of moving the queued
* events into a request, so a request they were already moved into is queued first.
*/
synchronized void clearEventQueue() {
eventQueue.clear();
}
protected void recordEventInternal(String key, int count, Double sum, Double dur, Map<String, Object> segmentation, String eventIdOverride) {
ConfigurationProvider configProvider = internalConfig.getConfigurationProvider();
if (!configProvider.getTrackingEnabled()) {
L.w("[ModuleEvents] recordEventInternal, tracking is disabled by the SDK behavior settings, event [" + key + "] will not be recorded");
L.recordLogCode("w505", HealthCheckCounter.AREA_EVENTS);
return;
}
if (count <= 0) {
L.w("[ModuleEvents] recordEventInternal, Count can't be less than 1, ignoring this event.");
L.recordLogCode("w750", HealthCheckCounter.AREA_EVENTS);
return;
}
if (key == null || key.isEmpty()) {
L.w("[ModuleEvents] recordEventInternal, Key can't be null or empty, ignoring this event.");
L.recordLogCode("w701", HealthCheckCounter.AREA_EVENTS);
return;
}
boolean isCustomEvent = !INTERNAL_EVENT_KEYS.contains(key);
if (isCustomEvent) {
if (!configProvider.getCustomEventTrackingEnabled()) {
L.d("[ModuleEvents] recordEventInternal, custom event tracking is disabled by the SDK behavior settings, event [" + key + "] will not be recorded");
return;
}
if (!UtilsListingFilters.applyEventFilter(key, configProvider)) {
L.w("[ModuleEvents] recordEventInternal, event [" + key + "] is filtered out by the event filter of the SDK behavior settings, it will not be recorded");
return;
}
segmentation = filteredCustomEventSegmentation(key, segmentation, configProvider);
}
boolean journeyTrigger = isJourneyTrigger(key, isCustomEvent, segmentation, configProvider);
L.d("[ModuleEvents] recordEventInternal, Recording event with key: [" + key + "] and provided event ID of:[" + eventIdOverride + "] and segmentation with:[" + (segmentation == null ? "null" : segmentation.size()) + "] keys");
Utils.removeInvalidDataFromSegments(segmentation, L);
if (isCustomEvent) {
key = UtilsInternalLimits.truncateKey(key, configProvider.getMaxKeyLength(), L, "[ModuleEvents] recordEventInternal");
segmentation = UtilsInternalLimits.applySegmentationLimits(segmentation, configProvider, L, "[ModuleEvents] recordEventInternal");
}
ModuleUserProfile.saveIfSentAutomatically(internalConfig);
String eventId, pvid = null, cvid = null;
if (Utils.isEmptyOrNull(eventIdOverride)) {
L.d("[ModuleEvents] recordEventInternal, Generating new event id because it was null or empty");
eventId = idGenerator.generateId();
} else {
eventId = eventIdOverride;
}
ViewIdProvider viewIdProvider = internalConfig.viewIdProvider;
if (key.equals(ModuleViews.KEY_VIEW_EVENT)) {
pvid = viewIdProvider.getPreviousViewId();
} else {
cvid = viewIdProvider.getCurrentViewId();
}
String previousEventIdToSend = this.previousEventId;
if (key.equals(FeedbackWidgetType.nps.eventKey) || key.equals(FeedbackWidgetType.survey.eventKey) || key.equals(ModuleViews.KEY_VIEW_EVENT) || key.equals(FeedbackWidgetType.rating.eventKey)) {
previousEventIdToSend = null;
} else {
this.previousEventId = eventId;
}
addEventToQueue(new EventImpl(key, count, sum, dur, segmentation, L, eventId, pvid, cvid, previousEventIdToSend), journeyTrigger);
}
/**
* Applies the segmentation filter and then the segmentation filter of this event to the
* segmentation of a custom event. The filters work on a copy, as the map belongs to the caller.
*
* @param key the key of the custom event
* @param segmentation the segmentation the caller passed, {@code null} for none
* @param configProvider the settings in effect
* @return the filtered copy, {@code null} when there was no segmentation
*/
@Nullable
private Map<String, Object> filteredCustomEventSegmentation(@Nonnull String key, @Nullable Map<String, Object> segmentation, @Nonnull ConfigurationProvider configProvider) {
if (segmentation == null) {
return null;
}
Map<String, Object> filtered = new HashMap<>(segmentation);
UtilsListingFilters.applySegmentationFilter(filtered, configProvider, L);
UtilsListingFilters.applyEventSegmentationFilter(key, filtered, configProvider, L);
return filtered;
}
/**
* Whether an event is a journey trigger of the SDK behavior settings: a custom event whose key
* is in {@code jte}, or a view event whose name is in {@code jtv}.
*
* @param key the key of the event, as it was passed
* @param isCustomEvent whether the key is not one of {@link #INTERNAL_EVENT_KEYS}
* @param segmentation the segmentation of the event, {@code null} for none
* @param configProvider the settings in effect
* @return {@code true} for a journey trigger
*/
private static boolean isJourneyTrigger(@Nonnull String key, boolean isCustomEvent, @Nullable Map<String, Object> segmentation, @Nonnull ConfigurationProvider configProvider) {
if (isCustomEvent) {
return configProvider.getJourneyTriggerEvents().contains(key);
}
if (!ModuleViews.KEY_VIEW_EVENT.equals(key) || segmentation == null) {
return false;
}
Object viewName = segmentation.get(ModuleViews.KEY_NAME);
return viewName != null && configProvider.getJourneyTriggerViews().contains(viewName);
}
/**
* Adds an event to the event queue and sends the queue when it is full or holds a journey trigger.
*
* @param event the event
* @param journeyTrigger whether the event is a journey trigger
*/
private void addEventToQueue(@Nonnull EventImpl event, boolean journeyTrigger) {
L.d("[ModuleEvents] addEventToQueue");
eventQueue.addEvent(event);
if (journeyTrigger) {
L.d("[ModuleEvents] addEventToQueue, event [" + event.key + "] is a journey trigger, sending the event queue now");
}
checkEventQueueToSend(journeyTrigger, journeyTrigger);
}
void checkEventQueueToSend(boolean forceSend) {
checkEventQueueToSend(forceSend, false);
}
/**
* Sends the queued events when asked to or when the queue reached its threshold.
*
* @param forceSend whether to send whatever is queued
* @param journeyTrigger whether the queue holds a journey trigger
*/
private void checkEventQueueToSend(boolean forceSend, boolean journeyTrigger) {
if (Thread.currentThread() == threadEndingEventsOfThePreviousDeviceId) {
L.d("[ModuleEvents] checkEventQueueToSend, the events of the previous device ID are being ended, they are sent together under that ID");
return;
}
L.d("[ModuleEvents] queue size:[" + eventQueue.eqSize() + "] || forceSend: " + forceSend);
if (forceSend || eventQueue.eqSize() >= internalConfig.getConfigurationProvider().getEventQueueSizeThreshold()) {
addEventsToRequestQ(null, journeyTrigger);
}
}
boolean startEventInternal(final String key) {
if (key == null || key.isEmpty()) {
L.w("[ModuleEvents] Can't start event with a null or empty key");
L.recordLogCode("w700", HealthCheckCounter.AREA_EVENTS);
return false;
}
if (timedEvents.containsKey(key)) {
L.w("[ModuleEvents] startEventInternal, a timed event with the key [" + key + "] is already running, the call is ignored");
L.recordLogCode("w722", HealthCheckCounter.AREA_EVENTS);
return false;
}
L.d("[ModuleEvents] Starting event: [" + key + "]");
timedEvents.put(key, new EventImpl(event -> {
EventImpl eventImpl = timedEvents.remove(key);
L.d("[ModuleEvents] Ending event: [" + key + "]");
if (eventImpl == null) {
L.w("startEventInternal, eventRecorder, No timed event with the name [" + key + "] is started, nothing to end. Will ignore call.");
return;
}
recordEventInternal(eventImpl.key, eventImpl.count, eventImpl.sum, eventImpl.duration, eventImpl.segmentation, eventImpl.id);
}, key, L));
return true;
}
boolean endEventInternal(final String key, final Map<String, Object> segmentation, int count, final Double sum) {
L.d("[ModuleEvents] Ending event: [" + key + "]");
if (key == null || key.isEmpty()) {
L.w("[ModuleEvents] Can't end event with a null or empty key");
L.recordLogCode("w700", HealthCheckCounter.AREA_EVENTS);
return false;
}
EventImpl event = timedEvents.remove(key);
if (event == null) {
L.w("[ModuleEvents] endEventInternal, No timed event with the name [" + key + "] is started, nothing to end. Will ignore call.");
L.recordLogCode("w720", HealthCheckCounter.AREA_EVENTS);
return false;
}
if (count < 1) {
L.w("[ModuleEvents] endEventInternal, Countly event count should be greater than zero [" + count + "]. Changing value to 1");
L.recordLogCode("w750", HealthCheckCounter.AREA_EVENTS);
count = 1;
}
L.d("[ModuleEvents] Ending event: [" + key + "]");
long currentTimestamp = TimeUtils.timestampMs();
double duration = (currentTimestamp - event.timestamp) / 1000.0;
recordEventInternal(key, count, sum, duration, segmentation, null);
return true;
}
boolean cancelEventInternal(final String key) {
if (key == null || key.isEmpty()) {
L.w("[ModuleEvents] Can't cancel event with a null or empty key");
L.recordLogCode("w700", HealthCheckCounter.AREA_EVENTS);
return false;
}
EventImpl event = timedEvents.remove(key);
if (event == null) {
L.w("[ModuleEvents] cancelEventInternal, no timed event with the key [" + key + "] is running, the call is ignored");
L.recordLogCode("w721", HealthCheckCounter.AREA_EVENTS);
return false;
}
return true;
}
public class Events {
/**
* The interface a call goes to: this one while its module runs, the running module's when
* this one was handed out before that started or kept from one that stopped, and
* {@code null} while the feature does not run.
*
* @param call the call, for the log line
* @return the interface, {@code null} for none
*/
private Events target(String call) {
ModuleEvents running = runningInstance(call);
return running == null ? null : running.eventsInterface;
}
/**
* Record an event.
*
* @param key key for this event, cannot be null or empty
* @param count how many of these events have occurred, default value is "1", must be greater than 0
* @param sum set sum parameter of the event, can be null
* @param dur set duration of event, can be null
* @param segmentation additional segmentation data that you want to set, leave null if you don't want to add anything
*/
public void recordEvent(String key, Map<String, Object> segmentation, int count, Double sum, Double dur) {
Events target = target("[Events] recordEvent");
if (target != this) {
if (target != null) {
target.recordEvent(key, segmentation, count, sum, dur);
}
return;
}
L.i("[Events] recordEvent: key = " + key + ", count = " + count + ", sum = " + sum + ", segmentation = " + segmentation + ", dur = " + dur);
L.recordUsage(HealthCheckCounter.AREA_EVENTS, "record");
recordEventInternal(key, count, sum, dur, segmentation, null);
}
/**
* Record an event with "duration" null by default
*
* @param key key for this event, cannot be null or empty
* @param count how many of these events have occurred, default value is "1", must be greater than 0
* @param sum set sum parameter of the event, can be null
* @param segmentation additional segmentation data that you want to set, leave null if you don't want to add anything
*/
public void recordEvent(String key, Map<String, Object> segmentation, int count, Double sum) {
recordEvent(key, segmentation, count, sum, null);
}
/**
* Record an event with "segmentation","key" and "count" value only
* "duration" is null by default
*
* @param key key for this event, cannot be null or empty
* @param count how many of these events have occurred, default value is "1", must be greater than 0
* @param segmentation additional segmentation data that you want to set, leave null if you don't want to add anything
*/
public void recordEvent(String key, Map<String, Object> segmentation, int count) {
recordEvent(key, segmentation, count, null);
}
/**
* Record an event with "segmentation" and "key" value only
* "sum" and "duration" is null by default
*
* @param key key for this event, cannot be null or empty
* @param segmentation additional segmentation data that you want to set, leave null if you don't want to add anything
*/
public void recordEvent(String key, Map<String, Object> segmentation) {
recordEvent(key, segmentation, 1, null);
}
/**
* Record an event with "key" only
* "sum" and "duration" is null by default
* "count" is 1 by default
*
* @param key key for this event, cannot be null or empty
*/
public void recordEvent(String key) {
recordEvent(key, null, 1, null);
}
/**
* Record an event with "key" and "count" only
* "sum" and "duration" is null by default
*
* @param key key for this event, cannot be null or empty
* @param count how many of these events have occurred, default value is "1", must be greater than 0
*/
public void recordEvent(String key, int count) {
recordEvent(key, null, count, null);
}
/**
* Record an event with "key", "sum" and "count" only
* "duration" is null by default
*
* @param key key for this event, cannot be null or empty
* @param count how many of these events have occurred, default value is "1", must be greater than 0
* @param sum set sum parameter of the event, can be null
*/
public void recordEvent(String key, int count, Double sum) {
recordEvent(key, null, count, sum);
}
/**
* Start timed event with a specified key
*
* @param key name of the custom event, required, must not be the empty string or null
* @return true if no event with this key existed before and event is started, false otherwise
*/
public boolean startEvent(final String key) {
Events target = target("[Events] startEvent");
if (target != this) {
return target != null && target.startEvent(key);
}
L.i("[Events] startEvent: key = " + key);
L.recordUsage(HealthCheckCounter.AREA_EVENTS, "start");
return startEventInternal(key);
}
/**
* End timed event with a specified key
*
* @param key name of the custom event, required, must not be the empty string or null
* @return true if event with this key has been previously started, false otherwise
*/
public boolean endEvent(final String key) {
Events target = target("[Events] endEvent");
if (target != this) {
return target != null && target.endEvent(key);
}
L.i("[Events] endEvent: key = " + key);
L.recordUsage(HealthCheckCounter.AREA_EVENTS, "end");
return endEventInternal(key, null, 1, null);
}
/**
* End timed event with a specified key
*
* @param key name of the custom event, required, must not be the empty string
* @param segmentation segmentation dictionary to associate with the event, can be null
* @param count count to associate with the event, should be more than zero, default value is 1
* @param sum sum to associate with the event, can be null
* @return true if event with this key has been previously started, false otherwise
* @throws IllegalStateException if Countly SDK has not been initialized
* @throws IllegalArgumentException if key is null or empty, count is less than 1, or if segmentation contains null or empty keys or values
*/
public boolean endEvent(final String key, final Map<String, Object> segmentation, final int count, final Double sum) {
Events target = target("[Events] endEvent");
if (target != this) {
return target != null && target.endEvent(key, segmentation, count, sum);
}
L.i("[Events] endEvent: key = " + key + ", segmentation = " + segmentation + ", count = " + count + ", sum = " + sum);
L.recordUsage(HealthCheckCounter.AREA_EVENTS, "end");
return endEventInternal(key, segmentation, count, sum);
}
/**
* Cancel timed event with a specified key
*
* @return true if event with this key has been previously started, false otherwise
**/
public boolean cancelEvent(final String key) {
Events target = target("[Events] cancelEvent");
if (target != this) {
return target != null && target.cancelEvent(key);
}
L.i("[Events] cancelEvent: key = " + key);
L.recordUsage(HealthCheckCounter.AREA_EVENTS, "cancel");
return cancelEventInternal(key);
}
}
}