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

Add profiler span labeler #62

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

sam-at-luther
Copy link
Member

No description provided.

@sam-at-luther sam-at-luther force-pushed the sam-at-luther/Add_profiler_fun_labeler branch from 30973c2 to 1206d25 Compare January 4, 2024 00:58
Comment on lines 53 to 67
userLabel = sanitizeRegExp.ReplaceAllString(userLabel, "_")
// Ensure the label doesn't start with a digit or special character
if len(userLabel) > 0 && !unicode.IsLetter(rune(userLabel[0])) {
userLabel = "label_" + userLabel
}

// Eliminate duplicate underscores
parts := strings.Split(userLabel, "_")
var nonEmptyParts []string
for _, part := range parts {
if part != "" {
nonEmptyParts = append(nonEmptyParts, part)
}
}
return strings.Join(nonEmptyParts, "_")
Copy link
Contributor

Choose a reason for hiding this comment

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

This prefixing behavior seems a bit non-intuitive. Would it make sense to just drop leading junk we don't want to allow or reject the label entirely and fall back to the function name?

@sam-at-luther sam-at-luther merged commit 7a9be90 into main Jan 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants