Skip to content

Commit 71677e8

Browse files
committed
feat(profiling): Simplify exporter
1 parent 0959f2d commit 71677e8

File tree

13 files changed

+1629
-1147
lines changed

13 files changed

+1629
-1147
lines changed

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,38 @@ jobs:
126126
env:
127127
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
128128

129+
test-cxx:
130+
name: "cargo test with cxx features #${{ matrix.platform }}"
131+
runs-on: ${{ matrix.platform }}
132+
env:
133+
CARGO_TERM_COLOR: always
134+
CARGO_INCREMENTAL: 0
135+
strategy:
136+
matrix:
137+
platform: [windows-latest, ubuntu-latest, macos-15]
138+
fail-fast: false
139+
steps:
140+
- name: Checkout sources
141+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
142+
- name: Install cargo nextest
143+
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
144+
with:
145+
tool: nextest@0.9.96
146+
- name: Cache [rust]
147+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
148+
with:
149+
cache-targets: true # cache build artifacts
150+
cache-bin: true # cache the ~/.cargo/bin directory
151+
prefix-key: "cxx-tests"
152+
- name: "cargo build with cxx features"
153+
shell: bash
154+
run: cargo build --features libdd-profiling/cxx,libdd-crashtracker/cxx --package libdd-profiling --package libdd-crashtracker --verbose
155+
- name: "cargo nextest run with cxx features"
156+
shell: bash
157+
run: cargo nextest run --features libdd-profiling/cxx,libdd-crashtracker/cxx --package libdd-profiling --package libdd-crashtracker --verbose
158+
env:
159+
RUST_BACKTRACE: full
160+
129161
ffi:
130162
name: "FFI #${{ matrix.platform }} ${{ matrix.rust_version }}"
131163
runs-on: ${{ matrix.platform }}

Cargo.lock

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/cxx/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Windows:
7676
**Core Types:**
7777
- `Profile` - Profile builder for collecting samples
7878
- `ProfileExporter` - Exporter for sending profiles to Datadog
79+
- `CancellationToken` - Token for cancelling profile export operations
7980
- `Tag` - Key-value tags for profile metadata
8081
- `AttachmentFile` - Additional file to attach to profile (name + data bytes)
8182

@@ -97,6 +98,12 @@ By default, the example saves the profile to `profile.pprof`. To export to Datad
9798

9899
See [`profiling.cpp`](profiling.cpp) for a complete example showing profile creation, sample collection, and exporting to Datadog with optional attachments and metadata.
99100

101+
**Cancellation Token Support:**
102+
103+
Profiling exports support cancellation tokens for thread-safe cancellation of long-running export operations. Use `send_profile()` for normal exports or `send_profile_with_cancellation()` when you need cancellation support.
104+
105+
See the example code in [`profiling.cpp`](profiling.cpp) for how to create and use cancellation tokens with the exporter.
106+
100107
**Requirements:**
101108
- C++20 compiler
102109
- For agent mode: Datadog agent running (default: localhost:8126)

0 commit comments

Comments
 (0)