From 1dce8ed9cb70b2953e4d3a680f8bf12a3d6d3cf9 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Thu, 30 Nov 2023 15:12:03 -0500 Subject: [PATCH] update doc comments about perf gains when including key prefix --- beeline.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/beeline.go b/beeline.go index c04798d4..835ac554 100644 --- a/beeline.go +++ b/beeline.go @@ -274,8 +274,10 @@ func Close() { // add.This function is good for span-level data, eg timers or the arguments to // a specific function call, etc. // -// Field keys added will be prefixed with `app.` if the key does not already have -// that prefix. +// Field keys added will be prefixed with 'app.' if the prefix is not already +// present on the key name. If you provide a key that starts with 'app.', both +// speed and memory allocations are improved, especially within hot paths of +// your application. // // Errors are treated as a special case for convenience: if `val` is of type // `error` then the key is set to the error's message in the span. @@ -302,8 +304,10 @@ func AddField(ctx context.Context, key string, val interface{}) { // context that is better scoped to the request than this specific unit of work, // eg user IDs, globally relevant feature flags, errors, etc. // -// Field keys added will be prefixed with `app.` if the key does not already have -// that prefix. +// Field keys added will be prefixed with 'app.' if the prefix is not already +// present on the key name. If you provide a key that starts with 'app.', both +// speed and memory allocations are improved, especially within hot paths of +// your application. func AddFieldToTrace(ctx context.Context, key string, val interface{}) { tr := trace.GetTraceFromContext(ctx) if tr != nil {