logEvent method
Implementation
Future<void> logEvent(LogEventDto event) async {
try {
if (!_instanceCache.contains(event.serviceInstance)) {
await _repo.createInstanceIfNotExists(Instance(
id: event.serviceInstance,
serviceName: event.serviceName,
createTimestamp: event.timestamp,
lastHeartbeat: event.timestamp,
));
_instanceCache.add(event.serviceInstance);
}
final entry = LogEntry.fromLogEvent(event);
await _repo.create(entry);
_logService.verbose(
'Received log event from [${event.serviceName}]/[${event.serviceInstance}].');
} catch (e) {
_healthService.recordError();
rethrow;
}
}