OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Add Glossary Term should generate change event and change description

Open vivekratnavel opened this issue 3 years ago • 2 comments

Affected module Backend and UI

Describe the bug No conversation is created in the activity feed when someone tries to add a new Glossary Term. This is because there is no change event as part of the response here - https://github.com/open-metadata/OpenMetadata/blob/main/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/EntityResource.java#L98

Also, we should send the custom header with change type in the response (CHANGE_CUSTOM_HEADER = "X-OpenMetadata-Change";)

To Reproduce Add a new Glossary Term

Expected behavior It creates a new conversation thread in the activity feed

vivekratnavel avatar May 05 '22 21:05 vivekratnavel

@vivekratnavel, a couple of comments:

  1. For the entity created, we do not set the CHANGE_CUSOM_HEADER. We use the response code 201 for generating a change event.
// Entity was created by either POST .../entities or PUT .../entities
    if (responseCode == Status.CREATED.getStatusCode() && !RestUtil.ENTITY_FIELDS_CHANGED.equals(changeType)) {
      var entityInterface = Entity.getEntityInterface(entity);
      EntityReference entityReference = Entity.getEntityReference(entity);
      String entityType = entityReference.getType();
      String entityFQN = entityReference.getFullyQualifiedName();
      return getChangeEvent(EventType.ENTITY_CREATED, entityType, entityInterface)
          .withEntity(entity)
          .withEntityFullyQualifiedName(entityFQN);
    }
  1. When the entity is created, there is no change description (it is just the first version of the entity starting at 0.1)
  2. Change events are being generated as follows:
INFO  [2022-05-05 22:26:50,993] org.openmetadata.catalog.jdbi3.WebhookRepository: Webhook healthy:active:1 received response OK
INFO  [2022-05-05 22:26:51,075] org.openmetadata.catalog.resources.EntityResource: Created glossaryTerm:3c1d6031-a5aa-438a-93a8-0ed0c83087e4
INFO  [2022-05-05 22:26:51,076] org.openmetadata.catalog.events.ChangeEventHandler: Recording change event 1651789611017:3c1d6031-a5aa-438a-93a8-0ed0c83087e4:entityCreated:glossaryTerm
INFO  [2022-05-05 22:26:51,076] org.openmetadata.catalog.events.AuditEventHandler: Added audit log entry: org.openmetadata.catalog.type.AuditLog@33fb9d4c[method=POST,responseCode=201,path=v1/glossaryTerms,userName=admin,entityId=3c1d6031-a5aa-438a-93a8-0ed0c83087e4,entityType=glossaryTerm,timestamp=1651789611076]
127.0.0.1 - - [05/May/2022:22:26:51 +0000] "POST /api/v1/glossaryTerms HTTP/1.1" 201 1434 "-" "Jersey/2.35 (HttpUrlConnection 11.0.12)" 64

Something else is going on here.

sureshms avatar May 05 '22 22:05 sureshms

You are right. We are not generating conversation threads for the creation of entities. I will take it up and fix the change event handler.

vivekratnavel avatar May 05 '22 23:05 vivekratnavel