#tracing #datadog #collection #macro #convenience #fields #instrument

macro tracing-datadog-macros

Collection of convenience macros to use with Datadog tracing

2 releases

0.0.3 Feb 25, 2025
0.0.2 Dec 17, 2024

#182 in Profiling

Download history 74/week @ 2024-12-11 78/week @ 2024-12-18 8/week @ 2024-12-25 6/week @ 2025-01-01 17/week @ 2025-01-08 5/week @ 2025-01-15 5/week @ 2025-01-22 2/week @ 2025-01-29 12/week @ 2025-02-05 13/week @ 2025-02-12 79/week @ 2025-02-19 85/week @ 2025-02-26 16/week @ 2025-03-05

194 downloads per month

Apache-2.0

14KB
159 lines

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 Rust Release

🚀 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:

[dependencies]
tracing-datadog-macros = "0.0.2"

Usage

Example

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

Dependencies

~2–3MB
~55K SLoC