From cf8e7aa31ec9397aa60d1fa0233ece3d94a793a9 Mon Sep 17 00:00:00 2001 From: guyeisenkot <68634672+guyeisenkot@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:20:31 -0800 Subject: [PATCH] docs: readme-for-macros CR-153 (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Anton Grübel --- README.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0cfc35..58bdac1 100644 --- a/README.md +++ b/README.md @@ -1 +1,78 @@ -# tracing-datadog-macros \ No newline at end of file +
+ +

tracing-datadog-macros

+

+ Simplify Datadog tracing in Rust with specialized macros for enhanced code observability. +
+ Baz on GitHub » +
+
+ Install via Cargo +
+ cargo add tracing-datadog-macros +
+
+ Libraries Available +
+ Rust: tracing-datadog-macros +

+
+ +--- + +![Crates.io](https://img.shields.io/crates/v/tracing-datadog-macros) +![Rust](https://img.shields.io/badge/rust-2021-blue) +![Release](https://github.com/baz-scm/tracing-datadog-macros/workflows/Release/badge.svg) + +## 🚀 What is `tracing-datadog-macros`? + +`tracing-datadog-macros` is a Rust library providing a collection of procedural macros to simplify and enhance Datadog tracing. It automates span creation and enriches them with context-critical fields, making tracing more actionable and efficient for distributed systems. + +With `tracing-datadog-macros`, your observability improves significantly, offering you crystal-clear insights into your application's behavior. + +### Available Macros + +`instrument_custom`: General-purpose instrumentation with custom attributes. + +`instrument_http`: Predefined for HTTP spans. + +`instrument_queue_consumer`: Optimized for queue consumers. + +`instrument_queue_producer`: For queue producers. + +`instrument_sql`: SQL-related spans. + +`instrument_web`: Specialized for web spans. + +Parse and validate attributes provided by the user. +Add required fields like span.type, service.name, and others. +Integrate seamlessly with #[tracing::instrument]. + + +--- +## Install + +Add the crate to your `Cargo.toml`: + +```toml +[dependencies] +tracing-datadog-macros = "0.0.2" +``` + +## Usage +Example +```rust +use tracing_datadog_macros::instrument_web; + +#[instrument_web(skip(self))] +async fn process_data(&self, data: Data) { + // Your logic here +} +``` + +# 🔗 Learn More +Falken-Trace-Go library: https://github.com/baz-scm/falken-trace-go + +Falken-Trace-py library: https://github.com/baz-scm/falken-trace-py + +Blog post: [Extending OpenTelemetry to Pinpoint Code Elements](https://baz.co/resources/extending-opentelemetry-to-pinpoint-code-elements-our-journey-to-close-the-gap)