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

.*: Add support for tracing with Lightstep #1678

Merged
merged 9 commits into from
Nov 19, 2019

Conversation

antonio
Copy link
Contributor

@antonio antonio commented Oct 23, 2019

This patch adds support to use Lightstep as a tracing provider.

The implementation follows the Lightstep client library documentation, but does not set an event handler to log events as it was incredibly noisy and not really useful, making it impossible to follow what was going on in the logs. The output was similar to lines below, with a new line every 2-3 seconds.

level=info ts=2019-10-23T11:14:38.16467172Z caller=lightstep.go:55 msg="STATUS REPORT start: 2019-10-23 04:14:35.636670112 -0700 PDT m=+455.516288412, end: 2019-10-23 04:14:38.136701963 -0700 PDT m=+458.016320258, dropped spans: 0, encoding errors: 0" 
level=info ts=2019-10-23T11:14:40.66495401Z caller=lightstep.go:55 msg="STATUS REPORT start: 2019-10-23 04:14:38.136701963 -0700 PDT m=+458.016320258, end: 2019-10-23 04:14:40.636668107 -0700 PDT m=+460.516286403, dropped spans: 0, encoding errors: 0" 
level=info ts=2019-10-23T11:14:43.165782205Z caller=lightstep.go:55 msg="STATUS REPORT start: 2019-10-23 04:14:40.636668107 -0700 PDT m=+460.516286403, end: 2019-10-23 04:14:43.136700344 -0700 PDT m=+463.016318639, dropped spans: 0, encoding errors: 0" 
level=info ts=2019-10-23T11:14:45.664835433Z caller=lightstep.go:55 msg="STATUS REPORT start: 2019-10-23 04:14:43.136700344 -0700 PDT m=+463.016318639, end: 2019-10-23 04:14:45.636658483 -0700 PDT m=+465.516276779, dropped spans: 0, encoding errors: 0" 

Lightstep allows setting up many more options when instantiating the tracer, but I decided to keep it simple for now and only make it possible to set the access token (required) and the address of the collector.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

  • Add Lightstep as a tracing provider.

Verification

I've tested it against our on-prem installation.

pkg/tracing/lightstep/lightstep.go Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Nice! LGTM, small nits only (:

docs/tracing.md Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved

// Collector is the host, port, and plaintext option to use
// for the collector.
Collector lightstep.Endpoint `yaml:"collector"`
Copy link
Member

Choose a reason for hiding this comment

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

reusing config 👍 nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😄

pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
pkg/tracing/lightstep/lightstep.go Outdated Show resolved Hide resolved
antonio and others added 5 commits October 25, 2019 08:23
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Co-Authored-By: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Co-Authored-By: Povilas Versockas <p.versockas@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
@antonio
Copy link
Contributor Author

antonio commented Oct 25, 2019

Please hold off on merging this one for now: I'm not sure it's related, but I'm experiencing issues when trying to kill the program with Ctrl-C. I'll investigate it further on Monday.

@antonio
Copy link
Contributor Author

antonio commented Oct 28, 2019

Please hold off on merging this one for now: I'm not sure it's related, but I'm experiencing issues when trying to kill the program with Ctrl-C. I'll investigate it further on Monday.

This is unrelated to this PR. I paired with a coworker on it today and he submitted a new PR fixing the issue.

@bwplotka
Copy link
Member

Nice one, thanks. My changed was added as well: lightstep/lightstep-tracer-go#228
Can we upgrade this dep?

@antonio
Copy link
Contributor Author

antonio commented Oct 29, 2019

Can we upgrade this dep?

Sure, but they haven't released a new version yet as far as I can tell.

@GiedriusS
Copy link
Member

Can we upgrade this dep?

Sure, but they haven't released a new version yet as far as I can tell.

Do they have any release cadence?

@antonio
Copy link
Contributor Author

antonio commented Oct 30, 2019

Do they have any release cadence?

From what I can see in the git tags, no. I've asked them in lightstep/lightstep-tracer-go#228 (comment)

@antonio
Copy link
Contributor Author

antonio commented Nov 6, 2019

A heads up that I'm still waiting for Lightstep to release a new version that includes @bwplotka's changes. Alternatively, we could merge this as it is and update it once the updated library is out.

@GiedriusS
Copy link
Member

@antonio seems like it was released. Care to update this PR so that we could add support for Lightstep tracing in Thanos? (:

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
lightstep/lightstep-tracer-go#228 introduced a
new method to create a Tracer that returns an error when it does not
succeed, instead of nil

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
@antonio
Copy link
Contributor Author

antonio commented Nov 18, 2019

Care to update this PR so that we could add support for Lightstep tracing in Thanos? (:

Done!

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for the good work.

@GiedriusS GiedriusS merged commit f840e18 into thanos-io:master Nov 19, 2019
IKSIN pushed a commit to monitoring-tools/thanos that referenced this pull request Nov 26, 2019
* Add support for tracing with Lightstep

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Remove type cast

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Add documentation for the exported methods and types

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Apply suggestions from @bwplotka

Co-Authored-By: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Inline variable

Co-Authored-By: Povilas Versockas <p.versockas@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Update lightstep library and add proper error handling

lightstep/lightstep-tracer-go#228 introduced a
new method to create a Tracer that returns an error when it does not
succeed, instead of nil

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Remove unused import

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
Signed-off-by: Aleksey Sin <asin@ozon.ru>
fatsheep9146 pushed a commit to fatsheep9146/thanos that referenced this pull request Dec 4, 2019
* Add support for tracing with Lightstep

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Remove type cast

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Add documentation for the exported methods and types

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Apply suggestions from @bwplotka

Co-Authored-By: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Inline variable

Co-Authored-By: Povilas Versockas <p.versockas@gmail.com>
Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Update lightstep library and add proper error handling

lightstep/lightstep-tracer-go#228 introduced a
new method to create a Tracer that returns an error when it does not
succeed, instead of nil

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>

* Remove unused import

Signed-off-by: Antonio Santos <antonio@santosvelasco.com>
@antonio antonio deleted the lightstep-tracing branch December 17, 2019 12:03
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.

4 participants