-
Notifications
You must be signed in to change notification settings - Fork 228
chore: give hint of configuration on otel invalid utf8 errors #2551
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
Merged
+87
−7
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c41d92c
fix: log configuration
SkArchon eb1a06e
fix: reword hints
SkArchon 871a17d
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon 17654dc
fix: review comments
SkArchon e79e68e
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon 6074fd1
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon c88bf2d
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon 91adabb
fix: add envars
SkArchon 3fb13fc
fix: updates
SkArchon 63f138f
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon e32c73b
fix: updates
SkArchon 9b2440d
Merge branch 'main' into milinda/log-otel-errors-with-addition
SkArchon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package trace | ||
|
|
||
| import ( | ||
| "errors" | ||
| "go.uber.org/zap" | ||
| ) | ||
|
|
||
| // invalidUTF8Error matches the InvalidUTF8() method exposed by | ||
| // google.golang.org/protobuf/internal/impl.errInvalidUTF8. | ||
| type invalidUTF8Error interface { | ||
| InvalidUTF8() bool | ||
| } | ||
|
|
||
| // hasInvalidUTF8Error walks the error chain looking for an error | ||
| // that implements the invalidUTF8Error interface. | ||
| func hasInvalidUTF8Error(err error) bool { | ||
| var target invalidUTF8Error | ||
| if errors.As(err, &target) { | ||
| return target.InvalidUTF8() | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| func errHandler(config *ProviderConfig) func(err error) { | ||
| return func(err error) { | ||
| if hasInvalidUTF8Error(err) { | ||
StarpTech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| config.Logger.Error( | ||
| "otel error: traces export: string field contains invalid UTF-8: Enable 'telemetry.tracing.sanitize_utf8.enabled' in your config to sanitize invalid UTF-8 attributes.", | ||
| zap.Error(err)) | ||
| return | ||
| } | ||
| config.Logger.Error("otel error", zap.Error(err)) | ||
| } | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.