This directory contains example applications demonstrating various features of the datadog-opentelemetry crate.
A basic example showing how to initialize the Datadog tracer and create spans.
Run:
cargo run -p simple_tracingAn example demonstrating trace propagation between services.
Run:
cargo run -p propagatorA test application for manually testing the remote configuration feature for sampling rules. This application continuously emits spans under a specific service name (dd-trace-rs-rc-test-service) to test remote configuration updates from the Datadog backend.
Features:
- Initializes tracer with remote configuration enabled
- Emits ~2 traces per second with realistic span structures
- Creates different operation types:
user_login,data_fetch,file_upload,analytics_event - Each trace has a parent span with 2 child spans (
database_queryandexternal_api_call)
Run:
# From project root
cargo run -p remote_config_test
# Or use the convenience script
./run_remote_config_test.sh
# With debug logging to see remote config activity
DD_LOG_LEVEL=DEBUG cargo run -p remote_config_testPrerequisites:
- Datadog Agent running on
localhost:8126 - Agent must have remote configuration enabled
- Agent should be configured to receive remote config from Datadog backend
Testing Remote Configuration:
- Start the application
- Verify spans are being sent to your APM dashboard
- Create a sampling rule in your Datadog backend for service
dd-trace-rs-rc-test-service - Monitor the application and APM dashboard to see sampling rate changes
See the remote_config_test README for detailed instructions.