chronos-ruby 0.1.0.pre.2
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +34 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +23 -0
- data/LICENSE.txt +21 -0
- data/README.md +251 -0
- data/SECURITY.md +9 -0
- data/contracts/event-v1.schema.json +51 -0
- data/docs/adr/ADR-001-core-and-integrations.md +25 -0
- data/docs/adr/ADR-002-version-lines.md +25 -0
- data/docs/adr/ADR-003-net-http-legacy-transport.md +25 -0
- data/docs/adr/ADR-004-bounded-queue.md +25 -0
- data/docs/adr/ADR-005-sanitize-before-backlog.md +25 -0
- data/docs/adr/ADR-006-versioned-event-contract.md +25 -0
- data/docs/architecture.md +31 -0
- data/docs/compatibility.md +21 -0
- data/docs/configuration.md +40 -0
- data/docs/data-collected.md +20 -0
- data/docs/examples/plain-ruby.md +12 -0
- data/docs/modules/async-queue.md +17 -0
- data/docs/modules/configuration.md +9 -0
- data/docs/modules/notice-pipeline.md +20 -0
- data/docs/modules/transport.md +9 -0
- data/docs/performance.md +16 -0
- data/docs/privacy-lgpd.md +16 -0
- data/docs/troubleshooting.md +25 -0
- data/lib/chronos/adapters/net_http_transport.rb +132 -0
- data/lib/chronos/adapters.rb +10 -0
- data/lib/chronos/agent.rb +57 -0
- data/lib/chronos/application/capture_exception.rb +61 -0
- data/lib/chronos/application.rb +10 -0
- data/lib/chronos/configuration.rb +139 -0
- data/lib/chronos/core/backtrace_parser.rb +74 -0
- data/lib/chronos/core/exception_cause_collector.rb +63 -0
- data/lib/chronos/core/notice.rb +53 -0
- data/lib/chronos/core/notice_builder.rb +83 -0
- data/lib/chronos/core/payload_serializer.rb +165 -0
- data/lib/chronos/core/runtime_info.rb +42 -0
- data/lib/chronos/core.rb +10 -0
- data/lib/chronos/errors.rb +24 -0
- data/lib/chronos/internal/bounded_queue.rb +79 -0
- data/lib/chronos/internal/safe_logger.rb +55 -0
- data/lib/chronos/internal/worker_pool.rb +155 -0
- data/lib/chronos/internal.rb +10 -0
- data/lib/chronos/ports/transport.rb +45 -0
- data/lib/chronos/ports.rb +10 -0
- data/lib/chronos/ruby/version.rb +1 -0
- data/lib/chronos/ruby.rb +1 -0
- data/lib/chronos/version.rb +4 -0
- data/lib/chronos.rb +98 -0
- metadata +156 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 203d12bad0a790efdb2bb89bcbc9127f067fc096507c6345aefbbdc7ed13966c
|
|
4
|
+
data.tar.gz: 2fb4eb956405f099b10b3e6f9429800446faf24127bc35b3e092dce316c1edb2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 30be78abcf064b43e2f395c7493f5e7b037c8f1b8ac8dd5a4fc507ea86eae7c89fe0104f094551e3e92d68b4dded9010949fc9a79e43c01880217266bcebaa9c
|
|
7
|
+
data.tar.gz: 907ba0c16f873d533714b1a06448e857e7a4c8bfcf2b524a150bf0906244d507cf5e6b961d3db219bf63da6d3bf6933474e25360f3715d3e93b0e7d07929db21
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are documented here. The project follows Semantic Versioning.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.0.pre.2] - 2026-07-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- prepared the second public pre-release;
|
|
12
|
+
- aligned the release tag with the RubyGems version format.
|
|
13
|
+
|
|
14
|
+
## [0.1.0.pre.1] - 2026-07-19
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- framework-independent `Chronos` facade;
|
|
19
|
+
- validated immutable configuration;
|
|
20
|
+
- exception, backtrace, cause, and runtime normalization;
|
|
21
|
+
- versioned JSON exception envelope;
|
|
22
|
+
- bounded serialization and payload size enforcement;
|
|
23
|
+
- Net::HTTP transport with TLS, proxy, timeout, and response classification;
|
|
24
|
+
- fixed-capacity asynchronous queue and lazy worker pool;
|
|
25
|
+
- flush, timed shutdown, double-close, and fork handling;
|
|
26
|
+
- Ruby 2.2.10–2.6 legacy test matrix;
|
|
27
|
+
- contract, unit, integration, failure, and performance test assets.
|
|
28
|
+
|
|
29
|
+
### Known limitations
|
|
30
|
+
|
|
31
|
+
- no advanced sensitive-data sanitizer;
|
|
32
|
+
- no retry or backlog;
|
|
33
|
+
- no automatic Rack, Rails, or job integration;
|
|
34
|
+
- no performance monitoring or deploy events.
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at antoniojeferson96@gmail.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Open an issue before adding a public API, runtime dependency, framework integration, or protocol field.
|
|
4
|
+
|
|
5
|
+
For each change:
|
|
6
|
+
|
|
7
|
+
1. keep syntax compatible with Ruby 2.2.10 on the 0.x line;
|
|
8
|
+
2. write or update unit, contract, and integration tests;
|
|
9
|
+
3. keep Core independent of frameworks and HTTP;
|
|
10
|
+
4. bound every queue, buffer, collection, timeout, and retry;
|
|
11
|
+
5. document public classes with responsibility, motivation, limits, collaborators, thread safety, compatibility, examples, errors, and performance where relevant;
|
|
12
|
+
6. update module documentation, ADRs, README, and changelog;
|
|
13
|
+
7. do not declare compatibility before its dedicated CI gate succeeds.
|
|
14
|
+
|
|
15
|
+
Run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bin/setup
|
|
19
|
+
bundle _1.17.3_ exec rake
|
|
20
|
+
ruby script/verify_docs
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Do not include credentials, personal data, production payloads, or proprietary third-party code in issues, fixtures, or pull requests.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antonio Jefferson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Chronos Ruby
|
|
2
|
+
|
|
3
|
+
Chronos Ruby is the framework-independent client for sending Ruby application errors to Chronos. Version 0.1 is the legacy foundation: it captures exceptions manually, builds a bounded JSON event, and delivers it synchronously or through a fixed-size asynchronous queue.
|
|
4
|
+
|
|
5
|
+
## What the gem collects
|
|
6
|
+
|
|
7
|
+
For each exception, version 0.1 can collect:
|
|
8
|
+
|
|
9
|
+
- exception class, message, structured backtrace, and chained causes;
|
|
10
|
+
- timestamp, severity, tags, and an optional fingerprint;
|
|
11
|
+
- application-supplied context, parameters, session, and user fields;
|
|
12
|
+
- Ruby version, engine, platform, process ID, opaque thread ID, and hostname;
|
|
13
|
+
- application version, environment, and service name.
|
|
14
|
+
|
|
15
|
+
See [Data collected](docs/data-collected.md) for the complete field table.
|
|
16
|
+
|
|
17
|
+
## What is not collected by default
|
|
18
|
+
|
|
19
|
+
Chronos Ruby does not inspect environment variables, request bodies, cookies, HTTP headers, source code, database contents, or installed gems. Version 0.1 does not automatically sanitize application-supplied context. Do not pass passwords, tokens, cookies, personal documents, or payment data. Advanced redaction belongs to version 0.2.
|
|
20
|
+
|
|
21
|
+
## Supported Ruby and Rails versions
|
|
22
|
+
|
|
23
|
+
Version 0.x targets Ruby 2.2.10 through Ruby 2.6. Version 0.1 is independent of Rails and does not yet declare support for any Rails integration. All supported combinations must pass dedicated CI before being listed as supported.
|
|
24
|
+
|
|
25
|
+
See [Compatibility](docs/compatibility.md).
|
|
26
|
+
|
|
27
|
+
## Plain Ruby installation
|
|
28
|
+
|
|
29
|
+
The current public build is a pre-release. Add its exact version to the application's `Gemfile`:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
gem "chronos-ruby", "0.1.0.pre.2"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Install with a Bundler version compatible with the application. For the oldest supported runtime:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
gem install bundler -v 1.17.3
|
|
39
|
+
bundle _1.17.3_ install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Without Bundler:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gem install chronos-ruby --pre
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Rails installation
|
|
49
|
+
|
|
50
|
+
Rails automatic integration is not part of version 0.1. A Rails application may use the plain Ruby API, but this does not constitute declared Rails support. Rack and Rails adapters are planned for later legacy releases.
|
|
51
|
+
|
|
52
|
+
## Minimum configuration
|
|
53
|
+
|
|
54
|
+
`project_id`, `project_key`, and an HTTPS `host` are required while the agent is enabled:
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
require "chronos"
|
|
58
|
+
|
|
59
|
+
Chronos.configure do |config|
|
|
60
|
+
config.project_id = ENV["CHRONOS_PROJECT_ID"]
|
|
61
|
+
config.project_key = ENV["CHRONOS_PROJECT_KEY"]
|
|
62
|
+
config.host = "https://chronos.example.com"
|
|
63
|
+
config.environment = ENV["APP_ENV"] || "production"
|
|
64
|
+
config.service_name = "billing"
|
|
65
|
+
config.app_version = ENV["APP_VERSION"]
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
HTTPS verification is enabled by default. HTTP requires explicitly setting `ssl_verify = false` and should only be used with a local test server.
|
|
70
|
+
|
|
71
|
+
## Automatic capture
|
|
72
|
+
|
|
73
|
+
Automatic exception capture is not implemented in version 0.1. Applications must call `Chronos.notify` or `Chronos.notify_sync`. Rack, Rails, and worker hooks will be introduced only after their compatibility suites exist.
|
|
74
|
+
|
|
75
|
+
## Manual capture
|
|
76
|
+
|
|
77
|
+
Asynchronous capture is recommended for application code:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
begin
|
|
81
|
+
perform_payment
|
|
82
|
+
rescue StandardError => error
|
|
83
|
+
Chronos.notify(error, :tags => ["payment"])
|
|
84
|
+
raise
|
|
85
|
+
end
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Synchronous capture waits for the HTTP result and is useful in scripts or controlled shutdown paths:
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
delivered = Chronos.notify_sync(RuntimeError.new("import failed"))
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Both methods return `false` instead of allowing an internal agent error to escape.
|
|
95
|
+
|
|
96
|
+
## User context
|
|
97
|
+
|
|
98
|
+
User data is opt-in and must contain only values your application is allowed to send:
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
Chronos.notify(error, :user => {"id" => "customer-42", "role" => "operator"})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Avoid names, e-mail addresses, documents, tokens, and other personal or secret fields in version 0.1.
|
|
105
|
+
|
|
106
|
+
## Breadcrumbs
|
|
107
|
+
|
|
108
|
+
Breadcrumbs are not implemented in version 0.1.
|
|
109
|
+
|
|
110
|
+
## Filters and LGPD
|
|
111
|
+
|
|
112
|
+
Version 0.1 limits depth, collection length, string length, backtrace length, and total payload size. It does not provide the recursive sensitive-data filter planned for version 0.2. Review all supplied context before production use. See [Privacy and LGPD](docs/privacy-lgpd.md).
|
|
113
|
+
|
|
114
|
+
## Ignore rules
|
|
115
|
+
|
|
116
|
+
Entire environments can be ignored:
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
Chronos.configure do |config|
|
|
120
|
+
# required options omitted
|
|
121
|
+
config.ignored_environments = ["development", "test"]
|
|
122
|
+
end
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Exception-specific ignore rules are not available in version 0.1.
|
|
126
|
+
|
|
127
|
+
## Performance monitoring
|
|
128
|
+
|
|
129
|
+
Request, SQL, cache, job, and external HTTP monitoring are not implemented in version 0.1. The local capture pipeline is bounded and HTTP delivery runs outside the caller thread when `Chronos.notify` is used.
|
|
130
|
+
|
|
131
|
+
## Sidekiq and Active Job
|
|
132
|
+
|
|
133
|
+
Sidekiq and Active Job integrations are not implemented in version 0.1. Calling the manual API from a job is possible, but automatic capture and deduplication are not yet guaranteed.
|
|
134
|
+
|
|
135
|
+
## Deploy tracking
|
|
136
|
+
|
|
137
|
+
Deploy notifications are not implemented in version 0.1. `app_version` may be included in exception events for release correlation.
|
|
138
|
+
|
|
139
|
+
## Asynchronous queue
|
|
140
|
+
|
|
141
|
+
The queue has a fixed capacity and drops the newest event when full. Worker threads are created lazily after the first accepted event. The default capacity is 100 events with one worker.
|
|
142
|
+
|
|
143
|
+
```mermaid
|
|
144
|
+
flowchart LR
|
|
145
|
+
E[Exception] --> N[Notice builder]
|
|
146
|
+
N --> S[Bounded serializer]
|
|
147
|
+
S --> Q[Bounded queue]
|
|
148
|
+
Q --> W[Fixed worker pool]
|
|
149
|
+
W --> H[Net::HTTP transport]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use `Chronos.flush(timeout)` to wait for accepted events and `Chronos.close(timeout)` during shutdown. Workers are recreated after a process fork.
|
|
153
|
+
|
|
154
|
+
## Retry and backlog
|
|
155
|
+
|
|
156
|
+
Version 0.1 classifies network failures, `429`, `4xx`, and `5xx`, but does not retry or persist events. Failed deliveries are dropped after the attempt. Bounded retry and backlog are planned for version 0.3.
|
|
157
|
+
|
|
158
|
+
## How it works internally
|
|
159
|
+
|
|
160
|
+
The code follows hexagonal boundaries:
|
|
161
|
+
|
|
162
|
+
- `Chronos::Core` contains immutable notices and normalization;
|
|
163
|
+
- `Chronos::Application` coordinates capture;
|
|
164
|
+
- `Chronos::Ports` defines delivery behavior;
|
|
165
|
+
- `Chronos::Adapters` implements Net::HTTP delivery;
|
|
166
|
+
- `Chronos::Internal` owns bounded queueing, workers, and defensive logging.
|
|
167
|
+
|
|
168
|
+
The core has no dependency on Rails, Rack, Sidekiq, or ActiveSupport. See [Architecture](docs/architecture.md).
|
|
169
|
+
|
|
170
|
+
## Environment-specific configuration
|
|
171
|
+
|
|
172
|
+
Configuration values are explicit; the gem never scans the process environment. Read only the variables your application chooses:
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
Chronos.configure do |config|
|
|
176
|
+
config.project_id = ENV["CHRONOS_PROJECT_ID"]
|
|
177
|
+
config.project_key = ENV["CHRONOS_PROJECT_KEY"]
|
|
178
|
+
config.host = ENV["CHRONOS_HOST"]
|
|
179
|
+
config.environment = ENV["APP_ENV"] || "production"
|
|
180
|
+
config.enabled = ENV["CHRONOS_ENABLED"] != "false"
|
|
181
|
+
config.queue_size = 100
|
|
182
|
+
config.workers = 1
|
|
183
|
+
config.timeout = 5.0
|
|
184
|
+
config.open_timeout = 2.0
|
|
185
|
+
end
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
All options are documented in [Configuration](docs/configuration.md).
|
|
189
|
+
|
|
190
|
+
## Troubleshooting
|
|
191
|
+
|
|
192
|
+
Configuration errors are raised during `Chronos.configure`. Capture and delivery errors are contained and optionally reported to the configured logger. Verify credentials, HTTPS certificates, timeouts, and `Chronos.flush` results. See [Troubleshooting](docs/troubleshooting.md).
|
|
193
|
+
|
|
194
|
+
## Benchmark
|
|
195
|
+
|
|
196
|
+
Run the version 0.1 benchmarks with:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
bundle _1.17.3_ exec ruby benchmarks/capture_exception.rb
|
|
200
|
+
bundle _1.17.3_ exec ruby benchmarks/serialization.rb
|
|
201
|
+
bundle _1.17.3_ exec ruby benchmarks/queue.rb
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Results depend on runtime, hardware, and payload. No performance comparison is claimed until repeatable measurements are published.
|
|
205
|
+
|
|
206
|
+
## Migration from Airbrake
|
|
207
|
+
|
|
208
|
+
An Airbrake migration guide will be added before the legacy 1.0 release. Version 0.1 does not claim API compatibility or automatic replacement.
|
|
209
|
+
|
|
210
|
+
## Local development
|
|
211
|
+
|
|
212
|
+
Clone the repository, install Bundler 1.17.3, and run setup:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
gem install bundler -v 1.17.3
|
|
216
|
+
bin/setup
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Open an interactive console:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
bin/console
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Install the current source locally:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
bundle _1.17.3_ exec rake install
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Tests
|
|
232
|
+
|
|
233
|
+
Run the complete suite on the current Ruby:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
bundle _1.17.3_ exec rake
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The legacy CI matrix covers Ruby 2.2.10, 2.3.8, 2.4.10, 2.5.9, and 2.6.10. Network integration tests use a local fake HTTP server.
|
|
240
|
+
|
|
241
|
+
## Contributing
|
|
242
|
+
|
|
243
|
+
Open an issue before introducing a new public API or dependency. Every public class requires YARD documentation, tests, module documentation, and compatibility evidence. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
244
|
+
|
|
245
|
+
## Security
|
|
246
|
+
|
|
247
|
+
Never include credentials in event context or logs. Report vulnerabilities privately according to [SECURITY.md](SECURITY.md). Ruby 2.2 through 2.6 are end-of-life; Chronos provides technical compatibility, not runtime security maintenance.
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
Chronos Ruby is distributed under the terms of the MIT License. See [LICENSE.txt](LICENSE.txt).
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
Do not report vulnerabilities in a public issue. Send a private report to `antoniojeferson96@gmail.com` with the affected version, impact, reproduction steps, and any suggested mitigation.
|
|
4
|
+
|
|
5
|
+
Never include live project keys, customer payloads, personal data, or production credentials in a report.
|
|
6
|
+
|
|
7
|
+
The Chronos 0.x line provides technical compatibility with end-of-life Ruby versions. It cannot provide security maintenance for the Ruby runtime, OpenSSL, operating system, Rails, or other dependencies used by the host application.
|
|
8
|
+
|
|
9
|
+
Security fixes in the agent will be assessed for backporting to maintained Chronos version lines. No response-time commitment is made before a formal security process is published.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://chronos.example/schemas/event-v1.schema.json",
|
|
4
|
+
"title": "Chronos event envelope v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"event_id",
|
|
10
|
+
"event_type",
|
|
11
|
+
"occurred_at",
|
|
12
|
+
"sent_at",
|
|
13
|
+
"project_key",
|
|
14
|
+
"environment",
|
|
15
|
+
"service",
|
|
16
|
+
"runtime",
|
|
17
|
+
"context",
|
|
18
|
+
"payload"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"schema_version": {"const": "1.0"},
|
|
22
|
+
"event_id": {"type": "string", "minLength": 1},
|
|
23
|
+
"event_type": {"enum": ["exception"]},
|
|
24
|
+
"occurred_at": {"type": "string"},
|
|
25
|
+
"sent_at": {"type": "string"},
|
|
26
|
+
"project_key": {"type": "string", "minLength": 1},
|
|
27
|
+
"environment": {"type": "string"},
|
|
28
|
+
"service": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"required": ["name", "version", "instance_id"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"name": {"type": ["string", "null"]},
|
|
33
|
+
"version": {"type": ["string", "null"]},
|
|
34
|
+
"instance_id": {"type": ["string", "null"]}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"runtime": {"type": "object"},
|
|
38
|
+
"context": {"type": "object"},
|
|
39
|
+
"payload": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["exception", "severity"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"exception": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["class", "message", "backtrace", "causes"]
|
|
46
|
+
},
|
|
47
|
+
"severity": {"type": "string"}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-001 — Separate core and integrations
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Chronos must support plain Ruby and several incompatible framework generations without coupling event modeling to Rails or worker libraries.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Use hexagonal boundaries: Core, Application, Ports, Adapters, and Internal. The public `Chronos` module remains a thin facade.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
A single notifier class was rejected because framework hooks, HTTP, and domain rules would evolve together. A plugin framework was rejected for version 0.1 because it would add abstractions without current integrations.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
Core tests run without Rails, transports are replaceable, and legacy integrations can use feature detection.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
The repository contains more small files and explicit composition code.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-002 — Compatibility through version lines
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
One dependency and syntax baseline cannot safely serve Ruby 2.2 and modern fiber-aware Ruby releases indefinitely.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Use 0.x for Ruby 2.2.10–2.6, 1.x for transitional Ruby 2.7–3.2, and 2.x for Ruby 3.3 and newer. Support is declared only after the required CI and integration evidence exists.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
A single ever-growing major line was rejected because modern dependencies would eventually break installation in legacy applications.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
Legacy applications receive conservative fixes while modern code can adopt runtime capabilities safely.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
Critical protocol and security fixes may need backports across maintained lines.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-003 — Net::HTTP for legacy transport
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
An HTTP client dependency can abandon old Ruby versions or conflict with the host application bundle.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Implement the version 0.x transport with `Net::HTTP`, explicit timeouts, TLS verification, optional proxy support, no automatic redirects, and result classification.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
Faraday and other clients were deferred because they add dependencies and version-resolution risk.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
The agent has no runtime gem dependency and controls legacy behavior directly.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
Connection pooling and middleware conveniences require explicit implementation later.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-004 — Bounded queue and drop policy
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
An unavailable endpoint or event burst must not grow host application memory indefinitely.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Use a fixed-capacity in-memory queue. Producers never wait for space. When full, the newest event is dropped and counted. Worker count is fixed and threads start lazily.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
An unbounded queue and one thread per event were rejected. Blocking producers was rejected because telemetry must not stall application work.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
Memory and thread growth are bounded and overload behavior is measurable.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
Events may be dropped under sustained pressure.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-005 — Sanitize before backlog
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Proposed for versions 0.2 and 0.3; no backlog exists in 0.1.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Persisting unsanitized events would increase privacy and credential exposure risk.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
Any future retry or persistent backlog must receive only data that has already passed sanitization and structural limits.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
Sanitizing only during final delivery is rejected because backlog data would remain exposed.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
Retry storage cannot contain raw pre-filter payloads by design.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
Filtering decisions cannot be changed retroactively for already accepted events.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-006 — Versioned event contract
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Clients and the Chronos SaaS evolve independently and require a testable compatibility boundary.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
All events use a common envelope with `schema_version`. Version 0.1 emits exception events using schema `1.0`, UUID event IDs, ISO-8601 UTC timestamps, JSON primitives, and an idempotency header.
|
|
14
|
+
|
|
15
|
+
## Alternatives
|
|
16
|
+
|
|
17
|
+
Sending Ruby object serialization or an unversioned free-form hash was rejected.
|
|
18
|
+
|
|
19
|
+
## Positive consequences
|
|
20
|
+
|
|
21
|
+
Payloads can be validated, replayed safely, and evolved with backward compatibility.
|
|
22
|
+
|
|
23
|
+
## Negative consequences
|
|
24
|
+
|
|
25
|
+
Schema evolution requires explicit server and client coordination.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
Chronos Ruby 0.1 uses hexagonal boundaries so the legacy core remains independent of frameworks and delivery infrastructure.
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart TB
|
|
7
|
+
Facade[Chronos facade] --> Application[Application / CaptureException]
|
|
8
|
+
Application --> Core[Core / Notice and serialization]
|
|
9
|
+
Application --> Ports[Ports / Transport contract]
|
|
10
|
+
Ports --> Adapter[Adapters / NetHttpTransport]
|
|
11
|
+
Application --> Internal[Internal / BoundedQueue and WorkerPool]
|
|
12
|
+
Internal --> Ports
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Boundaries
|
|
16
|
+
|
|
17
|
+
- Domain/Core owns immutable event values and Ruby normalization.
|
|
18
|
+
- Application owns use-case ordering and failure containment.
|
|
19
|
+
- Ports define behavior expected from infrastructure.
|
|
20
|
+
- Adapters contain Net::HTTP and TLS behavior.
|
|
21
|
+
- Internal contains private concurrency and diagnostic mechanisms.
|
|
22
|
+
|
|
23
|
+
The `Chronos` module is a thin facade. Rails, Rack, ActiveSupport, Sidekiq, and job libraries must not be required by the core.
|
|
24
|
+
|
|
25
|
+
## Capture flow
|
|
26
|
+
|
|
27
|
+
An exception becomes an immutable notice, then a bounded JSON envelope. Asynchronous capture inserts the serialized event into a bounded queue. A fixed worker sends it through the transport. Synchronous capture bypasses the queue.
|
|
28
|
+
|
|
29
|
+
## Failure policy
|
|
30
|
+
|
|
31
|
+
Explicit invalid configuration raises `Chronos::ConfigurationError`. Capture, serialization, logger, worker, TLS, network, and HTTP failures do not escape into the host application. They produce `false`, a transport result, or a bounded logger diagnostic.
|