You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/03/01 15:04:02 UTC

[GitHub] [skywalking-rust] wu-sheng opened a new pull request #2: Finish the tracing core APIs

wu-sheng opened a new pull request #2: Finish the tracing core APIs
URL: https://github.com/apache/skywalking-rust/pull/2
 
 
   # Concepts
   All concepts are from the official SkyWalking definitions.
   ## Span
   Span is an important and common concept in distributed tracing system. Learn Span from Google Dapper Paper.
   For better performance, we extend the span into 3 kinds.
      
   1. EntrySpan EntrySpan represents a service provider, also the endpoint of server side. As an APM system, we are targeting the application servers. So almost all the services and MQ-consumer are EntrySpan(s).
   2. LocalSpan LocalSpan represents a normal Java method, which does not relate to remote service, neither a MQ producer/consumer nor a service(e.g. HTTP service) provider/consumer.
   3. ExitSpan ExitSpan represents a client of service or MQ-producer, as named as LeafSpan at early age of SkyWalking. e.g. accessing DB by JDBC, reading Redis/Memcached are cataloged an ExitSpan.
   
   Tag and Log are similar attributes of the span. 
   - Tag is a key:value pair to indicate the attribute with a string value.
   - Log is heavier than tag, with one timestamp and multiple key:value pairs. Log represents an event, typically an error happens.
   
   ## TracingContext
   TracingContext is the context of the tracing process. Span should only be created through context, and be archived into the
   context after the span finished.
   
   ## Injectable
   Injectable is used(optional) when the exit span creates. This Injectable received the notification from tracing context,
   including the key and value for tracing context across process propagation. Typically, Injectable implementation would 
   manipulate the RPC header/metadata to make the key/value sent to the server side.
   
   ## Extractable
   Extractable is used(optional) when the entry span creates. The Extractable fetches the value of the given key from the propagated
   context. Typically, Extractable implementation would read the RPC header/metadata, which sent from the client side.   
   
   # APIs
   ## Tracing Core APIs
   Tracing core APIs are 100% manual control tracing APIs. Users could use them to trace any process by following SkyWalking
   core concepts.
   
   ```rust
   let mut context = TracingContext::new(&reporter).unwrap();
   let span1 = context.create_entry_span("op1", None, Some(&MockerHeader {}));
   {
       assert_eq!(span1.span_id(), 0);
       let mut span2 = context.create_local_span("op2", Some(&span1));
       span2.tag(Tag::new(String::from("tag1"), String::from("value1")));
       {
           assert_eq!(span2.span_id(), 1);
           let mut span3 = context.create_exit_span("op3", Some(&span2), "127.0.0.1:8080", Some(&HeaderCarrier {}));
           assert_eq!(span3.span_id(), 2);
   
           context.finish_span(span3);
       }
       context.finish_span(span2);
   }
   context.finish_span(span1);
   
   reporter.report_trace(context);
   ```
   
   ---
   Notice,  report module has not finished. Report module monitors the tracing context finish event and do
   1. Service and service instance register
   1. Trace report

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [skywalking-rust] kezhenxu94 commented on issue #2: Finish the tracing core APIs

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on issue #2: Finish the tracing core APIs
URL: https://github.com/apache/skywalking-rust/pull/2#issuecomment-593184096
 
 
   There're some warnings in the files changed tab :P

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [skywalking-rust] wu-sheng merged pull request #2: Finish the tracing core APIs

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #2: Finish the tracing core APIs
URL: https://github.com/apache/skywalking-rust/pull/2
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [skywalking-rust] wu-sheng commented on issue #2: Finish the tracing core APIs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #2: Finish the tracing core APIs
URL: https://github.com/apache/skywalking-rust/pull/2#issuecomment-593184314
 
 
   > There're some warnings in the files changed tab :P
   
   Yes, that is expected, as I haven't finished the report part, many fields are never used. Rust compiler will send the warnings :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [skywalking-rust] wu-sheng commented on issue #2: Finish the tracing core APIs

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #2: Finish the tracing core APIs
URL: https://github.com/apache/skywalking-rust/pull/2#issuecomment-593192087
 
 
   > Now span is allocated in the heap instead of the stack, that is not common practice because of the overhead of heap allocation.
   
   How do you expect the span is in the stack? Could you provide some examples? The span is unsized because of tags and logs.
   
   > About to close span, users should take care of closing span when they want to return workflow. It might bring potential bugs. Let's provide a closure method to wrap users' logic block into it, that's useful for Marco especially.
   
   Do you have an example? I think this could be optional, as a manual API core, I will keep the API as directly as possible without the unnecessary limits. This thing should be more suitable in `skywalking-agent` . WDYT?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services