fix(metadata-service): telemetry - fix hardcoded aspect name, suppress errors when producing MAE (#4981)

This commit is contained in:
RyanHolstien 2022-05-24 11:18:20 -05:00 committed by GitHub
parent 7dd1a6f17c
commit 71c7dc455f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 6 deletions

View File

@ -442,10 +442,14 @@ public abstract class EntityService {
produceMCLTimer.stop();
// For legacy reasons, keep producing to the MAE event stream without blocking ingest
Timer.Context produceMAETimer = MetricUtils.timer(this.getClass(), "produceMAE").time();
produceMetadataAuditEvent(urn, aspectName, oldValue, updatedValue, result.getOldSystemMetadata(),
result.getNewSystemMetadata(), MetadataAuditOperation.UPDATE);
produceMAETimer.stop();
try {
Timer.Context produceMAETimer = MetricUtils.timer(this.getClass(), "produceMAE").time();
produceMetadataAuditEvent(urn, aspectName, oldValue, updatedValue, result.getOldSystemMetadata(),
result.getNewSystemMetadata(), MetadataAuditOperation.UPDATE);
produceMAETimer.stop();
} catch (Exception e) {
log.warn("Unable to produce legacy MAE, entity may not have legacy Snapshot schema.", e);
}
} else {
log.debug("Skipped producing MetadataAuditEvent for ingested aspect {}, urn {}. Aspect has not changed.",
aspectName, urn);

View File

@ -15,7 +15,7 @@ import lombok.extern.slf4j.Slf4j;
public final class TelemetryUtils {
public static final String CLIENT_ID_URN = "urn:li:telemetry:clientId";
public static final String CLIENT_ID_ASPECT = "clientId";
public static final String CLIENT_ID_ASPECT = "telemetryClientId";
private static String _clientId;

View File

@ -20,7 +20,7 @@ pip install --upgrade pip wheel setuptools
pip install -r requirements.txt
echo "DATAHUB_VERSION = $DATAHUB_VERSION"
datahub docker quickstart --quickstart-compose-file ../docker/quickstart/docker-compose-without-neo4j.quickstart.yml --dump-logs-on-failure
DATAHUB_TELEMETRY_ENABLED=false datahub docker quickstart --quickstart-compose-file ../docker/quickstart/docker-compose-without-neo4j.quickstart.yml --dump-logs-on-failure
(cd tests/cypress ; yarn install)

View File

View File

@ -0,0 +1,11 @@
import json
from datahub.cli.cli_utils import get_aspects_for_entity
def test_no_clientID():
client_id_urn = "urn:li:telemetry:clientId"
aspect = ["telemetryClientId"]
res_data = json.dumps(get_aspects_for_entity(entity_urn=client_id_urn, aspects=aspect, typed=False))
assert res_data == "{}"