mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-25 08:58:26 +00:00
fix(mce-consumer): abbreviate overly verbose logging
This commit is contained in:
parent
522a508075
commit
cd8d7b2c02
@ -179,4 +179,6 @@ public interface AspectsBatch {
|
||||
Collectors.mapping(
|
||||
Pair::getValue, Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))));
|
||||
}
|
||||
|
||||
String toAbbreviatedString(int maxWidth);
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ public class EntityServiceImpl implements EntityService<ChangeItemImpl> {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
log.info("Ingesting aspects batch to database, items: {}", aspectsBatch.getItems());
|
||||
log.info("Ingesting aspects batch to database: {}", aspectsBatch.toAbbreviatedString(2048));
|
||||
Timer.Context ingestToLocalDBTimer =
|
||||
MetricUtils.timer(this.getClass(), "ingestAspectsToLocalDB").time();
|
||||
List<UpdateAspectResult> ingestResults = ingestAspectsToLocalDB(aspectsBatch, overwrite);
|
||||
|
||||
@ -11,6 +11,7 @@ import com.linkedin.metadata.aspect.batch.ChangeMCP;
|
||||
import com.linkedin.metadata.aspect.plugins.validation.ValidationExceptionCollection;
|
||||
import com.linkedin.mxe.MetadataChangeProposal;
|
||||
import com.linkedin.util.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -22,6 +23,7 @@ import javax.annotation.Nonnull;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@ -148,4 +150,20 @@ public class AspectsBatchImpl implements AspectsBatch {
|
||||
public String toString() {
|
||||
return "AspectsBatchImpl{" + "items=" + items + '}';
|
||||
}
|
||||
|
||||
public String toAbbreviatedString(int maxWidth) {
|
||||
List<String> itemsAbbreviated = new ArrayList<String>();
|
||||
items.forEach(
|
||||
item -> {
|
||||
if (item instanceof ChangeItemImpl) {
|
||||
itemsAbbreviated.add(((ChangeItemImpl) item).toAbbreviatedString());
|
||||
} else {
|
||||
itemsAbbreviated.add(item.toString());
|
||||
}
|
||||
});
|
||||
return "AspectsBatchImpl{"
|
||||
+ "items="
|
||||
+ StringUtils.abbreviate(itemsAbbreviated.toString(), maxWidth)
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@ -239,4 +240,20 @@ public class ChangeItemImpl implements ChangeMCP {
|
||||
+ systemMetadata
|
||||
+ '}';
|
||||
}
|
||||
|
||||
public String toAbbreviatedString() {
|
||||
return "ChangeItemImpl{"
|
||||
+ "changeType="
|
||||
+ changeType
|
||||
+ ", urn="
|
||||
+ urn
|
||||
+ ", aspectName='"
|
||||
+ aspectName
|
||||
+ '\''
|
||||
+ ", recordTemplate="
|
||||
+ StringUtils.abbreviate(recordTemplate.toString(), 256)
|
||||
+ ", systemMetadata="
|
||||
+ StringUtils.abbreviate(systemMetadata.toString(), 128)
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user