Skip to content
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: add startup logging #685

Merged
merged 32 commits into from
Jul 8, 2020
Merged

ddtrace/tracer: add startup logging #685

merged 32 commits into from
Jul 8, 2020

Conversation

knusbaum
Copy link
Contributor

@knusbaum knusbaum commented Jun 24, 2020

This commit adds a json-formatted log line to tracer startup in order make
debugging the tracer easier.

This is part of an effort that spans all tracers, and should follow the specification.

The basic idea is to collect commonly-needed information as the tracer starts up and report it in one json-formatted log line.

@knusbaum knusbaum added this to the 1.26.0 milestone Jun 24, 2020
@knusbaum knusbaum requested review from cgilmour and gbbr and removed request for cgilmour and gbbr June 25, 2020 19:44
ddtrace/tracer/startup.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/startup.go Outdated Show resolved Hide resolved
ddtrace/tracer/startup.go Outdated Show resolved Hide resolved
ddtrace/tracer/startup_darwin.go Outdated Show resolved Hide resolved
ddtrace/tracer/startup_default.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Outdated Show resolved Hide resolved
@knusbaum knusbaum marked this pull request as ready for review June 30, 2020 21:20
ddtrace/tracer/option.go Outdated Show resolved Hide resolved
ddtrace/tracer/transport.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now. Can we document the struct and funcs in log.go too?

ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log_test.go Outdated Show resolved Hide resolved
ddtrace/tracer/option.go Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/tracer_test.go Outdated Show resolved Hide resolved
@knusbaum knusbaum requested a review from gbbr July 2, 2020 14:49
ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Show resolved Hide resolved
ddtrace/tracer/osinfo_linux.go Outdated Show resolved Hide resolved
ddtrace/tracer/osinfo_windows.go Show resolved Hide resolved
ddtrace/tracer/tracer.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/sampler.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Outdated Show resolved Hide resolved
Copy link
Member

@labbati labbati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @knusbaum for the work on this. I left a few comments.
Additionally:

  • I am not seeing the json object to be prepended by DATADOG TRACER CONFIGURATION. This is useful so both devs here in issues and our solutions team can ask to search in logs for that key phrase and copy/paste the value.
  • Every check that we do and fails (e.g. agent connectivity) should have an additional line DATADOG TRACER DIAGNOSTICS. So, as an example, for the field agent_error if it fails we should have both a message in the agent_error field (that will be copied an pasted to us) and a unique line in the logs with the same message containing the words DATADOG TRACER DIAGNOSTICS.

ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Show resolved Hide resolved
knusbaum and others added 3 commits July 6, 2020 08:43
Co-authored-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
Copy link
Contributor Author

@knusbaum knusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not happy with the verboseness of the DATADOG TRACER DIAGNOSTICS and DATADOG TRACER CONFIGURATION prefixes.

Instead, I'm just including DIAGNOSTICS and CONFIGURATION.

Then the logs will begin:
Datadog Tracer v1.26.0 WARN: DIAGNOSTICS
and
Datadog Tracer v1.26.0 INFO: CONFIGURATION
Does this work, @labbati, @gbbr ?

ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Show resolved Hide resolved
@knusbaum knusbaum requested review from labbati and gbbr July 6, 2020 23:25
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, but:

  • Please add tests for the returned error messages, it would be nice if they would be displayed as:
Error parsing DD_....:
    at index 1: ...
    at index 4: ...
  • The caps are terrible, why are they needed?
  • The verbosity of the logs is also not great and seems unnecessary.

ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/log.go Outdated Show resolved Hide resolved
ddtrace/tracer/option.go Show resolved Hide resolved
ddtrace/tracer/tracer.go Show resolved Hide resolved
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but I added another commit to clean up because those tests were looking very copy/pasta-ish. If you're happy with my latest commit, feel free to merge.

@knusbaum
Copy link
Contributor Author

knusbaum commented Jul 8, 2020

Perfect. Your changes look great.
Thanks Gabriel.

@knusbaum knusbaum merged commit 2c71ed7 into v1 Jul 8, 2020
knusbaum added a commit that referenced this pull request Jul 14, 2020
The merge of #692 conflicted with tests from #685, causing failures in ddtrace/tracer/log_test.go
There were also tests added in #685 in ddtrace/tracer/sampler_test.go which fail in go1.14 due to changes in json parsing.
@knusbaum knusbaum deleted the knusbaum/startup-logging branch July 14, 2020 16:15
mingrammer pushed a commit to mingrammer/dd-trace-go that referenced this pull request Dec 22, 2020
This commit adds a json-formatted log line and other diagnostic messages to
tracer startup in order make debugging the tracer easier.
mingrammer pushed a commit to mingrammer/dd-trace-go that referenced this pull request Dec 22, 2020
The merge of DataDog#692 conflicted with tests from DataDog#685, causing failures in ddtrace/tracer/log_test.go
There were also tests added in DataDog#685 in ddtrace/tracer/sampler_test.go which fail in go1.14 due to changes in json parsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants