Prefer auditstamp actor over agent for MLE actor (#1244)

This commit is contained in:
Yi (Alan) Wang 2018-06-29 15:13:14 -07:00 committed by GitHub
parent bc8b138232
commit 00ad604db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,17 +107,17 @@ public class MetadataLineageProcessor extends KafkaMessageProcessor {
* Get actor Urn string from app type or change audit stamp
*/
private String getActorUrn(MetadataLineageEvent event) {
// use app type first
// use actorUrn in ChangeAuditStamp first
ChangeAuditStamp auditStamp = event.changeAuditStamp;
if (auditStamp != null && auditStamp.actorUrn != null) {
return auditStamp.actorUrn.toString();
}
// use app type as fallback
if (event.type != agent.UNUSED) {
return "urn:li:multiProduct:" + event.type.name().toLowerCase();
}
// if app type = UNUSED, use actorUrn in ChangeAuditStamp
ChangeAuditStamp auditStamp = event.changeAuditStamp;
if (auditStamp == null || auditStamp.actorUrn == null) {
throw new IllegalArgumentException("Requires ChangeAuditStamp actorUrn if MLE agent is UNUSED");
}
return auditStamp.actorUrn.toString();
throw new IllegalArgumentException("Require ChangeAuditStamp actorUrn");
}
public FailedMetadataLineageEvent newFailedEvent(MetadataLineageEvent event, Throwable throwable) {