e11y 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +20 -0
  4. data/CHANGELOG.md +151 -13
  5. data/README.md +1138 -104
  6. data/RELEASE.md +254 -0
  7. data/Rakefile +377 -0
  8. data/benchmarks/OPTIMIZATION.md +246 -0
  9. data/benchmarks/README.md +103 -0
  10. data/benchmarks/allocation_profiling.rb +253 -0
  11. data/benchmarks/e11y_benchmarks.rb +447 -0
  12. data/benchmarks/ruby_baseline_allocations.rb +175 -0
  13. data/benchmarks/run_all.rb +9 -21
  14. data/docs/00-ICP-AND-TIMELINE.md +2 -2
  15. data/docs/ADR-001-architecture.md +1 -1
  16. data/docs/ADR-004-adapter-architecture.md +247 -0
  17. data/docs/ADR-009-cost-optimization.md +231 -115
  18. data/docs/ADR-017-multi-rails-compatibility.md +103 -0
  19. data/docs/ADR-INDEX.md +99 -0
  20. data/docs/CONTRIBUTING.md +312 -0
  21. data/docs/IMPLEMENTATION_PLAN.md +1 -1
  22. data/docs/QUICK-START.md +0 -6
  23. data/docs/use_cases/UC-019-retention-based-routing.md +584 -0
  24. data/e11y.gemspec +28 -17
  25. data/lib/e11y/adapters/adaptive_batcher.rb +3 -0
  26. data/lib/e11y/adapters/audit_encrypted.rb +10 -4
  27. data/lib/e11y/adapters/base.rb +15 -0
  28. data/lib/e11y/adapters/file.rb +4 -1
  29. data/lib/e11y/adapters/in_memory.rb +6 -0
  30. data/lib/e11y/adapters/loki.rb +9 -0
  31. data/lib/e11y/adapters/otel_logs.rb +11 -9
  32. data/lib/e11y/adapters/sentry.rb +9 -0
  33. data/lib/e11y/adapters/yabeda.rb +54 -10
  34. data/lib/e11y/buffers.rb +8 -8
  35. data/lib/e11y/console.rb +52 -60
  36. data/lib/e11y/event/base.rb +75 -10
  37. data/lib/e11y/event/value_sampling_config.rb +10 -4
  38. data/lib/e11y/events/rails/http/request.rb +1 -1
  39. data/lib/e11y/instruments/active_job.rb +6 -3
  40. data/lib/e11y/instruments/rails_instrumentation.rb +51 -28
  41. data/lib/e11y/instruments/sidekiq.rb +7 -7
  42. data/lib/e11y/logger/bridge.rb +24 -54
  43. data/lib/e11y/metrics/cardinality_protection.rb +257 -12
  44. data/lib/e11y/metrics/cardinality_tracker.rb +17 -0
  45. data/lib/e11y/metrics/registry.rb +6 -2
  46. data/lib/e11y/metrics/relabeling.rb +0 -56
  47. data/lib/e11y/metrics.rb +6 -1
  48. data/lib/e11y/middleware/audit_signing.rb +12 -9
  49. data/lib/e11y/middleware/pii_filter.rb +18 -10
  50. data/lib/e11y/middleware/request.rb +10 -4
  51. data/lib/e11y/middleware/routing.rb +117 -90
  52. data/lib/e11y/middleware/sampling.rb +47 -28
  53. data/lib/e11y/middleware/trace_context.rb +40 -11
  54. data/lib/e11y/middleware/validation.rb +20 -2
  55. data/lib/e11y/middleware/versioning.rb +1 -1
  56. data/lib/e11y/pii.rb +7 -7
  57. data/lib/e11y/railtie.rb +24 -20
  58. data/lib/e11y/reliability/circuit_breaker.rb +3 -0
  59. data/lib/e11y/reliability/dlq/file_storage.rb +16 -5
  60. data/lib/e11y/reliability/dlq/filter.rb +3 -0
  61. data/lib/e11y/reliability/retry_handler.rb +4 -0
  62. data/lib/e11y/sampling/error_spike_detector.rb +16 -5
  63. data/lib/e11y/sampling/load_monitor.rb +13 -4
  64. data/lib/e11y/self_monitoring/reliability_monitor.rb +3 -0
  65. data/lib/e11y/version.rb +1 -1
  66. data/lib/e11y.rb +86 -9
  67. metadata +83 -38
  68. data/docs/use_cases/UC-019-tiered-storage-migration.md +0 -562
  69. data/lib/e11y/middleware/pii_filtering.rb +0 -280
  70. data/lib/e11y/middleware/slo.rb +0 -168
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae952b91e779ee9e04150e324109586016d6dd0e9831d6acf7867e05f686f579
4
- data.tar.gz: 8c3a957e11bd4cc84b4f5fa9c90eae3248c083b98a518ee328cad76401d5454b
3
+ metadata.gz: 4c2fbfb3af2fb95f263bbd3e7068b9096bb3fda318142963d90367e0feabfb9d
4
+ data.tar.gz: 433928d7153ffce185577c99d82a31a63a25f0720b7c2ea7c27a306425c8abce
5
5
  SHA512:
