Apache SkyWalking Rust Agent
SkyWalking Rust Agent provides observability capability for Rust App and Library, including tracing, metrics, topology map for distributed system and alert. It uses SkyWalking native formats and core concepts to keep best compatibility and performance.
Concepts
All concepts are from the official SkyWalking definitions.
Tracing
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.
- 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).
- 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.
- 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.
Logging
LogRecord
LogRecord is the simple builder for the LogData, which is the Log format of Skywalking.
Metrics
Meter
- Counter API represents a single monotonically increasing counter which automatically collects data and reports to the backend.
- Gauge API represents a single numerical value.
- Histogram API represents a summary sample observations with customized buckets.
Example
use ;
use Error;
use signal;
async
async
async
How to compile?
If you have skywalking-(VERSION).crate, you can unpack it with the way as follows:
tar -xvzf skywalking-(VERSION).crate
Using cargo build generates a library. If you'd like to verify the behavior, we recommend to
use cargo run --example simple_trace_report
which outputs executable, then run it.
NOTICE
This crate automatically generates protobuf related code, which requires protoc before compile.
Please choose one of the ways to install protoc.
-
Using your OS package manager.
For Debian-base system:
sudo apt install protobuf-compilerFor MacOS:
brew install protobuf -
Auto compile
protocin the crate build script, just by adding the featurevendoredin theCargo.toml:cargo add skywalking --features vendored -
Build from source. If
protcisn't install inside $PATH, the env valuePROTOCshould be set.PROTOC=/the/path/of/protoc
For details, please refer to prost-build:sourcing-protoc.
Release
The SkyWalking committer(PMC included) could follow this doc to release an official version.
License
Apache 2.0