Skip to content

fix(eventing): suppress verbose OTEL logging in EventTransform#8866

Open
khushiiagrawal wants to merge 2 commits intoknative:mainfrom
khushiiagrawal:bugfix/8846-eventtransform-otel
Open

fix(eventing): suppress verbose OTEL logging in EventTransform#8866
khushiiagrawal wants to merge 2 commits intoknative:mainfrom
khushiiagrawal:bugfix/8846-eventtransform-otel

Conversation

@khushiiagrawal
Copy link

Fixes #8846

Currently, when Eventing telemetry is enabled, the transform-jsonata component defaults to using the ConsoleSpanExporter. This causes verbose JSON trace data to be flooded into the container logs (stdout) instead of being sent to the configured OpenTelemetry collector. This makes the logs difficult to read and prevents traces from reaching the centralized monitoring system.

Proposed Changes

  • 🐛 Fix bug

This PR updates the transform-jsonata deployment to properly configure the OpenTelemetry SDK for Node.js:

  1. Injects Standard OTEL Config: Modified pkg/reconciler/eventtransform/resources_jsonata.go to generate standard OpenTelemetry environment variables (OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_TRACES_SAMPLER, etc.) derived from the Knative config-observability map.

  2. Enables Auto-Configuration: By passing these environment variables, the Node.js OTEL SDK in the container can now automatically detect the correct configuration and switch from the console exporter to the OTLP exporter, respecting the user's tracing endpoint and sampling settings.

Pre-review Checklist

  • At least 80% unit test coverage (Verified locally with new test cases)
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Fixed an issue where EventTransform components would log verbose OpenTelemetry traces to stdout instead of sending them to the configured tracing endpoint. 

Docs

Signed-off-by: khushiiagrawal <khushisaritaagrawal@gmail.com>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 28, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@knative-prow
Copy link

knative-prow bot commented Jan 28, 2026

Welcome @khushiiagrawal! It looks like this is your first PR to knative/eventing 🎉

@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 28, 2026

Hi @khushiiagrawal. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow bot requested review from Cali0707 and pierDipi January 28, 2026 12:43
@khushiiagrawal
Copy link
Author

/retest

@knative-prow
Copy link

knative-prow bot commented Jan 28, 2026

@khushiiagrawal: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Cali0707 Cali0707 requested a review from creydr January 28, 2026 13:49
@khushiiagrawal
Copy link
Author

@Cali0707 @pierDipi @creydr Please take a look.
Appreciate your time.

@khushiiagrawal
Copy link
Author

@creydr a gentle ping 😄

@creydr
Copy link
Member

creydr commented Feb 5, 2026

/ok-to-test
/cc @Cali0707

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 5, 2026
@khushiiagrawal
Copy link
Author

@creydr all the tests have been passed, do let me know if any other changes required :)
Thanks!

@khushiiagrawal
Copy link
Author

@Cali0707 could you please take a look once you get some time.
thanks a lot !

Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @khushiiagrawal - nice start!

I added some comments around changes I think we will need, and then this should be good to merge

// These are standard OpenTelemetry environment variables that the Node.js SDK
// automatically reads to configure the trace exporter.
OTELExporterEndpointEnv = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"
OTELExporterProtocolEnv = "OTEL_EXPORTER_OTLP_PROTOCOL"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are setting the endpoint for just traces, let's also only specify the protocol for traces. Otherwise this will affect logs and metrics as well (without us providing an endpoint for those).

Suggested change
OTELExporterProtocolEnv = "OTEL_EXPORTER_OTLP_PROTOCOL"
OTELExporterProtocolEnv = "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL"

}

// Configure sampling if a sampling rate is set
if tracingCfg.SamplingRate > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe handle the case where tracingCfg.SamplingRate == 0 - in thise case we would want the sampler to be set to always_off

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also check when SamplingRate == 1, as then we would want always_on, to avoid the extra computations of sampling and preserve expected semantics from the config

Comment on lines 132 to 141
append(
[]corev1.EnvVar{
{
Name: "JSONATA_TRANSFORM_FILE_NAME",
Value: filepath.Join(JsonataExpressionPath, JsonataExpressionDataKey),
},
},
},
cw.ToEnvVars()...,
cw.ToEnvVars()...,
),
otelTracingEnvVars(cw)...,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add some test cases to eventtransform_test.go that verify that the env vars are set correctly on the deployment

{
Name: "JSONATA_TRANSFORM_FILE_NAME",
Value: filepath.Join(JsonataExpressionPath, JsonataExpressionDataKey),
append(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try to refactor this somehow? Having two nested appends here is somewhat hard to read.

…onata deployment

Signed-off-by: khushiiagrawal <khushisaritaagrawal@gmail.com>
@knative-prow
Copy link

knative-prow bot commented Feb 13, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: khushiiagrawal
Once this PR has been reviewed and has the lgtm label, please ask for approval from cali0707. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 13, 2026
@khushiiagrawal
Copy link
Author

@Cali0707 thank you so much for the review. i have addressed all the changes, please take a look.
thanks!

@khushiiagrawal
Copy link
Author

@Cali0707 a gentle ping 😄

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

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventTransform logging OTEL traces when Eventing telemetry is enabled

3 participants