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

[cmd/telemetrygen] ensure validate is called #35745

Merged

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Oct 11, 2024

Prior to this change, the Validate func wasn't being called resulting in wonky error messages like the following:

2024-10-10T15:39:40.139-0700    INFO    logs/worker.go:49       stopping the exporter   {"worker": 0}
panic: runtime error: cannot convert slice with length 8 to array or pointer to array with length 16

goroutine 6 [running]:
github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.worker.simulateLogs({0x140002404c4, 0x1, {0x100dd3152, 0xb}, 0x9, {0x100dccf6b, 0x4}, 0x0, 0x7fefffffffffffff, 0x140002404e0, ...}, ...)
        github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs/worker.go:70 +0xa34
created by github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.Run in goroutine 1

With the validation in place, we now get a useful error message:

Error: TraceID must be a 32 character hex string, like: 'ae87dadd90e9935a4bc9660628efd569'

@codeboten codeboten requested review from mx-psi and a team as code owners October 11, 2024 17:42
@github-actions github-actions bot added the cmd/telemetrygen telemetrygen command label Oct 11, 2024
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

woops

Prior to this change, the Validate func wasn't being called resulting in wonky error messages
like the following:

```
2024-10-10T15:39:40.139-0700    INFO    logs/worker.go:49       stopping the exporter   {"worker": 0}
panic: runtime error: cannot convert slice with length 8 to array or pointer to array with length 16

goroutine 6 [running]:
github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.worker.simulateLogs({0x140002404c4, 0x1, {0x100dd3152, 0xb}, 0x9, {0x100dccf6b, 0x4}, 0x0, 0x7fefffffffffffff, 0x140002404e0, ...}, ...)
        github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs/worker.go:70 +0xa34
created by github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.Run in goroutine 1
```

With the validation in place, we now get a useful error message:

```
Error: TraceID must be a 32 character hex string, like: 'ae87dadd90e9935a4bc9660628efd569'
```

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
@codeboten codeboten force-pushed the codeboten/validate-telemetrygen branch from f1c4ab0 to ddb1e12 Compare October 11, 2024 18:37
@codeboten codeboten merged commit 1e1a945 into open-telemetry:main Oct 11, 2024
158 checks passed
@codeboten codeboten deleted the codeboten/validate-telemetrygen branch October 11, 2024 20:31
@github-actions github-actions bot added this to the next release milestone Oct 11, 2024
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
Prior to this change, the Validate func wasn't being called resulting in
wonky error messages like the following:

```
2024-10-10T15:39:40.139-0700    INFO    logs/worker.go:49       stopping the exporter   {"worker": 0}
panic: runtime error: cannot convert slice with length 8 to array or pointer to array with length 16

goroutine 6 [running]:
github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.worker.simulateLogs({0x140002404c4, 0x1, {0x100dd3152, 0xb}, 0x9, {0x100dccf6b, 0x4}, 0x0, 0x7fefffffffffffff, 0x140002404e0, ...}, ...)
        github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs/worker.go:70 +0xa34
created by github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen/internal/logs.Run in goroutine 1
```

With the validation in place, we now get a useful error message:

```
Error: TraceID must be a 32 character hex string, like: 'ae87dadd90e9935a4bc9660628efd569'
```

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd/telemetrygen telemetrygen command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants