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 tracer. #26

Merged
merged 6 commits into from
Jul 10, 2022
Merged

Add tracer. #26

merged 6 commits into from
Jul 10, 2022

Conversation

jmjoy
Copy link
Member

@jmjoy jmjoy commented Jul 9, 2022

Add the Tracer, integrate with Reporter, like in go.

@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2022

Codecov Report

Merging #26 (4339384) into master (2034a2f) will decrease coverage by 11.62%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           master      #26       +/-   ##
===========================================
- Coverage   86.91%   75.29%   -11.63%     
===========================================
  Files           9       10        +1     
  Lines         298      344       +46     
===========================================
  Hits          259      259               
- Misses         39       85       +46     
Impacted Files Coverage Δ
src/context/tracer.rs 0.00% <0.00%> (ø)
src/reporter/grpc.rs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2034a2f...4339384. Read the comment docs.

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

Usually, this concept in SDK should be called TRACER, rather than ContextManager.
I used ContextManager in Java as we have a tracer manual API, so I don't want to create a duplicated one.

go2sky(golang SDK) is using this concept, https://github.com/SkyAPM/go2sky#quickstart.

README.md Outdated
@@ -38,7 +38,7 @@ use skywalking::context::trace_context::TracingContext;
use skywalking::reporter::grpc::Reporter;
use tokio;

async fn handle_request(reporter: ContextReporter) {
async fn handle_request(reporter: Reporter) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a new API's doc here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can integrate Tracer and Reporter, like in go.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, agree.
And whether they should be const, most likely user's choice, right?
We don't have to require that.

@jmjoy jmjoy changed the title Add context manager. Add tracer. Jul 10, 2022
@jmjoy
Copy link
Member Author

jmjoy commented Jul 10, 2022

Is this API OK? If yes, I continue to modify e2e.

Copy link
Member

@wu-sheng wu-sheng left a comment

Choose a reason for hiding this comment

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

Mostly good, one thing to be uncertain.

README.md Outdated

// Start server...
// Block to report.
Copy link
Member

Choose a reason for hiding this comment

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

What does block to report work for?

Copy link
Member Author

Choose a reason for hiding this comment

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

What does block to report work for?

Because dead loop to receive segment to collect, and wait a shutdown signal, will block.

Copy link
Member

Choose a reason for hiding this comment

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

How about changing this to

Open reporter as daemon thread(or something more precious in rust) to run.

Block seems a negative word.

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Already collect as daemon, the block is waiting shutdown signal, otherwise the graceful shutdown cannot be done.

@wu-sheng
Copy link
Member

The latest one is clear and more elegant. Thanks. Let's fix e2e.

@jmjoy
Copy link
Member Author

jmjoy commented Jul 10, 2022

E2e fixed.

@wu-sheng wu-sheng added this to the 0.3.0 milestone Jul 10, 2022
@wu-sheng wu-sheng added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 10, 2022
Comment on lines +33 to +40
futures-core = "0.3.21"
futures-util = "0.3.21"
prost = "0.10.4"
prost-derive = "0.10.1"
thiserror = "1.0.31"
tokio = { version = "1.18.2", features = ["full"] }
tonic = "0.7.2"
tonic = { version = "0.7.2", features = ["codegen"] }
tracing = "0.1.35"
Copy link
Member

Choose a reason for hiding this comment

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

Why aren't these new dependencies detected by skywalking eyes? I think these are new dependencies, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

These dependencies actually already exist (required by the dependencies explicitly declared in Cargo.toml ), I just re-import the crate name to use, run Cargo tree can see the dependencies tree.

@wu-sheng
Copy link
Member

edition = "2021"

We forgot to update this to 2022 in the last release.

@jmjoy
Copy link
Member Author

jmjoy commented Jul 10, 2022

edition = "2021"

We forgot to update this to 2022 in the last release.

No, the edition is three-year period, such as 2015, 2018, 2021.

@wu-sheng
Copy link
Member

Is this a rust specific edition rule?

@jmjoy
Copy link
Member Author

jmjoy commented Jul 10, 2022

Is this a rust specific edition rule?

Edition is a big concept of rust, used for syntax breaking compatible, ref: https://doc.rust-lang.org/edition-guide/editions/index.html.

@wu-sheng wu-sheng merged commit 699247d into apache:master Jul 10, 2022
@jmjoy jmjoy deleted the improve_context branch July 10, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants