Commit d5c78c2
feat(profiling): Add sample attributes support to OTLP profiles converter
This commit adds support for mapping JFR event attributes to OTLP profile
sample attributes, enabling richer profiling data with contextual metadata.
Key changes:
1. Sample Attributes Implementation:
- Added attributeIndices field to SampleData class
- Implemented getSampleTypeAttributeIndex() helper for creating sample type attributes
- Updated all event handlers (CPU, allocation, lock) to include sample.type attribute
- Uses packed repeated int32 format for attribute_indices per proto3 spec
2. ObjectSample Enhancements:
- Added objectClass, size, and weight fields to ObjectSample interface
- Implemented upscaling: sample value = size * weight
- Added alloc.class attribute for allocation profiling
- Maintains backwards compatibility with allocationSize field
3. OTLP Proto Field Number Corrections:
- Fixed Sample field numbers to match official Go module proto:
* stack_index = 1
* values = 2 (was 4)
* attribute_indices = 3 (was 2)
* link_index = 4 (was 3)
* timestamps_unix_nano = 5 (was 5)
- Corrects discrepancy between proto file and generated Go code
4. Dual Validation System:
- Updated Dockerfile.profcheck to include both protoc and profcheck
- Created validate-profile wrapper script
- Protoc validation is authoritative (official Protocol Buffers compiler)
- Profcheck warnings are captured but don't fail builds
- Documents known profcheck timestamp validation issues
5. Test Updates:
- Updated smoke tests to use new ObjectSample fields (size, weight)
- Modified validation tests to check for protoc validation success
- All validation tests passing with spec-compliant output
Design decisions:
- Measurements (duration, size*weight) are stored as sample VALUES
- Labels/metadata (sample.type, alloc.class) are stored as ATTRIBUTES
- AttributeTable provides automatic deduplication via internString()
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent d175a42 commit d5c78c2
File tree
8 files changed
+244
-80
lines changed- dd-java-agent/agent-profiling/profiling-otel
- src
- main/java/com/datadog/profiling/otel
- jfr
- proto
- test/java/com/datadog/profiling/otel
- docker
8 files changed
+244
-80
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
Lines changed: 86 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
134 | 135 | | |
135 | | - | |
| 136 | + | |
| 137 | + | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
369 | | - | |
| 371 | + | |
| 372 | + | |
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| |||
377 | 380 | | |
378 | 381 | | |
379 | 382 | | |
380 | | - | |
| 383 | + | |
| 384 | + | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
390 | | - | |
391 | 394 | | |
392 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
393 | 435 | | |
394 | 436 | | |
395 | 437 | | |
| |||
400 | 442 | | |
401 | 443 | | |
402 | 444 | | |
403 | | - | |
| 445 | + | |
| 446 | + | |
404 | 447 | | |
405 | 448 | | |
406 | 449 | | |
| |||
411 | 454 | | |
412 | 455 | | |
413 | 456 | | |
414 | | - | |
| 457 | + | |
| 458 | + | |
415 | 459 | | |
416 | 460 | | |
417 | 461 | | |
| |||
505 | 549 | | |
506 | 550 | | |
507 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
508 | 558 | | |
509 | 559 | | |
510 | 560 | | |
| |||
659 | 709 | | |
660 | 710 | | |
661 | 711 | | |
662 | | - | |
663 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
664 | 717 | | |
665 | 718 | | |
666 | 719 | | |
| |||
779 | 832 | | |
780 | 833 | | |
781 | 834 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
800 | 855 | | |
801 | 856 | | |
802 | 857 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
| 85 | + | |
87 | 86 | | |
88 | 87 | | |
89 | 88 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
Lines changed: 19 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | | - | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
275 | 277 | | |
276 | 278 | | |
277 | 279 | | |
278 | | - | |
| 280 | + | |
| 281 | + | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
| |||
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
288 | | - | |
| 291 | + | |
| 292 | + | |
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
| |||
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
297 | | - | |
| 301 | + | |
| 302 | + | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
| |||
303 | 308 | | |
304 | 309 | | |
305 | 310 | | |
306 | | - | |
| 311 | + | |
| 312 | + | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
| |||
389 | 395 | | |
390 | 396 | | |
391 | 397 | | |
392 | | - | |
| 398 | + | |
| 399 | + | |
393 | 400 | | |
394 | 401 | | |
395 | 402 | | |
| |||
418 | 425 | | |
419 | 426 | | |
420 | 427 | | |
421 | | - | |
| 428 | + | |
| 429 | + | |
422 | 430 | | |
423 | 431 | | |
424 | 432 | | |
| |||
742 | 750 | | |
743 | 751 | | |
744 | 752 | | |
745 | | - | |
746 | | - | |
| 753 | + | |
747 | 754 | | |
748 | 755 | | |
749 | 756 | | |
| |||
790 | 797 | | |
791 | 798 | | |
792 | 799 | | |
793 | | - | |
794 | | - | |
| 800 | + | |
795 | 801 | | |
796 | 802 | | |
797 | 803 | | |
| |||
850 | 856 | | |
851 | 857 | | |
852 | 858 | | |
853 | | - | |
854 | | - | |
| 859 | + | |
855 | 860 | | |
856 | 861 | | |
857 | 862 | | |
| |||
0 commit comments