telemetry-kit 0.3.0

Privacy-first, batteries-included telemetry toolkit for Rust applications with OpenTelemetry
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# telemetry-kit Roadmap

**Last Updated:** 2025-11-23
**Status:** Active Development (v0.2.0-alpha.1)
**Next Release:** v0.2.0 (Q1 2025)

**Recent Milestones:**
- ✅ Week 8: Security Hardening Complete (Jan 2025)
- ✅ Node.js Bindings Proof-of-Concept (Jan 2025)
-`#[instrument]` Procedural Macro (Jan 2025)
- ✅ CLI Project Scaffolding (Jan 2025)
- ✅ Smart Instrumentation Recommendations (Nov 2025)
- 🚧 v0.3.0: Developer Experience (In Progress)

**Quick Stats:**
- 49 unit tests + 11 property tests + 10 integration tests = **70 tests passing**
- **Zero critical vulnerabilities** in SDK
- **SLSA Level 2** compliance
- **Node.js bindings** proof-of-concept complete

---

## Vision

telemetry-kit aims to be the **simplest, most privacy-respecting** way to add telemetry to Rust applications - especially CLI tools and libraries.

**Core Principles:**
- 🔒 **Privacy-first** - Anonymous by default, GDPR compliant
- 🎯 **Zero boilerplate** - 3 lines instead of 50+
- 📦 **Self-hostable** - Your data, your infrastructure
- 🚀 **CLI-optimized** - Works perfectly with short-lived processes

---

## Current Status (v0.2.0-alpha.1)

### ✅ Implemented Features

**SDK Core:**
- Event tracking (command and feature events)
- Privacy features (anonymization, sanitization, consent)
- SQLite offline storage
- Auto-sync background task
- DO_NOT_TRACK support
- HMAC-SHA256 authentication

**CLI Tool:**
- Project scaffolding (`telemetry-kit new`)
- Interactive setup (`telemetry-kit init`)
- Configuration validation
- Event statistics
- Manual sync
- Database cleanup
- Privacy consent management

**Infrastructure:**
- Reference server implementation (Rust + PostgreSQL + Redis)
- Docker deployment
- Rate limiting
- Batch ingestion
- Replay protection

### ✅ Recently Completed

**Week 8 - Security Hardening (January 2025):**
- [x] Security audit complete (zero critical vulnerabilities)
- [x] Supply chain security (SLSA Level 2, cargo-deny configured)
- [x] CI/CD security automation (cargo-audit + cargo-deny in CI)
- [x] Comprehensive security documentation
- [x] Documentation reorganization (project-docs/ structure)
- [x] Community-facing ROADMAP.md

**Node.js Bindings - Proof of Concept (January 2025):**
- [x] napi-rs native addon implementation
- [x] TypeScript definitions (full type safety)
- [x] npm package structure (@telemetry-kit/node)
- [x] Builder pattern API
- [x] Async/await support
- [x] Examples (basic + sync)
- [x] Comprehensive documentation

**CLI Project Scaffolding (January 2025):**
- [x] `telemetry-kit new` command for project creation
- [x] Binary/CLI application template with telemetry pre-configured
- [x] Library template with telemetry integration
- [x] Web service template (Axum) with telemetry
- [x] Optional sync configuration (`--with-sync` flag)
- [x] Automatic git initialization
- [x] README generation with privacy documentation
- [x] Project types: bin, lib, web

**Smart Instrumentation Recommendations (November 2025):**
- [x] `telemetry-kit analyze` command for code analysis
- [x] Pattern detection engine (main functions, async functions, HTTP handlers, DB operations)
- [x] Priority-based recommendations (High/Medium/Low)
- [x] Detailed mode with code snippets
- [x] JSON output format for tooling integration
- [x] Recursive directory scanning
- [x] Smart filtering (skips already-instrumented code)

### 🚧 In Progress

**Developer Experience (v0.3.0):**
- Quick start guide development

---

## Release Plan

### v0.2.0 - Privacy & Sync (Q1 2025)

**Target Date:** February 2025

**Focus:** Privacy-first telemetry with production-ready sync

