Skip to content

ottl: improve Len() unsupported type error diagnostics#46476

Merged
ChrsMark merged 8 commits into
open-telemetry:mainfrom
rite7sh:ottl-type-metadata
Mar 3, 2026
Merged

ottl: improve Len() unsupported type error diagnostics#46476
ChrsMark merged 8 commits into
open-telemetry:mainfrom
rite7sh:ottl-type-metadata

Conversation

@rite7sh

@rite7sh rite7sh commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
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!

@github-actions github-actions Bot added first-time contributor PRs made by new contributors pkg/ottl labels Feb 26, 2026
@paulojmdias

Copy link
Copy Markdown
Member

/workflow-approve

@paulojmdias

Copy link
Copy Markdown
Member

/workflow-approve

@edmocosta edmocosta added the ready to merge Code review completed; ready to merge by maintainers label Mar 2, 2026
@paulojmdias

Copy link
Copy Markdown
Member

/workflow-approve

@ChrsMark ChrsMark merged commit b92c04d into open-telemetry:main Mar 3, 2026
191 checks passed
@otelbot

otelbot Bot commented Mar 3, 2026

Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor PRs made by new contributors pkg/ottl ready to merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants