-
Notifications
You must be signed in to change notification settings - Fork 29
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
Profiler: wrapper zap logger for datadog tracer agent #723
base: main
Are you sure you want to change the base?
Conversation
507898e
to
4e5f9b1
Compare
Datadog ReportBranch report: ✅ |
Datadog ReportBranch report: ❄️ New Flaky Tests (3)
|
// Log sends an error log through the wrapped zap SugaredLogger | ||
func (ddLogger ZapDDLogger) Log(msg string) { | ||
switch { | ||
case strings.Contains(msg, "ERROR"): |
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.
string matching can quickly become inefficient and also prone to cAse-mismatched.
- how does the tracer work? Is it a separate process that will consume our existing logs?
- does this prevent our existing logs from being published?
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.
-
The datadog tracer interface for logging uses and requires one and only one function;
logger.Log(msg string)
. No levels, despite having levels in the message. While string matching is basic, it's simple enough and will allow us to have the tracer log at the expected level using our regular logger. If you think we might miss errors with this parsing, I'd be happy to move the default to error in case the format changes or the parsing breaks. -
The tracer works as a single instance across all packages. It emits non-critical but useful logs from times to times, such as the Startup Log, and some warnings/errors when it can't reach the agent. At creation, it has an option to use a given logger we input. I would like to use our regular Zap contextualised logger for this, to make those logs have the same context as every other logs we have.
-
No it doesn't; currently our logging is the same as usual, but logs created by the Tracer lack some of the context and formatting our regular logs have. They also all appear as errors.
What does this PR do?
Please briefly describe your changes as well as the motivation behind them:
Code Quality Checklist
Testing
unit
tests orend-to-end
tests.unit
tests orend-to-end
tests.