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

OpenTelemetry trace context not transmitted when using rawPayload with Kafka #7372

Closed
KarstenWintermann opened this issue Jan 12, 2024 · 0 comments · Fixed by #7406
Closed
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@KarstenWintermann
Copy link
Contributor

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

1.12.3

1.1.x
1.0.x
edge: output of git describe --dirty

Expected Behavior

I subscribe to Kafka topics with raw data (i.e. not CloudEvents) and expect to receive the OpenTelemetry trace context which is present in the Kafka header field "traceparent" in the corresponding http header field "traceparent".

Actual Behavior

The header field traceparent is received, but with all zeroes ("00-00000000000000000000000000000000-0000000000000000-00"). The same operation is successful when using CloudEvents.

This behavior prevents me from passing the OTel trace context between components.

Steps to Reproduce the Problem

The easiest way to reproduce is using the pubsub/java/http quickstart example.

In the checkout component, replace the line

.uri(URI.create(uri))

with

.uri(URI.create(uri + "?metadata.rawPayload=true&metadata.traceparent=00-555d5c767990a1d9029cfafb9884a7ab-dc66cf5a8aa8c6d2-01"))
(The value for "traceparent" is just a random example, which in reality would be created by the OTel runtime.)

Then add code to the order processing component which outputs the http headers:

    public ResponseEntity<?> processOrders(@RequestBody Order body, @RequestHeader Map<String, String> headers) {
        logger.info("Subscriber received: "+ body.getOrderId());
        headers.forEach((key, value) -> {
            logger.info(String.format("Header '%s' = %s", key, value));
        });

        return ResponseEntity.ok().build();
    }

The output shows that "traceparent" is received as zeroes ("00-00000000000000000000000000000000-0000000000000000-00") while other Kafka header fields like "rawPayload" are passed as http headers unmodified.

Release Note

RELEASE NOTE: FIX OpenTelemetry trace context passed correctly when using rawPayload with Kafka

@KarstenWintermann KarstenWintermann added the kind/bug Something isn't working label Jan 12, 2024
KarstenWintermann added a commit to KarstenWintermann/dapr that referenced this issue Jan 18, 2024
…h Kafka

Fixes dapr#7372

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>
@yaron2 yaron2 added this to the v1.13 milestone Jan 18, 2024
artursouza added a commit that referenced this issue Jan 19, 2024
…e caller (#7406)

* Prevent invalid traceparent ("00-00000...") from being returned to the caller

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

* OpenTelemetry trace context not transmitted when using rawPayload with Kafka
Fixes #7372

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

---------

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Artur Souza <asouza.pro@gmail.com>
whytem pushed a commit to whytem/dapr that referenced this issue Jan 22, 2024
…e caller (dapr#7406)

* Prevent invalid traceparent ("00-00000...") from being returned to the caller

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

* OpenTelemetry trace context not transmitted when using rawPayload with Kafka
Fixes dapr#7372

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

---------

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Artur Souza <asouza.pro@gmail.com>
elena-kolevska pushed a commit to elena-kolevska/dapr that referenced this issue Jan 24, 2024
…e caller (dapr#7406)

* Prevent invalid traceparent ("00-00000...") from being returned to the caller

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

* OpenTelemetry trace context not transmitted when using rawPayload with Kafka
Fixes dapr#7372

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

---------

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Artur Souza <asouza.pro@gmail.com>
elena-kolevska pushed a commit to elena-kolevska/dapr that referenced this issue Jan 25, 2024
…e caller (dapr#7406)

* Prevent invalid traceparent ("00-00000...") from being returned to the caller

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

* OpenTelemetry trace context not transmitted when using rawPayload with Kafka
Fixes dapr#7372

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>

---------

Signed-off-by: Karsten Wintermann <58027075+KarstenWintermann@users.noreply.github.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
Co-authored-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants