Skip to content

Add tracer.#26

Merged
wu-sheng merged 6 commits into
apache:masterfrom
jmjoy:improve_context
Jul 10, 2022
Merged

Add tracer.#26
wu-sheng merged 6 commits into
apache:masterfrom
jmjoy:improve_context

Conversation

@jmjoy

@jmjoy jmjoy commented Jul 9, 2022

Copy link
Copy Markdown
Member

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

@codecov-commenter

codecov-commenter commented Jul 9, 2022

Copy link
Copy Markdown

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.

@wu-sheng wu-sheng left a comment

Copy link
Copy Markdown
Member

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.

Comment thread README.md Outdated
use tokio;

async fn handle_request(reporter: ContextReporter) {
async fn handle_request(reporter: Reporter) {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

jmjoy commented Jul 10, 2022

Copy link
Copy Markdown
Member Author

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

@wu-sheng wu-sheng left a comment

Copy link
Copy Markdown
Member

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.

Comment thread README.md Outdated
tokio::spawn(handle_request(tracer.clone()));

// Start server...
// Block to report.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@jmjoy

jmjoy commented Jul 10, 2022

Copy link
Copy Markdown
Member Author

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 thread Cargo.toml
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

edition = "2021"

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

@jmjoy

jmjoy commented Jul 10, 2022

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member

Is this a rust specific edition rule?

@jmjoy

jmjoy commented Jul 10, 2022

Copy link
Copy Markdown
Member Author

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