**Features:**
- [x] Privacy controls (anonymization, sanitization)
- [x] Consent management
- [x] Auto-sync with configurable intervals
- [x] CLI tool for configuration
- [x] Security audit complete ✅
- [x] SLSA Level 2 compliance ✅
- [x] CI/CD with security checks ✅
- [x] Node.js bindings proof-of-concept ✅
- [ ] Comprehensive user documentation (in progress)
- [ ] SLSA Level 3 compliance (Q2 2025)

**Breaking Changes:** None (alpha → beta)

---

### v0.3.0 - Developer Experience (Q2 2025) 🚧

**Target Date:** April 2025

**Focus:** Making integration effortless

**Status:** In active development (started January 2025)

**Features:**
- [x] `#[instrument]` macro for automatic tracking ✅ (completed Jan 2025)
  - Procedural macro crate created
  - Supports async and sync functions
  - Compile-time code generation
  - Comprehensive tests with trybuild
- [x] CLI scaffolding (`telemetry-kit new my-project`) ✅ (completed Jan 2025)
  - Create new projects with telemetry pre-configured
  - Three project types: binary/CLI, library, web service
  - Optional sync configuration with .env.example
  - Auto-generated README with privacy documentation
  - Git initialization included
- [x] Smart instrumentation recommendations ✅ (completed Nov 2025)
  - Code analysis for instrumentation opportunities
  - Pattern detection (main, async functions, HTTP handlers, DB ops)
  - Priority-based recommendations with code snippets
  - JSON output for tooling integration
- [x] Interactive consent prompts ✅ (completed Nov 2025)
  - First-run consent dialog with detailed privacy information
  - Minimal (one-liner) consent prompt option
  - Builder API methods: `.prompt_for_consent()`, `.prompt_minimal()`
  - Automatic consent status detection
  - Privacy-first defaults (NO by default)
  - Integration with existing CLI consent commands
- [x] VS Code extension for inline suggestions ✅ (completed Nov 2025)
  - Smart project analysis with CLI integration
  - 17+ code snippets for common patterns
  - Inline diagnostics with quick fixes
  - Context-aware telemetry insertion
  - Configurable auto-analysis on save
  - Priority-based suggestions (High/Medium/Low)
  - Rich documentation and examples
- [x] Enhanced error messages ✅ (completed in Week 7)

**Documentation:**
- [x] Quick start guide (5-minute integration) ✅ (completed Nov 2025)
- [x] Best practices for different project types ✅ (completed Nov 2025)
- [x] Privacy compliance guide ✅ (completed Nov 2025)
- [x] Self-hosting production guide in docs/ ✅ (completed Nov 2025)

**Current Sprint:**
- **v0.3.0 Developer Experience COMPLETE**
- All DX features implemented and documented
- Ready for v0.3.0 release

---

### v0.4.0 - Node.js Ecosystem

**Target Date:** September 2025

**Focus:** Node.js/TypeScript support

**Features:**
- [ ] Publish `@telemetry-kit/node` to npm
- [ ] Cross-platform prebuilt binaries (Linux, macOS, Windows)
- [ ] Express.js middleware
- [ ] Next.js integration
- [ ] Fastify plugin
- [ ] Nest.js module
- [ ] AWS Lambda/Vercel Functions support

**Documentation:**
- [ ] Node.js quick start guide
- [ ] Framework integration guides
- [ ] Migration from existing solutions
- [ ] TypeScript best practices

**Performance:**
- [ ] <10ms event creation latency
- [ ] <5MB package size per platform
- [ ] Zero blocking of event loop

---

### v1.0.0 - Production Release

**Target Date:** November 2025

**Focus:** Stable, production-ready release

**Criteria:**
- [ ] 6+ months of beta testing
- [ ] 100+ active users
- [ ] Zero critical bugs
- [ ] Comprehensive documentation
- [ ] Security audit passed
- [ ] SLSA Level 3 compliance
- [ ] SemVer commitment

**Guarantees:**
- API stability (SemVer 2.0)
- Long-term support (LTS)
- Migration guides for all breaking changes
- Deprecation warnings (6+ months notice)

---

## Language Bindings

### Node.js / TypeScript (In Progress) 🚀

