Skip to content

Commit

Permalink
rename func
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeGoldsmith committed Nov 28, 2023
1 parent e3cc49e commit c45be8e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions beeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func AddField(ctx context.Context, key string, val interface{}) {
span := trace.GetSpanFromContext(ctx)
if span != nil {
if val != nil {
namespacedKey := getNamespacedKey(key)
namespacedKey := maybeAddPrefix(key)
if valErr, ok := val.(error); ok {
// treat errors specially because it's a pain to have to
// remember to stringify them
Expand All @@ -300,7 +300,7 @@ func AddField(ctx context.Context, key string, val interface{}) {
// eg user IDs, globally relevant feature flags, errors, etc. Fields added here
// are prefixed with `app.`
func AddFieldToTrace(ctx context.Context, key string, val interface{}) {
namespacedKey := getNamespacedKey(key)
namespacedKey := maybeAddPrefix(key)
tr := trace.GetTraceFromContext(ctx)
if tr != nil {
tr.AddField(namespacedKey, val)
Expand Down Expand Up @@ -355,8 +355,8 @@ func readResponses(responses chan transmission.Response) {
}
}

// getNamespacedKey returns the key with the app. prefix if it doesn't already have one
func getNamespacedKey(key string) string {
// maybeAddPrefix returns the key with the app. prefix if it doesn't already have one
func maybeAddPrefix(key string) string {
if !strings.HasPrefix(key, "app.") {
key = "app." + key
}
Expand Down

0 comments on commit c45be8e

Please sign in to comment.