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
Performance investigation #1905
Draft
pawelchcki
wants to merge
15
commits into
main
Choose a base branch
from
pawel/test_env_mutex_theory
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+100
−62
Draft
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
32cd965
:fingers_crossed:
pawelchcki 260af67
w
pawelchcki 7435374
hack - remove more lock contention
pawelchcki e7631e9
make some of the examples less hacky
pawelchcki 9866591
log.level using atomic
pawelchcki 87ca737
fix undefined
pawelchcki 7cdd5b5
fix level tests
pawelchcki 2575be0
use atomic load for sampling priority instead of a mutex
pawelchcki 0923acd
fix tests
pawelchcki eb2406b
bring back span.Service mutex Usage
pawelchcki d366ec8
Merge remote-tracking branch 'origin/main' into pawel/test_env_mutex_…
pawelchcki 333ea95
Production DD_TRACE
pawelchcki 3a32f59
Merge remote-tracking branch 'origin/main' into pawel/test_env_mutex_…
pawelchcki a1f27e0
fix compilation after merge
pawelchcki f6a1336
fix nil pointer
pawelchcki File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
"strconv" | ||
"strings" | ||
"sync" | ||
"sync/atomic" | ||
"time" | ||
|
||
"gopkg.in/DataDog/dd-trace-go.v1/internal/version" | ||
|
@@ -39,11 +40,15 @@ | |
} | ||
|
||
var ( | ||
mu sync.RWMutex // guards below fields | ||
level = LevelWarn | ||
level atomic.Int32 = atomic.Int32{} | ||
Check failure on line 43 in internal/log/log.go GitHub Actions / PR Unit and Integration Tests / lint
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
mu sync.RWMutex // guards logger instance | ||
logger Logger = &defaultLogger{l: log.New(os.Stderr, "", log.LstdFlags)} | ||
) | ||
|
||
func init() { | ||
level.Store(int32(LevelWarn)) | ||
} | ||
|
||
// UseLogger sets l as the active logger and returns a function to restore the | ||
// previous logger. The return value is mostly useful when testing. | ||
func UseLogger(l Logger) (undo func()) { | ||
|
@@ -59,18 +64,14 @@ | |
|
||
// SetLevel sets the given lvl for logging. | ||
func SetLevel(lvl Level) { | ||
mu.Lock() | ||
defer mu.Unlock() | ||
level = lvl | ||
level.Store(int32(lvl)) | ||
} | ||
|
||
// DebugEnabled returns true if debug log messages are enabled. This can be used in extremely | ||
// hot code paths to avoid allocating the ...interface{} argument. | ||
func DebugEnabled() bool { | ||
mu.RLock() | ||
lvl := level | ||
mu.RUnlock() | ||
return lvl == LevelDebug | ||
lvl := level.Load() | ||
return lvl == int32(LevelDebug) | ||
} | ||
|
||
// Debug prints the given message if the level is LevelDebug. | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
var-declaration: should omit type atomic.Bool from declaration of var TraceID128BitEnabled; it will be inferred from the right-hand side (revive)