Skip to content

Commit

Permalink
fix(metadata-service): telemetry - fix hardcoded aspect name, suppres…
Browse files Browse the repository at this point in the history
…s errors when producing MAE (#4981)
  • Loading branch information
RyanHolstien authored May 24, 2022
1 parent 7dd1a6f commit 71c7dc4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,14 @@ protected RecordTemplate sendEventForUpdateAspectResult(@Nonnull final Urn urn,
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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;

Expand Down
2 changes: 1 addition & 1 deletion smoke-test/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Empty file.
11 changes: 11 additions & 0 deletions smoke-test/tests/telemetry/telemetry_test.py
Original file line number Diff line number Diff line change
@@ -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 == "{}"

0 comments on commit 71c7dc4

Please sign in to comment.