**Status:** Proof-of-concept complete (January 2025)

**Approach:** Native addon via [napi-rs](https://napi.rs/)

**Current Implementation:**
- [x] Rust bindings (napi-rs)
- [x] TypeScript definitions
- [x] npm package structure
- [x] Builder pattern API
- [x] Async/await support
- [x] Error handling
- [x] Examples (basic + sync)
- [x] Documentation

**Next Steps:**
- [ ] Local build testing
- [ ] CI/CD for cross-platform builds
- [ ] Publish to npm as `@telemetry-kit/node`
- [ ] Framework integrations (Express, Next.js, Fastify)

**Timeline:** v0.6.0 (Q3 2025)

**Benefits:**
- 100% code reuse from Rust SDK
- Native performance (~2-5MB addon)
- Same privacy guarantees
- TypeScript-first
- 19x larger audience (npm vs crates.io)

**See:** [NODE_STRATEGY.md](project-docs/NODE_STRATEGY.md) for full details

**Example API:**
```typescript
import { TelemetryKit } from '@telemetry-kit/node';

const telemetry = new TelemetryKit({
  serviceName: 'my-node-app',
  autoSync: true,
  syncConfig: { ... }
});

await telemetry.trackCommand('deploy', {
  success: true,
  durationMs: 1234
});
```

### Python (Planned)

**Target:** v0.7.0 (Q4 2025)

**Approach:** PyO3 (similar to napi-rs for Node.js)

**Benefits:**
- Data science community
- Machine learning workflows
- Similar implementation to Node.js

### Other Languages

- **Go:** Via CGO (v0.8.0+)
- **Ruby:** Via FFI (v0.9.0+)
- **C/C++:** Direct FFI (any time)

---

## Future Considerations (v1.1+)

### Advanced Features
- [ ] A/B testing framework
- [ ] Feature flags integration
- [ ] Real-time streaming analytics
- [ ] Multi-project dashboards
- [ ] Custom retention policies
- [ ] Data export automation

### Integrations
- [ ] Sentry integration (error tracking)
- [ ] Datadog integration
- [ ] New Relic integration
- [ ] Custom webhook support
- [ ] Slack/Discord notifications

### Platform Support
- [ ] WebAssembly support (browser + edge runtimes)
- [ ] Embedded systems (no_std)
- [ ] Mobile SDK (via FFI - iOS/Android)
- [x] **Node.js bindings** (Proof-of-concept complete! 🎉)
- [ ] Python bindings (napi-rs approach proven)
- [ ] Go bindings (via CGO)
- [ ] Ruby bindings

---

## Community Roadmap

We build in the open and welcome community input!

### How to Influence the Roadmap

1. **Vote on Features** - Star/thumbs up issues for features you want
2. **Submit Proposals** - Open a [Discussion]https://github.com/ibrahimcesar/telemetry-kit/discussions with your idea
3. **Contribute Code** - See [CONTRIBUTING.md]CONTRIBUTING.md
4. **Report Bugs** - Help us prioritize fixes

### Current Community Priorities

Based on GitHub discussions and issues:

1. **Node.js Support** (🆕 In Progress!)
   - Native bindings via napi-rs ✅
   - TypeScript-first API ✅
   - Framework integrations (Express, Next.js)
   - npm package publication

2. **Documentation** (High demand)
   - Quick start guides
   - Integration examples
   - Self-hosting tutorials
   - Node.js API reference

3. **Privacy Features** (High interest)
   - Fine-grained consent controls
   - PII detection and removal
   - Compliance automation (GDPR, CCPA)

4. **CLI Optimization** (Requested)
   - Minimal overhead (<1ms)
   - Graceful degradation
   - Offline-first design

5. **Self-Hosting** (Popular ask)
   - Simplified deployment
   - Cost-effective scaling
   - Cloud-parity features

---

## Non-Goals

Things we explicitly **won't** support:

❌ **Session Replay** - Too privacy-invasive
❌ **User Tracking Across Sites** - Against our privacy principles
❌ **PII Collection** - Anonymous by design
❌ **Vendor Lock-in** - Always self-hostable
❌ **Closed Source Features** - Core features always open source

---

## Versioning & Stability

### Semantic Versioning

We follow [SemVer 2.0](https://semver.org/):

- **Major (1.x.0):** Breaking changes
- **Minor (x.1.0):** New features (backwards compatible)
- **Patch (x.x.1):** Bug fixes

### Alpha/Beta Policy

- **Alpha** (0.x.0-alpha.y): Rapid iteration, expect breaking changes
- **Beta** (0.x.0-beta.y): Feature-complete, API stabilizing
- **RC** (0.x.0-rc.y): Production-ready, final testing

### Pre-1.0 Expectations

Before v1.0.0:
- ⚠️ APIs may change between minor versions
- ⚠️ Migration guides provided for breaking changes
- ⚠️ No long-term support guarantees
- ✅ Production use encouraged for non-critical applications

---

## Release Cadence

### Current (Pre-1.0)
- **Minor releases:** Every 6-8 weeks
- **Patch releases:** As needed (bugs, security)
- **Alpha/Beta:** As needed for testing

### Post-1.0
- **Major releases:** Yearly (with LTS)
- **Minor releases:** Quarterly
- **Patch releases:** Monthly (if needed)
- **Security patches:** Immediate

---

## Long-Term Vision (2-3 Years)

### Ecosystem Goals

**For Developers:**
- Telemetry as simple as `println!`
- Privacy compliance by default
- Zero vendor lock-in

**For Users:**
- Full control over their data
- Complete transparency
- Easy opt-out

**For the Rust Community:**
- Standard telemetry solution
- Best-in-class privacy practices
- Educational resource for observability

### Success Metrics

- **10,000+ crates** using telemetry-kit
- **100,000+ CLI tools** instrumented
- **1,000+ self-hosted** instances
- **Zero** privacy incidents
- **Top 100** most-used Rust crates

---

## How to Stay Updated

- 📰 **Changelog:** [CHANGELOG.md]CHANGELOG.md - All releases
- 🐦 **Twitter/X:** [@ibrahimcesar]https://twitter.com/ibrahimcesar - Major updates
- 💬 **Discussions:** [GitHub Discussions]https://github.com/ibrahimcesar/telemetry-kit/discussions - Community chat
- 📧 **Newsletter:** Coming soon - Monthly updates
- 🔔 **Watch Releases:** Star & watch the repo for notifications

---

## Contributing to the Roadmap

### Proposing Features

1. **Search** existing [Discussions]https://github.com/ibrahimcesar/telemetry-kit/discussions
2. **Open a Discussion** in "Ideas" category
3. **Describe:**
   - Use case and problem
   - Proposed solution
   - Alternative approaches
   - Privacy implications

4. **Community discussion****Issue creation****Implementation**

### Voting

Vote with 👍 on:
- GitHub Discussions
- GitHub Issues
- Pull Requests

We prioritize based on:
1. Community votes
2. Alignment with vision
3. Implementation feasibility
4. Maintenance burden

---

## Dependencies & Ecosystem

### Key Dependencies

We maintain minimal, well-audited dependencies:

- **Core:** serde, tokio, uuid, chrono
- **Storage:** rusqlite
- **Crypto:** hmac, sha2, hex
- **HTTP:** reqwest (optional, `sync` feature)
- **Privacy:** machine-uid (anonymous IDs)

### Supply Chain Security

- **SLSA Level 2** (current) ✅
- **SLSA Level 3** (target Q1 2025) 🔄
- **Dependency audits:** Weekly via `cargo audit`
- **License compliance:** Enforced via `cargo deny`

See [SLSA.md](SLSA.md) for details.

---

## Questions?

- 💬 **General questions:** [GitHub Discussions]https://github.com/ibrahimcesar/telemetry-kit/discussions
- 🐛 **Bug reports:** [GitHub Issues]https://github.com/ibrahimcesar/telemetry-kit/issues
- 🔒 **Security:** security@ibrahimcesar.com (see [SECURITY.md]SECURITY.md)
- 📧 **Contact:** email@ibrahimcesar.com

---

**This roadmap is a living document and will be updated as the project evolves.**

**Last Updated:** 2025-01-23
**Next Review:** Q2 2025