Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Event Hubs trigger binding missing correlation id #1636

Open
MihailV1989 opened this issue Jan 24, 2025 · 0 comments
Open

[Bug] Event Hubs trigger binding missing correlation id #1636

MihailV1989 opened this issue Jan 24, 2025 · 0 comments

Comments

@MihailV1989
Copy link

MihailV1989 commented Jan 24, 2025

Expected Behavior

Calling inputEvent.metadata["SystemProperties"]["correlation-id"] should return the correlation id as a string/bytes (inputEvent: azure.functions.EventHubEvent), see:
https://learn.microsoft.com/en-us/python/api/azure-eventhub/azure.eventhub.eventdata?view=azure-python#azure-eventhub-eventdata-system-properties

Actual Behavior

I receive an empty dict {} for the correlation-id. The whole "SystemProperties" dict looks like this:

{'message-id': {}, 'user-id': {'Length': 0, 'IsEmpty': True}, 'correlation-id': {}, 'content-type': 'application/json', 'x-opt-sequence-number-epoch': -1, 'x-opt-sequence-number': 90, 'x-opt-offset': 2479216, 'x-opt-enqueued-time': '2025-01-24T12:17:14.808+00:00', 'SequenceNumber': 90, 'Offset': 2479216, 'PartitionKey': None, 'EnqueuedTimeUtc': '2025-01-24T12:17:14.808'}

Steps to Reproduce

  1. Create an Azure Function with Event Hubs trigger binding and output the "SystemProperties".
  2. Sent an event that contains a correlation id using the Data Explorer or another Azure Function.

Image

  1. Check Logs

Relevant code being tried

import logging
import azure.functions as func


app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)

@app.event_hub_message_trigger(
    arg_name="inputEvent",
    event_hub_name="INPUT_EVENT_HUB_NAME",
    connection="EVENTHUB",
)
def exmp_func(inputEvent: func.EventHubEvent):

    logging.info(str(inputEvent.metadata["SystemProperties"]))

Relevant log output

2025-01-24T12:17:15Z   [Information]   Receiving events for Event Hub: evh-*** (Consumer Group: '$Default', Partition Id: '3'); Operation Id: '328bb195-6a30-4981-ba5b-29dc5b65508b'.
2025-01-24T12:17:15Z   [Information]   Completed receiving events for Event Hub: evh-*** (Consumer Group: '$Default', Partition Id: '4'); Operation Id: 'c39ebbd5-d7d7-4057-a093-02dbe1b0a2a4'.  Service Retry Count: 0; Event Count: 1; Duration: '0.26' seconds
2025-01-24T12:17:15Z   [Verbose]   Started dispatching events to the processing handler for partition '4' by processor instance with identifier '853efb9d-d75e-4bf6-83f8-10977fec4d7a' for Event Hub: evh-***, Consumer Group: $Default, and Operation Id: '9bae7c31-6c23-4e0a-a34a-d82734688052'.  Event Count: '1'
2025-01-24T12:17:15Z   [Information]   Executing 'Functions.exmp_func' (Reason='(null)', Id=2c1d9b76-7996-4969-bc9f-0f75c44c87ea)
2025-01-24T12:17:15Z   [Information]   Trigger Details: PartionId: 4, Offset: 2313528, EnqueueTimeUtc: 2025-01-24T12:17:15.2790000+00:00, SequenceNumber: 83, Count: 1
2025-01-24T12:17:15Z   [Verbose]   Sending invocation id: '2c1d9b76-7996-4969-bc9f-0f75c44c87ea
2025-01-24T12:17:15Z   [Verbose]   Posting invocation id:2c1d9b76-7996-4969-bc9f-0f75c44c87ea on workerId:ddebc811-63c6-49a3-a592-67b8baa429a3
2025-01-24T12:17:15Z   [Information]   {'message-id': {}, 'user-id': {'Length': 0, 'IsEmpty': True}, 'correlation-id': {}, 'content-type': 'application/json', 'x-opt-sequence-number-epoch': -1, 'x-opt-sequence-number': 83, 'x-opt-offset': 2313528, 'x-opt-enqueued-time': '2025-01-24T12:17:15.279+00:00', 'SequenceNumber': 83, 'Offset': 2313528, 'PartitionKey': None, 'EnqueuedTimeUtc': '2025-01-24T12:17:15.279'}
2025-01-24T12:17:15Z   [Information]   Executed 'Functions.exmp_func' (Succeeded, Id=2c1d9b76-7996-4969-bc9f-0f75c44c87ea, Duration=24ms)

requirements.txt file

azure-functions~=1.20.0
pydantic==2.9.2
opentelemetry-distro~=0.48b0
azure-monitor-opentelemetry-exporter~=1.0.0b29
numpy~=1.26.2
cloudevents~=1.11.0
markdown~=3.7
elastic-apm~=6.23

Where are you facing this problem?

Production Environment (explain below)

Additional Information

The Azure Function is hosted in B2 App Service Plan, communication goes through private VNet without any public access and everything is deployed in West Europe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant