Skip to content

Fix crash for non-utf8 thread names #324

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fcecagno
Copy link

@fcecagno fcecagno commented Nov 11, 2024

Resolve conflicts of #240
Fix #227
Fix #239
Fix #323

@@ -318,33 +319,34 @@ func (p *NamedProcessCollector) scrape(ch chan<- prometheus.Metric) {

if p.threads {
for _, thr := range gcounts.Threads {
threadName := filterNonutf8Characters(thr.Name)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
threadName := filterNonutf8Characters(thr.Name)
threadName := strings.ToValidUTF8(thr.Name, "\uFFFD")

I believe this is the "replacement character" that's commonly used for invalid utf-8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants