Area: API
Sub-Area: Events
Applies to: OSS + Cloud
Issue
Metadata Change Proposals (MCPs) or legacy Metadata Change Events (MCEs) that you emit to DataHub don't show up in the UI. The emitter may fail to connect, the server may reject the request, or, on a self-hosted deployment, the MCP consumer may be behind.
You Might Be Asking
- How do I check if my MCPs are being processed?
- Why aren't my metadata changes showing up?
- What's the difference between MCE and MCP?
Cause
Common causes:
-
Wrong endpoint. The emitter must talk to GMS, not the frontend. For DataHub Cloud the endpoint is
https://<name>.acryl.io/gms. - Authentication failure. GMS returns HTTP 401 "Unauthorized to perform this action." when a request has no valid token. A token that has expired or been revoked is also rejected.
-
Rate limiting. If rate limiting is on, GMS answers a denied request with HTTP 429 and
{"error": "Rate limit exceeded"}. DataHub Cloud lists distributed rate limiting for REST, GraphQL and OpenAPI. In the GMS application defaults for self-hosted DataHub, it is off. -
A bad emitter call.
emit_mcptakes one MCP object. Passingentity_urn,aspect_nameoraspectkeywords raisesTypeErrorbefore anything is sent. -
A write that replaced an aspect. An MCP with changeType
UPSERTreplaces the whole aspect, so fields you didn't include are lost. - Self-hosted only: the MCP consumer is lagging or down.
MCP and MCE are two event types. MCP is the current one. The default MCP topic is MetadataChangeProposal_v1. The legacy MCE topic is MetadataChangeEvent_v4.
Solution
-
Check the connection and token.
test_connection()fetches<gms>/configand raises on failure:
from datahub.emitter.rest_emitter import DatahubRestEmitter
emitter = DatahubRestEmitter("https://<name>.acryl.io/gms", token="<token>")
emitter.test_connection()
Read the message you get:
-
Unable to connect to <gms>/config with status_code: <code>.means GMS answered with an error status. -
Unable to connect to <gms>/config - got an authentication error: <body>.means a 401. Create a new token. See Creating Personal Access Tokens. -
You seem to have connected to the frontend service instead of the GMS endpoint.means you used the frontend URL. Use the GMS URL.
The REST sink reports a failed connection as Failed to connect to DataHub with <emitter>: configured to talk to <gms_server>.... Check the server URL and token in your recipe.
-
Emit with the correct call.
emit_mcptakes a singleMetadataChangeProposalWrapper(orMetadataChangeProposal):
# mcp is a MetadataChangeProposalWrapper that you built for your entity and aspect
emitter.emit_mcp(mcp)
Optional arguments are async_flag, emit_mode and wait_timeout (default 3600 seconds). If you don't pass an emit mode, the emitter uses its default, which is SYNC_PRIMARY unless the DATAHUB_EMIT_MODE environment variable is set.
-
Read emit errors. When GMS returns an error status, the REST emitter in current SDK releases raises
OperationalError. If the error body is JSON, the message isUnable to emit metadata to DataHub GMS: <server message>. If the body isn't JSON, or no response arrives, the message isUnable to emit metadata to DataHub GMSand the details are in the exception'sinfo. If the server message mentions an unrecognized field, the emitter adds a hint that the server version may be too old relative to the client. Upgrade the server or use a matching SDK. -
Know that an UPSERT replaces the whole aspect. A
MetadataChangeProposalWrapperdefaults to changeTypeUPSERT, and an UPSERT MCP replaces the whole aspect. If you emit a bare aspect such asDatasetPropertiesClass, fields you left out are lost. To change one field, read the current aspect, change it and write it back (read-modify-write). Or use a PATCH MCP or the SDK patch builders, which make partial updates. For descriptions that users edit, useEditableDatasetPropertiesClass. It stores editable changes separately from ingestion, so ingestion doesn't overwrite user-provided data. See Adding descriptions. -
Handle throttling. The REST emitter retries status codes 429, 500, 502, 503 and 504 on all methods, including POST. The default is 4 retries (
retry_max_times) with a backoff factor of 2, and 429 responses get extra retries. You can tune this with the constructor argumentsretry_status_codes,retry_methods,retry_max_times,pool_connectionsandpool_maxsize. Don't mount your own adapter on the emitter session. The emitter already mounts its own. If you still get 429s, send fewer requests at once.- Cloud: to change rate limits, contact DataHub Support.
-
Self-hosted: rate limits are set with the
RATE_LIMITS_*environment variables on GMS. See GMS rate limiting.
-
Check consumer offsets. Run this command with the CLI against your DataHub instance. It works on Cloud and self-hosted, and you need the Manage System Operations privilege (
MANAGE_SYSTEM_OPERATIONS) to use it:
datahub check get-kafka-consumer-offsets -o table
Use -o json for JSON output. See get-kafka-consumer-offsets.
-
Self-hosted only: confirm the MCP consumer group. The default group is
generic-mce-consumer-job-client(environment variableMETADATA_CHANGE_PROPOSAL_KAFKA_CONSUMER_GROUP_ID). In Helm,kafka.metadata_change_proposal_group_idoverrides it. Withglobal.kafka.dedicated_consumer_groups.enabled, the group is<global.id>-mcp-consumer. A group nameddatahub-mce-consumerdoesn't exist. Use the group you find when you describe lag with your Kafka tools. Prometheus metrics for self-hosted GMS are at/actuator/prometheus. See Monitoring. -
If you use the Kafka emitter, install the extra with
pip install 'acryl-datahub[datahub-kafka]'and import everything you use:
from datahub.emitter.kafka_emitter import DatahubKafkaEmitter, KafkaEmitterConfig
from datahub.configuration.kafka import KafkaProducerConnectionConfig
emitter = DatahubKafkaEmitter(
KafkaEmitterConfig(
connection=KafkaProducerConnectionConfig(
bootstrap="<bootstrap-servers>",
schema_registry_url="<schema-registry-url>",
)
)
)
The Kafka emitter needs direct access to your Kafka brokers and schema registry. For DataHub Cloud, use the REST emitter. See Kafka vs REST sink. With the Kafka emitter, call flush() or close() before your program exits, so queued messages are sent. With the REST emitter, flush() does nothing and close() only closes the HTTP session.
Upgrade to the latest release of the SDK with pip install --upgrade acryl-datahub if your version is old.
Related Documentation
- Metadata Change Proposal and Metadata Change Log
- Python REST emitter
- REST and Kafka sinks
- get-kafka-consumer-offsets
- GMS rate limiting
- Adding descriptions
Tags: mcp, mce, metadata-events, kafka, api, rest-api, event-processing, emitter