-
Notifications
You must be signed in to change notification settings - Fork 435
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
ddtrace/tracer: implement fmt.Formatter interface to support log injection #657
Conversation
…ction This change implements `fmt.Formatter` to allow printing a span in various formats for logging.
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.
LGTM on last comment for tests.
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.
I think we need to do our best to find the information needed in a log, even if the tracer might be stopped. If the tracer is absent, we can still get a:
- Service by checking
globalconfig.ServiceName()
- Env by checking
DD_ENV
- Version by checking
DD_VERSION
We shouldn't give up as easily by leaving them empty.
Hmmm. I'm not sure how best to implement picking up i.e. But Currently there's no way for |
If you mean specifically in the fallback when no tracer is started, in that case ignore these. It's just a fallback. 99.9% of the time this won't happen. Plus, tags are not the right place to set service, env and version. |
Sorry for causing confusion here. I have deleted some of my comments around I will put up another PR around picking up env, version, and service from This PR handles only the logging of env, version, and service. |
…ction (DataDog#657) This change implements `fmt.Formatter` to allow printing a span in various formats for logging.
This change implements
fmt.Formatter
to allow printing a span in various formats for logging.