Skip to content

fix(loki.process): Implement encoding.TextMarshaler and encoding.TextUnmarshaler for TruncateSourceType#5419

Merged
kalleep merged 5 commits intomainfrom
kalleep/fix-truncate-source-type
Feb 4, 2026
Merged

fix(loki.process): Implement encoding.TextMarshaler and encoding.TextUnmarshaler for TruncateSourceType#5419
kalleep merged 5 commits intomainfrom
kalleep/fix-truncate-source-type

Conversation

@kalleep
Copy link
Contributor

@kalleep kalleep commented Feb 2, 2026

Pull Request Details

It was impossible to configure source_type for stage.truncate and would always result in a panic. For these custom enum types we need to implement encoding.TextUnmarshaler for it to be configurable.

Issue(s) fixed by this Pull Request

Fixes: #5410

Notes to the Reviewer

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated

Copy link
Member

@blewis12 blewis12 left a comment

Choose a reason for hiding this comment

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

Shall we add a basic sanity-check style test for this? Other than that, LGTM

@kalleep
Copy link
Contributor Author

kalleep commented Feb 4, 2026

@blewis12 I added a test to parse alloy syntax for this block.

I also noticed that the documentation was wrong. We document source but it's actually sources and is an array of strings.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

💻 Deploy preview deleted (fix(loki.process): Implement encoding.TextMarshaler and encoding.TextUnmarshaler for TruncateSourceType).

@kalleep kalleep added the backport/v1.13 Backport to release/v1.13 label Feb 4, 2026
@kalleep kalleep merged commit 8f6c1b3 into main Feb 4, 2026
55 checks passed
@kalleep kalleep deleted the kalleep/fix-truncate-source-type branch February 4, 2026 10:05
grafana-alloybot bot pushed a commit that referenced this pull request Feb 4, 2026
…Unmarshaler for TruncateSourceType (#5419)

### Pull Request Details

It was impossible to configure `source_type` for `stage.truncate` and
would always result in a panic. For these custom enum types we need to
implement `encoding.TextUnmarshaler` for it to be configurable.

### Issue(s) fixed by this Pull Request

Fixes: #5410

### Notes to the Reviewer

<!-- Add any relevant notes for the reviewers and testers of this PR.
-->

### PR Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] Documentation added
- [x] Tests updated
- [ ] Config converters updated

(cherry picked from commit 8f6c1b3)
kalleep added a commit that referenced this pull request Feb 4, 2026
…Unmarshaler for TruncateSourceType [backport] (#5428)

## Backport of #5419

This PR backports #5419 to release/v1.13.

### Original PR Author
@kalleep

### Description
### Pull Request Details

It was impossible to configure `source_type` for `stage.truncate` and
would always result in a panic. For these custom enum types we need to
implement `encoding.TextUnmarshaler` for it to be configurable.

### Issue(s) fixed by this Pull Request

Fixes: #5410

### Notes to the Reviewer

<!-- Add any relevant notes for the reviewers and testers of this PR.
-->

### PR Checklist

<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] Documentation added
- [x] Tests updated
- [ ] Config converters updated


---
*This backport was created automatically.*

Co-authored-by: Karl Persson <23356117+kalleep@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v1.13 Backport to release/v1.13 frozen-due-to-age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loki.process stage.truncate panic when explicitly defining source_type="line"

3 participants