6
- metadata.gz: ce56d9787c13db96db175a07418a34b17a43dd11dceb23d463c346abb7082caa1c45151826f6dc59981a069d8f2ec10d0f6eb4516f2da8cbce91754c483bae20
7
- data.tar.gz: b5b650f09a2b634e31fedcebd058965dbc9787960769387b12a84bb5c14c96eb68bcc3245d04393bb75d51011dd290064185040daddcbc975aa8a66f6bda1709
6
+ metadata.gz: 9119ba005f1b8be835aa331e50ecf0ab9c52c8dd13e14c2b9bdfa9f5af3c4341937a9c9f1b7c30b8d43c31b7287d1632221e67c82380b882c770a94af7cf2bbf
7
+ data.tar.gz: c29c35fffbc7c959cc56e1774338c8717cde744c677d38c98bd308cf96487a8ebe2a57690e82808afec347b5f48497e4ea0536e9067b413c3fa39776f655f266
data/.rspec CHANGED
@@ -2,3 +2,4 @@
2
2
  --format documentation
3
3
  --color
4
4
  --order random
5
+ --tag ~benchmark
data/.rubocop.yml CHANGED
@@ -5,6 +5,12 @@
5
5
 
6
6
  require:
7
7
  - rubocop-rspec
8
+ - rubocop-rspec_rails
9
+
10
+ plugins:
11
+ - rubocop-capybara
12
+ - rubocop-factory_bot
13
+ - rubocop-performance
8
14
 
9
15
  AllCops:
10
16
  TargetRubyVersion: 3.2
@@ -15,6 +21,7 @@ AllCops:
15
21
  - 'vendor/**/*'
16
22
  - 'node_modules/**/*'
17
23
  - 'tmp/**/*'
24
+ - 'benchmarks/**/*'
18
25
 
19
26
  # Metrics
20
27
  Metrics/BlockLength:
@@ -52,6 +59,9 @@ RSpec/ExampleLength:
52
59
  RSpec/MultipleExpectations:
53
60
  Max: 10 # Allow more expectations for integration tests
54
61
 
62
+ RSpec/MultipleMemoizedHelpers:
63
+ Max: 10 # Allow more memoized helpers for complex tests
64
+
55
65
  RSpec/NestedGroups:
56
66
  Max: 3
57
67
 
@@ -63,7 +73,17 @@ Gemspec/DevelopmentDependencies:
63
73
  RSpec/DescribeClass:
64
74
  Exclude:
65
75
  - "spec/zeitwerk_spec.rb"
76
+ - "spec/integration/**/*"
66
77
 
67
78
  # Allow simple doubles for now (will improve in Phase 1)
68
79
  RSpec/VerifiedDoubles:
69
80
  Enabled: false
81
+
82
+ # MessageSpies: Prefer explicit expect().to receive() for readability.
83
+ # Large codebase uses this pattern consistently (116 occurrences).
84
+ # Will be gradually migrated to have_received in future.
85
+ RSpec/MessageSpies:
86
+ Enabled: false
87
+
88
+ Capybara/RSpec/PredicateMatcher:
89
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,25 +2,163 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
10
  ### Added
