Convert opencode transcripts to otel (or agent) traces
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Replace chrono with jiff for datetime handling: Use Timestamp and Zoned types for better DST support and API consistency

rektide 034a3c17 fea1ca8b

+62 -143
+57 -138
Cargo.lock
··· 12 12 ] 13 13 14 14 [[package]] 15 - name = "android_system_properties" 16 - version = "0.1.5" 17 - source = "registry+https://github.com/rust-lang/crates.io-index" 18 - checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 19 - dependencies = [ 20 - "libc", 21 - ] 22 - 23 - [[package]] 24 15 name = "anstream" 25 16 version = "0.6.21" 26 17 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 193 184 checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" 194 185 195 186 [[package]] 196 - name = "cc" 197 - version = "1.2.55" 198 - source = "registry+https://github.com/rust-lang/crates.io-index" 199 - checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" 200 - dependencies = [ 201 - "find-msvc-tools", 202 - "shlex", 203 - ] 204 - 205 - [[package]] 206 187 name = "cfg-if" 207 188 version = "1.0.4" 208 189 source = "registry+https://github.com/rust-lang/crates.io-index" 209 190 checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" 210 191 211 192 [[package]] 212 - name = "chrono" 213 - version = "0.4.43" 214 - source = "registry+https://github.com/rust-lang/crates.io-index" 215 - checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" 216 - dependencies = [ 217 - "iana-time-zone", 218 - "js-sys", 219 - "num-traits", 220 - "serde", 221 - "wasm-bindgen", 222 - "windows-link", 223 - ] 224 - 225 - [[package]] 226 193 name = "clap" 227 194 version = "4.5.56" 228 195 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 279 246 ] 280 247 281 248 [[package]] 282 - name = "core-foundation-sys" 283 - version = "0.8.7" 284 - source = "registry+https://github.com/rust-lang/crates.io-index" 285 - checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 286 - 287 - [[package]] 288 249 name = "either" 289 250 version = "1.15.0" 290 251 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 311 272 version = "0.1.0" 312 273 dependencies = [ 313 274 "anyhow", 314 - "chrono", 315 275 "clap", 316 276 "colored", 277 + "jiff", 317 278 "opentelemetry", 318 279 "opentelemetry-otlp", 319 280 "opentelemetry_sdk", ··· 327 288 "tracing-opentelemetry", 328 289 "tracing-subscriber", 329 290 ] 330 - 331 - [[package]] 332 - name = "find-msvc-tools" 333 - version = "0.1.9" 334 - source = "registry+https://github.com/rust-lang/crates.io-index" 335 - checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" 336 291 337 292 [[package]] 338 293 name = "fnv" ··· 561 516 ] 562 517 563 518 [[package]] 564 - name = "iana-time-zone" 565 - version = "0.1.65" 566 - source = "registry+https://github.com/rust-lang/crates.io-index" 567 - checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" 568 - dependencies = [ 569 - "android_system_properties", 570 - "core-foundation-sys", 571 - "iana-time-zone-haiku", 572 - "js-sys", 573 - "log", 574 - "wasm-bindgen", 575 - "windows-core", 576 - ] 577 - 578 - [[package]] 579 - name = "iana-time-zone-haiku" 580 - version = "0.1.2" 581 - source = "registry+https://github.com/rust-lang/crates.io-index" 582 - checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 583 - dependencies = [ 584 - "cc", 585 - ] 586 - 587 - [[package]] 588 519 name = "indexmap" 589 520 version = "1.9.3" 590 521 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 626 557 checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" 627 558 628 559 [[package]] 560 + name = "jiff" 561 + version = "0.2.18" 562 + source = "registry+https://github.com/rust-lang/crates.io-index" 563 + checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" 564 + dependencies = [ 565 + "jiff-static", 566 + "jiff-tzdb-platform", 567 + "log", 568 + "portable-atomic", 569 + "portable-atomic-util", 570 + "serde_core", 571 + "windows-sys 0.61.2", 572 + ] 573 + 574 + [[package]] 575 + name = "jiff-static" 576 + version = "0.2.18" 577 + source = "registry+https://github.com/rust-lang/crates.io-index" 578 + checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" 579 + dependencies = [ 580 + "proc-macro2", 581 + "quote", 582 + "syn", 583 + ] 584 + 585 + [[package]] 586 + name = "jiff-tzdb" 587 + version = "0.1.5" 588 + source = "registry+https://github.com/rust-lang/crates.io-index" 589 + checksum = "68971ebff725b9e2ca27a601c5eb38a4c5d64422c4cbab0c535f248087eda5c2" 590 + 591 + [[package]] 592 + name = "jiff-tzdb-platform" 593 + version = "0.1.3" 594 + source = "registry+https://github.com/rust-lang/crates.io-index" 595 + checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" 596 + dependencies = [ 597 + "jiff-tzdb", 598 + ] 599 + 600 + [[package]] 629 601 name = "js-sys" 630 602 version = "0.3.85" 631 603 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 707 679 checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" 708 680 dependencies = [ 709 681 "windows-sys 0.61.2", 710 - ] 711 - 712 - [[package]] 713 - name = "num-traits" 714 - version = "0.2.19" 715 - source = "registry+https://github.com/rust-lang/crates.io-index" 716 - checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 717 - dependencies = [ 718 - "autocfg", 719 682 ] 720 683 721 684 [[package]] ··· 875 838 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 876 839 877 840 [[package]] 841 + name = "portable-atomic" 842 + version = "1.13.1" 843 + source = "registry+https://github.com/rust-lang/crates.io-index" 844 + checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" 845 + 846 + [[package]] 847 + name = "portable-atomic-util" 848 + version = "0.2.5" 849 + source = "registry+https://github.com/rust-lang/crates.io-index" 850 + checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" 851 + dependencies = [ 852 + "portable-atomic", 853 + ] 854 + 855 + [[package]] 878 856 name = "ppv-lite86" 879 857 version = "0.2.21" 880 858 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1055 1033 dependencies = [ 1056 1034 "lazy_static", 1057 1035 ] 1058 - 1059 - [[package]] 1060 - name = "shlex" 1061 - version = "1.3.0" 1062 - source = "registry+https://github.com/rust-lang/crates.io-index" 1063 - checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1064 1036 1065 1037 [[package]] 1066 1038 name = "signal-hook-registry" ··· 1471 1443 ] 1472 1444 1473 1445 [[package]] 1474 - name = "windows-core" 1475 - version = "0.62.2" 1476 - source = "registry+https://github.com/rust-lang/crates.io-index" 1477 - checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" 1478 - dependencies = [ 1479 - "windows-implement", 1480 - "windows-interface", 1481 - "windows-link", 1482 - "windows-result", 1483 - "windows-strings", 1484 - ] 1485 - 1486 - [[package]] 1487 - name = "windows-implement" 1488 - version = "0.60.2" 1489 - source = "registry+https://github.com/rust-lang/crates.io-index" 1490 - checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" 1491 - dependencies = [ 1492 - "proc-macro2", 1493 - "quote", 1494 - "syn", 1495 - ] 1496 - 1497 - [[package]] 1498 - name = "windows-interface" 1499 - version = "0.59.3" 1500 - source = "registry+https://github.com/rust-lang/crates.io-index" 1501 - checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" 1502 - dependencies = [ 1503 - "proc-macro2", 1504 - "quote", 1505 - "syn", 1506 - ] 1507 - 1508 - [[package]] 1509 1446 name = "windows-link" 1510 1447 version = "0.2.1" 1511 1448 source = "registry+https://github.com/rust-lang/crates.io-index" 1512 1449 checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 1513 - 1514 - [[package]] 1515 - name = "windows-result" 1516 - version = "0.4.1" 1517 - source = "registry+https://github.com/rust-lang/crates.io-index" 1518 - checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" 1519 - dependencies = [ 1520 - "windows-link", 1521 - ] 1522 - 1523 - [[package]] 1524 - name = "windows-strings" 1525 - version = "0.5.1" 1526 - source = "registry+https://github.com/rust-lang/crates.io-index" 1527 - checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" 1528 - dependencies = [ 1529 - "windows-link", 1530 - ] 1531 1450 1532 1451 [[package]] 1533 1452 name = "windows-sys"
+1 -1
Cargo.toml
··· 15 15 serde = { version = "1.0", features = ["derive"] } 16 16 serde_json = "1.0" 17 17 regex = "1.11" 18 - chrono = { version = "0.4", features = ["serde"] } 18 + jiff = { version = "0.2", features = ["serde"] } 19 19 anyhow = "1.0" 20 20 clap = { version = "4", features = ["derive", "env"] } 21 21 colored = "2"
+4 -4
src/parser.rs
··· 1 1 use anyhow::{Context, Result}; 2 - use chrono::{DateTime, Utc}; 2 + use jiff::{Timestamp, Zoned}; 3 3 use regex::Regex; 4 4 use serde::Deserialize; 5 5 use std::fs; ··· 18 18 pub msg_type: String, 19 19 pub role: String, 20 20 pub model: Option<String>, 21 - pub timestamp: Option<DateTime<Utc>>, 21 + pub timestamp: Option<Timestamp>, 22 22 pub content: String, 23 23 pub thinking: Option<String>, 24 24 pub tools_used: Option<Vec<ToolUsage>>, ··· 38 38 pub session_id: String, 39 39 pub role: String, 40 40 pub model: Option<String>, 41 - pub timestamp: DateTime<Utc>, 41 + pub timestamp: Timestamp, 42 42 pub tool_name: Option<String>, 43 43 pub mcp_method: Option<String>, 44 44 pub content: String, ··· 182 182 session_id: log.session_id.clone(), 183 183 role: msg.role.clone(), 184 184 model: msg.model.clone(), 185 - timestamp: msg.timestamp.unwrap_or_else(|| Utc::now()), 185 + timestamp: msg.timestamp.unwrap_or_else(|| Timestamp::now()), 186 186 tool_name, 187 187 mcp_method, 188 188 content: msg.content.clone(),