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

STR-440 OpenTelemetry tracing exporter #342

Merged
merged 12 commits into from
Oct 25, 2024
Merged

Conversation

delbonis
Copy link
Contributor

@delbonis delbonis commented Oct 1, 2024

Description

This PR is to support the OpenTelemetry exporter so we can have richer logging from our production environment.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

@delbonis
Copy link
Contributor Author

delbonis commented Oct 1, 2024

This does not compile because of conflicting versions of Tokio and the various OTLP crates. Opening this so others can look at it and maybe pick it up.

delbonis and others added 2 commits October 14, 2024 11:05
This deletes Cargo.lock because we couldn't get the deps to work anyways.
now it compiles at least-ish
@delbonis
Copy link
Contributor Author

Alright so it builds and inits properly, but now we're getting this issue when we try to run the client in a local test env with a url to a local Jaeger instance running:

OpenTelemetry trace error occurred. Exporter otlp encountered the following error(s): the grpc server returns error (Unknown error): , detailed error message: transport error tonic::transport::Error(Transport, hyper::Error(Io, Kind(ConnectionReset)))

We can run Jaeger now with ./contrib/jaeger.sh, so to replicate this issue just run that and run the functional tests normally with ./run_tests.sh fn_sync_genesis.

Cargo.toml Outdated Show resolved Hide resolved
@delbonis
Copy link
Contributor Author

Alright I tried it with opentelemetry-collector and it seems like Jaeger was just not listening for some inexplicable reason. This doesn't give the nice UI but it does show that the trace events are being generating by spamming strata-looking strings out in the docker output. I will investigate further but it's good to know it seems like this is merely a configuration issue now.

@delbonis
Copy link
Contributor Author

Figured out the Jaeger thing, I was just using an ancient version of Jaeger because I copypasted a docker command from their docs that wasn't recent, so it didn't support the OpenTelemetry collector.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 35.00000% with 65 lines in your changes missing coverage. Please review.

Project coverage is 57.19%. Comparing base (e5b0753) to head (072fa02).
Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
crates/common/src/logging.rs 43.07% 37 Missing ⚠️
bin/strata-client/src/main.rs 0.00% 27 Missing ⚠️
bin/bridge-client/src/main.rs 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
+ Coverage   57.06%   57.19%   +0.12%     
==========================================
  Files         255      257       +2     
  Lines       26993    27226     +233     
==========================================
+ Hits        15403    15571     +168     
- Misses      11590    11655      +65     
Files with missing lines Coverage Δ
bin/bridge-client/src/descriptor.rs 50.48% <100.00%> (+0.98%) ⬆️
bin/strata-client/src/extractor.rs 96.52% <100.00%> (-0.22%) ⬇️
crates/btcio/src/rpc/client.rs 88.50% <100.00%> (+0.03%) ⬆️
bin/bridge-client/src/main.rs 0.00% <0.00%> (ø)
bin/strata-client/src/main.rs 0.00% <0.00%> (ø)
crates/common/src/logging.rs 44.77% <43.07%> (-55.23%) ⬇️

... and 25 files with indirect coverage changes

@delbonis
Copy link
Contributor Author

Should figure out a better solution to the logging in tests, maybe should make a simpler stub.

Comment on lines -221 to +222
logging::init();
// FIXME this is absurd, why are we doing this here?
logging::init(logging::LoggerConfig::with_base_name("strata-client-tests"));
Copy link
Member

Choose a reason for hiding this comment

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

It this calling btcio::client by any means?
If yes there's a lot of good logging happening there that is quite useful.

@delbonis delbonis merged commit 0b0be55 into main Oct 25, 2024
16 of 17 checks passed
storopoli added a commit that referenced this pull request Nov 14, 2024
* common: tried to set up otlp

This deletes Cargo.lock because we couldn't get the deps to work anyways.

* fix: bump opentelemetry stuff to 0.26

now it compiles at least-ish

* common: added more correct init for OTLP tracing output

* common, contrib: fixed some more logging stuff, added Jaeger util script

* common, stratad: reworked logging init some more to try to make it work

* contrib: fixed Jaeger init script to use a recent version

* bridge-client: fixed broken test, fixed Tokio version

* common: added `service.name` property to OTLP params

* prover-client: fixed missing `LoggerConfig`

* stratad: fixed broken tests??? idk why this is here

* tests: fixed broken logging

* btcio: fixed broken logging

---------

Co-authored-by: Jose Storopoli <[email protected]>
storopoli added a commit that referenced this pull request Nov 14, 2024
STR-440 OpenTelemetry tracing exporter (#342)

* common: tried to set up otlp

This deletes Cargo.lock because we couldn't get the deps to work anyways.

* fix: bump opentelemetry stuff to 0.26

now it compiles at least-ish

* common: added more correct init for OTLP tracing output

* common, contrib: fixed some more logging stuff, added Jaeger util script

* common, stratad: reworked logging init some more to try to make it work

* contrib: fixed Jaeger init script to use a recent version

* bridge-client: fixed broken test, fixed Tokio version

* common: added `service.name` property to OTLP params

* prover-client: fixed missing `LoggerConfig`

* stratad: fixed broken tests??? idk why this is here

* tests: fixed broken logging

* btcio: fixed broken logging

---------

Co-authored-by: Trey Del Bonis <[email protected]>
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.

2 participants