diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index b8ce5cb907..e6bd299e0d 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -78,6 +78,10 @@ jobs: # If ever it's needed, a valid key exists in the repo, using ${{ secrets.DD_API_KEY }} DD_API_KEY: 1234567890abcdef1234567890abcdef CMAKE_BUILD_PARALLEL_LEVEL: 12 + AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION` steps: - name: Checkout system tests @@ -132,6 +136,10 @@ jobs: # If ever it's needed, a valid key exists in the repo, using ${{ secrets.DD_API_KEY }} DD_API_KEY: 1234567890abcdef1234567890abcdef CMAKE_BUILD_PARALLEL_LEVEL: 12 + AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: us-east-1 + AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION` steps: - name: Checkout system tests diff --git a/ddtrace/contrib/internal/kafka/patch.py b/ddtrace/contrib/internal/kafka/patch.py index 40f633bcf8..74a65e4c84 100644 --- a/ddtrace/contrib/internal/kafka/patch.py +++ b/ddtrace/contrib/internal/kafka/patch.py @@ -249,7 +249,7 @@ def _instrument_message(messages, pin, start_ns, instance, err): for message in messages: if message is not None and first_message is not None: - core.set_item("kafka_topic", first_message.topic()) + core.set_item("kafka_topic", str(first_message.topic())) core.dispatch("kafka.consume.start", (instance, first_message, span)) span.set_tag_str(MESSAGING_SYSTEM, kafkax.SERVICE) @@ -260,7 +260,7 @@ def _instrument_message(messages, pin, start_ns, instance, err): if first_message is not None: message_key = first_message.key() or "" message_offset = first_message.offset() or -1 - span.set_tag_str(kafkax.TOPIC, first_message.topic()) + span.set_tag_str(kafkax.TOPIC, str(first_message.topic())) # If this is a deserializing consumer, do not set the key as a tag since we # do not have the serialization function diff --git a/releasenotes/notes/kafka_message_topic_none_fix-2bc3fd6388075b94.yaml b/releasenotes/notes/kafka_message_topic_none_fix-2bc3fd6388075b94.yaml new file mode 100644 index 0000000000..05f9a9c6e5 --- /dev/null +++ b/releasenotes/notes/kafka_message_topic_none_fix-2bc3fd6388075b94.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + kafka: Fixed an issue where a ``TypeError`` exception would be raised if the first message's ``topic()`` returned ``None`` during consumption.