11
- - Initial gem skeleton setup
12
- - Zeitwerk autoloading configuration
13
- - Basic project structure (lib/, spec/, bin/)
14
- - CI/CD pipeline (GitHub Actions)
15
- - Documentation framework (YARD, README)
16
11
 
17
- ## [0.1.0] - 2026-01-17
12
+ ### Changed
13
+
14
+ ### Fixed
15
+
16
+ ### Deprecated
17
+
18
+ ### Removed
19
+
20
+ ### Security
21
+
22
+ ## [0.2.0] - 2026-01-26
18
23
 
19
24
  ### Added
20
- - Project initialization
21
- - Phase 0: Gem Setup & Best Practices Research complete
22
- - Research documents for 6 successful gems (Devise, Sidekiq, Puma, Dry-rb, Yabeda, Sentry)
23
- - Best practices synthesis for configuration DSL, testing, documentation, CI/CD, release process
25
+ - Multi-Rails version support (7.0, 7.1, 8.0) (#5)
26
+ - CI matrix testing across Ruby 3.2, 3.3 with Rails 7.0, 7.1, 8.0
27
+ - Dynamic Gemfile dependencies based on RAILS_VERSION env var
28
+ - Support for sqlite3 1.4 (Rails 7.x) and 2.0 (Rails 8.x)
29
+ - Comprehensive test suite documentation in README (#5)
30
+ - Quick commands using rake tasks
31
+ - Manual commands for each test suite
32
+ - Test suite overview with timing and example counts
33
+ - Development commands reference
34
+ - Climate Control gem for ENV manipulation in tests (#5)
35
+
36
+ ### Fixed
37
+ - **RequestScopedBuffer API method names** (#5)
38
+ - `start!` → `initialize!` (correct initialization method)
39
+ - `flush!` → `discard` (for success path - discard buffered events)
40
+ - `flush_on_error!` → `flush_on_error` (remove bang, method doesn't modify in-place)
41
+ - This eliminates warning messages during test execution
42
+ - **BREAKING CHANGE:** If you use `E11y::Buffers::RequestScopedBuffer` directly, update method names
43
+ - Rails instrumentation event namespaces (#5)
44
+ - Fixed: `"Events::Rails::*"` → `"E11y::Events::Rails::*"`
45
+ - Resolves uninitialized constant errors in Rails instrumentation
46
+ - Rails 8.0 exception handling test compatibility (#5)
47
+ - Updated error handling test to support both Rails 7.x and 8.0 behaviors
48
+ - Rails 8.0 changed: exceptions caught and converted to 500 responses
49
+ - Rails 7.x: exceptions raised with show_exceptions = false
50
+ - HTTP request format validation (#5)
51
+ - Now accepts Symbol (e.g., :html, :json) as Rails passes format as Symbol
52
+ - Removed strict :string type check from format field
53
+ - Integration test isolation issues (#5)
54
+ - Moved Rails initialization to spec_helper.rb (prevents FrozenError)
55
+ - Renamed TestJob → DummyTestJob to prevent class conflicts
56
+ - Fixed railtie integration spec tag isolation
57
+ - Added File.exist? check for routes file in railtie tests
58
+ - Floating point precision in stratified sampling tests (#5)
59
+ - Increased upper bound from 0.95 to 0.96 to handle FP precision
60
+ - Fixes intermittent test failures: expected 0.9500000000000001 to be <= 0.95
61
+ - Test isolation in active_job_spec.rb (#5)
62
+ - Store and restore original request_buffer.enabled config
63
+ - Prevents config changes from affecting subsequent tests
64
+ - View rendering instrumentation test (#5)
65
+ - Added posts/list.html.erb template
66
+ - Added posts#list action to render HTML views
67
+ - Implemented complete test for view rendering events (was pending)
68
+
69
+ ### Changed
70
+ - CI workflow now tests against multiple Rails versions (#5)
71
+ - Matrix: Ruby 3.2, 3.3 × Rails 7.0, 7.1, 8.0
72
+ - Separate artifact uploads per Ruby/Rails combination
73
+ - Enhanced test output with Rails version information
74
+ - Improved test execution speed with better organization (#5)
75
+ - Separate rake tasks: spec:unit, spec:integration, spec:railtie
76
+ - Unit tests exclude integration and railtie specs
77
+ - Integration tests run only integration specs
78
+ - Total: 1729 examples (1672 unit + 36 integration + 21 railtie)
79
+ - RuboCop configuration (#5)
80
+ - Exclude spec/integration/**/* from RSpec/DescribeClass cop
81
+ - Integration tests don't always describe a specific class
82
+
83
+ ### Breaking Changes
84
+
85
+ #### RequestScopedBuffer API (affects only direct usage)
86
+
87
+ If you use `E11y::Buffers::RequestScopedBuffer` directly in your code, update method names:
88
+
89
+ **Before (incorrect):**
90
+ ```ruby
91
+ E11y::Buffers::RequestScopedBuffer.start! # ❌ Wrong
92
+ E11y::Buffers::RequestScopedBuffer.flush! # ❌ Wrong
93
+ E11y::Buffers::RequestScopedBuffer.flush_on_error! # ❌ Wrong
94
+ ```
95
+
96
+ **After (correct):**
97
+ ```ruby
98
+ E11y::Buffers::RequestScopedBuffer.initialize! # ✅ Correct
99
+ E11y::Buffers::RequestScopedBuffer.discard # ✅ Correct
100
+ E11y::Buffers::RequestScopedBuffer.flush_on_error # ✅ Correct
101
+ ```
102
+
103
+ **Impact:** LOW - RequestScopedBuffer is an internal API. Most users are not affected as the middleware, ActiveJob, and Sidekiq instrumentations are already updated. Only users who directly call these methods need to update their code.
104
+
105
+ **Migration:** Search your codebase for `RequestScopedBuffer` and update method names if found.
106
+
107
+ ---
108
+
109
+ ## [0.1.0] - 2026-01-17
110
+
111
+ Initial release of E11y - Event-driven observability for Rails applications.
112
+
113
+ ### Features
114
+
115
+ - **Core Event System**
116
+ - Unified event API with dry-schema validation
117
+ - Type-safe event schemas
118
+ - Extensible adapter architecture
119
+ - Request-scoped debug buffering
120
+
121
+ - **Rails Integration**
122
+ - Automatic Rails instrumentation
123
+ - ActiveJob tracking
124
+ - Sidekiq middleware
125
+ - Rails.logger bridge
126
+ - Trace context propagation
127
+
128
+ - **Adapters**
129
+ - Loki (logs)
130
+ - Prometheus (metrics)
131
+ - Sentry (errors)
132
+ - OpenTelemetry (traces)
133
+ - Elasticsearch (search)
134
+ - Redis (fast writes)
135
+ - Audit log (encrypted storage)
136
+
137
+ - **Advanced Features**
138
+ - Pattern-based metrics extraction
139
+ - PII filtering with configurable rules
140
+ - Stratified sampling
141
+ - Rate limiting
142
+ - High-cardinality protection
143
+ - Error handling with retry and DLQ
144
+
145
+ - **Developer Experience**
146
+ - RSpec matchers for testing
147
+ - InMemory test adapter
148
+ - Zero-config defaults
149
+ - Comprehensive documentation
150
+ - 25+ ADRs and use cases
151
+
152
+ ### Supported Versions
153
+
154
+ - Ruby: 3.2, 3.3
155
+ - Rails: 8.0
156
+ - RSpec: 3.13+
157
+
158
+ ### Documentation
24
159
 
25
- [Unreleased]: https://github.com/arturseletskiy/e11y/compare/v0.1.0...HEAD
26
- [0.1.0]: https://github.com/arturseletskiy/e11y/releases/tag/v0.1.0
160
+ - 17 Architecture Decision Records (ADRs)
161
+ - 22 Use Cases with examples
162
+ - Complete API documentation
163
+ - Testing guide
164
+ - Migration guides