/sdk-core

Core Temporal SDK that can be used as a base for language specific Temporal SDKs

Primary LanguageRustOtherNOASSERTION

Build status

Core SDK that can be used as a base for all other Temporal SDKs.

Getting started

See the Architecture doc for some high-level information.

This repo uses a submodule for upstream protobuf files. The path protos/api_upstream is a submodule -- when checking out the repo for the first time make sure you've run git submodule update --init --recursive. TODO: Makefile.

Dependencies

  • Protobuf compiler

Development

All of the following commands are enforced for each pull request.

Building and testing

You can buld and test the project using cargo: cargo build cargo test

Formatting

To format all code run: cargo fmt --all

Linting

We are using clippy for linting. You can run it using: cargo clippy --all -- -D warnings

Debugging

The crate uses tracing to help with debugging. To enable it for a test, insert the below snippet at the start of the test. By default, tracing data is output to stdout in a (reasonably) pretty manner, and to a Jaeger instance if one exists.

core_tracing::tracing_init();
let s = info_span!("Test start");
let _enter = s.enter();

To run the Jaeger instance: docker run --rm -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest Jaeger collection is off by default, you must set TEMPORAL_ENABLE_OPENTELEMENTRY=true in the environment to enable it.

To show logs in the console, set the RUST_LOG environment variable to temporal_sdk_core=DEBUG or whatever level you desire. The env var is parsed according to tracing's EnvFilter rules.

If you are working on a language SDK, you are expected to initialize tracing early in your main equivalent.

Style Guidelines

Error handling

Any error which is returned from a public interface should be well-typed, and we use thiserror for that purpose.

Errors returned from things only used in testing are free to use anyhow for less verbosity.