ottl: improve Len() unsupported type error diagnostics#46476
Merged
Conversation
Contributor
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better! |
Member
|
/workflow-approve |
Member
|
/workflow-approve |
florianl
approved these changes
Feb 27, 2026
edmocosta
approved these changes
Mar 2, 2026
Member
|
/workflow-approve |
Contributor
|
Thank you for your contribution @rite7sh! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help. |
antonio-mazzini
pushed a commit
to antonio-mazzini/opentelemetry-collector-contrib
that referenced
this pull request
Mar 5, 2026
…y#46476) #### Description Enhances error diagnostics in the `Len()` OTTL function by including the runtime type when an unsupported target type is encountered. Previously, unsupported types returned a generic error message: `errors.New(typeError)` This change replaces it with: `fmt.Errorf("Len: unsupported target type %T. %s", val, typeError)` This improves debugging clarity for OTTL users without modifying execution logic, control flow, or return values for valid inputs. --- #### Link to tracking issue N/A — small diagnostic improvement aligned with ongoing OTTL type‑system stabilization and compilation optimization efforts. --- #### Testing - Ran targeted tests for Len(): `go test -v -run Len ./pkg/ottl/ottlfuncs` - Executed full ottlfuncs package tests - Executed full OTTL module tests - Verified error paths still trigger correctly - Confirmed success paths remain unchanged - No test assertions depended on exact error string text All tests pass successfully. --- #### Documentation No documentation changes required. This change only improves runtime error diagnostics and does not alter user‑facing configuration or function behavior. --------- Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com> Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
avleentwilio
pushed a commit
to avleentwilio/opentelemetry-collector-contrib
that referenced
this pull request
Apr 1, 2026
…y#46476) #### Description Enhances error diagnostics in the `Len()` OTTL function by including the runtime type when an unsupported target type is encountered. Previously, unsupported types returned a generic error message: `errors.New(typeError)` This change replaces it with: `fmt.Errorf("Len: unsupported target type %T. %s", val, typeError)` This improves debugging clarity for OTTL users without modifying execution logic, control flow, or return values for valid inputs. --- #### Link to tracking issue N/A — small diagnostic improvement aligned with ongoing OTTL type‑system stabilization and compilation optimization efforts. --- #### Testing - Ran targeted tests for Len(): `go test -v -run Len ./pkg/ottl/ottlfuncs` - Executed full ottlfuncs package tests - Executed full OTTL module tests - Verified error paths still trigger correctly - Confirmed success paths remain unchanged - No test assertions depended on exact error string text All tests pass successfully. --- #### Documentation No documentation changes required. This change only improves runtime error diagnostics and does not alter user‑facing configuration or function behavior. --------- Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com> Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> Co-authored-by: Christos Markou <chrismarkou92@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Enhances error diagnostics in the
Len()OTTL function by including the runtime type when an unsupported target type is encountered.Previously, unsupported types returned a generic error message:
errors.New(typeError)This change replaces it with:
fmt.Errorf("Len: unsupported target type %T. %s", val, typeError)This improves debugging clarity for OTTL users without modifying execution logic, control flow, or return values for valid inputs.
Link to tracking issue
N/A — small diagnostic improvement aligned with ongoing OTTL type‑system stabilization and compilation optimization efforts.
Testing
go test -v -run Len ./pkg/ottl/ottlfuncsAll tests pass successfully.
Documentation
No documentation changes required.
This change only improves runtime error diagnostics and does not alter user‑facing configuration or function behavior.