chronos-ruby 0.9.0.pre.3 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +101 -181
- data/contracts/integration-verification-response-v1.schema.json +76 -0
- data/docs/adr/ADR-007-feature-detection.md +25 -0
- data/docs/adr/ADR-008-context-store.md +25 -0
- data/docs/adr/ADR-009-sampling.md +25 -0
- data/docs/adr/ADR-010-opentelemetry-interoperability.md +25 -0
- data/docs/adr/ADR-018-pre-1.0-hardening.md +6 -2
- data/docs/compatibility.md +30 -23
- data/docs/data-collected.md +3 -0
- data/docs/deprecation-policy.md +1 -1
- data/docs/migration-from-airbrake.md +1 -1
- data/docs/modules/breadcrumbs.md +23 -0
- data/docs/modules/context.md +21 -0
- data/docs/modules/deploys.md +23 -0
- data/docs/modules/integration-verification.md +65 -0
- data/docs/modules/job-monitoring.md +22 -0
- data/docs/modules/request-monitoring.md +20 -0
- data/docs/modules/runtime-metrics.md +22 -0
- data/docs/modules/sampling.md +22 -0
- data/docs/modules/sidekiq-legacy.md +1 -1
- data/docs/modules/sql-monitoring.md +22 -0
- data/docs/performance.md +13 -2
- data/docs/protocol-v1.md +3 -1
- data/docs/release-1.0-readiness.md +17 -15
- data/docs/security-review.md +4 -3
- data/docs/troubleshooting.md +6 -0
- data/lib/chronos/adapters/net_http_transport.rb +36 -2
- data/lib/chronos/agent.rb +21 -0
- data/lib/chronos/application/delivery_pipeline.rb +6 -3
- data/lib/chronos/application/verify_integration.rb +262 -0
- data/lib/chronos/core/integration_verification_result.rb +108 -0
- data/lib/chronos/errors.rb +11 -0
- data/lib/chronos/ports/transport.rb +18 -1
- data/lib/chronos/rails/railtie.rb +5 -0
- data/lib/chronos/rake_tasks.rb +41 -0
- data/lib/chronos/version.rb +1 -1
- data/lib/chronos.rb +26 -0
- metadata +35 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fc9daff111666fdf7309797c5f8aa81a639c8f59ea1733be48740b9aea6b247
|
|
4
|
+
data.tar.gz: a8d7cd786b233078e5516e3d1ce0c92b986d045ebd4d8c29a7d9cd80ae75fb93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f60a09480aa5766676d673579ffe1b5b007d044881fc9b1f70f672c414ddf7e1a014cc63eaeee8ee6f63fa7261aa5dc92f8f9b1cc6089898ecf015d1940a83c
|
|
7
|
+
data.tar.gz: '08342c5a665004cbfa9fec52164f86e82d003b3d587bf931ae220c44ec4188c91141852e424f726f55a7b7d5dec4592190dc7cef9dc6c4e05f0eec8255bd32b4'
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,40 @@ All notable changes are documented here. The project follows Semantic Versioning
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [1.0.0] - 2026-07-29
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- stable legacy release gates for Ruby 2.2.10 through 2.6.10, Rails 4.2/5.2, Sidekiq 4/5, documentation, repeatable comparison, and fake-endpoint load validation;
|
|
12
|
+
- the remaining mandatory module documents and ADRs for feature detection, context storage, sampling, and future OpenTelemetry interoperability.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- promoted the reviewed public API and protocol v1 implementation from `0.9.0.pre.4` to `1.0.0`;
|
|
17
|
+
- release publishing now accepts `v1.*` tags and cannot publish until every legacy compatibility and release-readiness job succeeds;
|
|
18
|
+
- compatibility status is now `Supported` only for the exact runtime/framework combinations covered by green release gates.
|
|
19
|
+
|
|
20
|
+
### Security
|
|
21
|
+
|
|
22
|
+
- stable artifacts continue to use RubyGems Trusted Publishing, SHA-256 checksums, SPDX SBOMs, strict payload privacy contracts, and dependency auditing;
|
|
23
|
+
- package signing remains deferred until a trusted signing-key lifecycle is available.
|
|
24
|
+
|
|
25
|
+
## [0.9.0.pre.4] - 2026-07-22
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- `Chronos.verify_integration` and `chronos:verify_integration` send a correlated synthetic exception and report credential, project, receiver, and receipt status as bounded JSON;
|
|
30
|
+
- strict integration-verification response contract v1, Rails task registration, failure classification, security limits, and end-to-end tests.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- version advanced to `0.9.0.pre.4` because `0.9.0.pre.3` had already been published before integration verification was added.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- legacy dependency resolution pins `parallel` to Ruby 2.2-compatible `1.19.2` and the Sidekiq 5 smoke pins `rack-protection` to Ruby 2.5-compatible `2.2.4`.
|
|
39
|
+
- the Rails verification task now always depends on `environment`, even when Rails defines that Rake task after the Chronos Railtie hook runs.
|
|
40
|
+
|
|
7
41
|
## [0.9.0.pre.3] - 2026-07-21
|
|
8
42
|
|
|
9
43
|
### Changed
|
data/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
# Chronos Ruby
|
|
2
2
|
|
|
3
|
-
Chronos Ruby
|
|
3
|
+
Chronos Ruby 1.0.0 é o agente independente de framework para enviar exceções e telemetria limitada de aplicações Ruby ao Chronos. Esta é a linha estável legado, compatível com o protocolo v1 e voltada a Ruby 2.2.10–2.6.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## O que a gem coleta
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A versão 1.0 pode coletar:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- timestamp,
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
9
|
+
- classe, mensagem, backtrace estruturado e causas encadeadas da exceção;
|
|
10
|
+
- timestamp, severidade, tags e fingerprint opcional;
|
|
11
|
+
- contexto, parâmetros, sessão e usuário fornecidos pela aplicação;
|
|
12
|
+
- versão, engine e plataforma Ruby, PID, thread opaca e hostname;
|
|
13
|
+
- ambiente, serviço, versão da aplicação, release, revision, deploy ID, região e instância;
|
|
14
|
+
- método, rota normalizada, status, duração e breakdown de requests Rack/Rails;
|
|
15
|
+
- SQL normalizado sem literais/binds e sinais heurísticos de desempenho;
|
|
16
|
+
- jobs Sidekiq/Active Job, cache, HTTP externo explicitamente instrumentado e dependências carregadas;
|
|
17
|
+
- breadcrumbs limitados fornecidos pela aplicação ou por integrações.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Veja a tabela completa em [Dados coletados](docs/data-collected.md).
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## O que não é coletado por padrão
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
A gem não varre variáveis de ambiente, sistema de arquivos ou lockfiles e não lê bodies HTTP, cookies, headers de autorização, conteúdo de e-mail, SQL bruto, binds, valores de cache ou código-fonte. O inventário de dependências contém somente nomes e versões já carregados, uma vez por agente. A aplicação continua responsável por minimização e base legal dos dados enviados.
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Versões Ruby e Rails suportadas
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
A versão 1.0.0 suporta Ruby puro e Rack em Ruby 2.2.10, 2.3.8, 2.4.10, 2.5.9 e 2.6.10. As combinações Rails validadas são Rails 4.2 com Ruby 2.2.10/2.3.8 e Rails 5.2 com Ruby 2.5.9/2.6.10. Sidekiq 4.2.10 com Ruby 2.2.10 e Sidekiq 5.2.10 com Ruby 2.5.9 também possuem gates dedicados.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Rubies e frameworks antigos estão fora do suporte de segurança de seus mantenedores. A Chronos oferece compatibilidade técnica, não manutenção de segurança do runtime. Veja [Compatibilidade](docs/compatibility.md).
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Instalação em Ruby puro
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Obrigatório: adicione a versão estável ao `Gemfile`.
|
|
34
34
|
|
|
35
35
|
```ruby
|
|
36
|
-
gem "chronos-ruby", "0.
|
|
36
|
+
gem "chronos-ruby", "~> 1.0.0"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Em runtimes antigos, use Bundler compatível:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
gem install bundler -v 1.17.3
|
|
43
43
|
bundle _1.17.3_ install
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Sem Bundler:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
gem install chronos-ruby
|
|
49
|
+
gem install chronos-ruby -v 1.0.0
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
## Rails
|
|
52
|
+
## Instalação em Rails
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Obrigatório: carregue a integração Rails explicitamente para manter Rails/ActiveSupport fora de aplicações Ruby puras.
|
|
55
55
|
|
|
56
56
|
```ruby
|
|
57
|
-
gem "chronos-ruby", "0.
|
|
57
|
+
gem "chronos-ruby", "~> 1.0.0", :require => "chronos/rails"
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
Gere o initializer:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
rails generate chronos:install
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
A Versão 0.5 introduziu Railtie, middleware e subscribers idempotentes por APIs públicas e feature detection. A coleta automática fica desativada em test e console por padrão. Veja [Rails legado](docs/modules/rails-legacy.md).
|
|
67
67
|
|
|
68
|
-
##
|
|
68
|
+
## Configuração mínima
|
|
69
69
|
|
|
70
|
-
`project_id`, `project_key
|
|
70
|
+
Obrigatório quando o agente está habilitado: `project_id`, `project_key` e `host` HTTPS. Recomendado: definir ambiente e serviço explicitamente.
|
|
71
71
|
|
|
72
72
|
```ruby
|
|
73
73
|
require "chronos"
|
|
@@ -82,22 +82,28 @@ Chronos.configure do |config|
|
|
|
82
82
|
end
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
TLS é verificado por padrão. HTTP exige `ssl_verify = false` explicitamente e deve ser limitado a endpoints locais de teste. Depois de configurar, valide credenciais e ingestão:
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
```bash
|
|
88
|
+
bundle exec rake chronos:verify_integration
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
O task envia uma exceção sintética identificada e só retorna código `0` após uma resposta v1 correlacionada. Em Ruby puro, instale o task com `require "chronos/rake_tasks"` e `Chronos::RakeTasks.install`; por código, use `Chronos.verify_integration`. Veja [Verificação da integração](docs/modules/integration-verification.md).
|
|
88
92
|
|
|
89
|
-
|
|
93
|
+
## Captura automática
|
|
94
|
+
|
|
95
|
+
Opcional em Rack: instale o middleware. Ele notifica exceções não tratadas, preserva a mesma exceção para a aplicação e não consome bodies.
|
|
90
96
|
|
|
91
97
|
```ruby
|
|
92
98
|
use Chronos::Integrations::Rack::Middleware,
|
|
93
99
|
:include_user_agent => false
|
|
94
100
|
```
|
|
95
101
|
|
|
96
|
-
|
|
102
|
+
Em Rails, o Railtie instala middleware e subscribers uma única vez. Veja [Monitoramento de requests](docs/modules/request-monitoring.md).
|
|
97
103
|
|
|
98
|
-
##
|
|
104
|
+
## Captura manual
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
Recomendado no fluxo da aplicação: captura assíncrona.
|
|
101
107
|
|
|
102
108
|
```ruby
|
|
103
109
|
begin
|
|
@@ -108,27 +114,27 @@ rescue StandardError => error
|
|
|
108
114
|
end
|
|
109
115
|
```
|
|
110
116
|
|
|
111
|
-
|
|
117
|
+
Opcional para scripts e shutdown controlado: captura síncrona.
|
|
112
118
|
|
|
113
119
|
```ruby
|
|
114
120
|
delivered = Chronos.notify_sync(RuntimeError.new("import failed"))
|
|
115
121
|
```
|
|
116
122
|
|
|
117
|
-
|
|
123
|
+
Falhas internas retornam `false` e não escapam para o fluxo principal.
|
|
118
124
|
|
|
119
|
-
##
|
|
125
|
+
## Contexto de usuário
|
|
120
126
|
|
|
121
|
-
|
|
127
|
+
Contexto de usuário é opt-in. Envie somente campos necessários e autorizados:
|
|
122
128
|
|
|
123
129
|
```ruby
|
|
124
130
|
Chronos.notify(error, :user => {"id" => "customer-42", "role" => "operator"})
|
|
125
131
|
```
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
O valor é limitado e sanitizado, mas a minimização continua sendo responsabilidade da aplicação. Veja [Contexto de execução](docs/modules/context.md).
|
|
128
134
|
|
|
129
135
|
## Breadcrumbs
|
|
130
136
|
|
|
131
|
-
Breadcrumbs
|
|
137
|
+
Breadcrumbs formam um buffer circular delimitado no escopo atual:
|
|
132
138
|
|
|
133
139
|
```ruby
|
|
134
140
|
Chronos.add_breadcrumb(
|
|
@@ -138,35 +144,25 @@ Chronos.add_breadcrumb(
|
|
|
138
144
|
)
|
|
139
145
|
```
|
|
140
146
|
|
|
141
|
-
|
|
147
|
+
A gem não transforma logs, SQL ou bodies em breadcrumbs brutos. Veja [Breadcrumbs](docs/modules/breadcrumbs.md).
|
|
142
148
|
|
|
143
|
-
##
|
|
149
|
+
## Filtros e LGPD
|
|
144
150
|
|
|
145
|
-
|
|
151
|
+
A gem bloqueia chaves sensíveis e detecta Bearer tokens, JWTs, e-mails, CPF, CNPJ e candidatos válidos a cartão. IPv4 é anonimizado por padrão. Opcionalmente, amplie a blocklist, aplique hash irreversível ou filtros próprios:
|
|
146
152
|
|
|
147
153
|
```ruby
|
|
148
154
|
Chronos.configure do |config|
|
|
149
|
-
# required options omitted
|
|
150
155
|
config.blocklist_keys += [:medical_record, /bank_account/i]
|
|
151
156
|
config.hash_keys += [:customer_id]
|
|
152
157
|
config.filters << proc { |key, value| key.to_s == "internal_reference" ? "[REMOVED]" : value }
|
|
153
158
|
end
|
|
154
159
|
```
|
|
155
160
|
|
|
156
|
-
|
|
161
|
+
Sanitização ocorre antes de fila, retry e backlog. Veja [Privacidade e LGPD](docs/privacy-lgpd.md).
|
|
157
162
|
|
|
158
163
|
## Ignore rules
|
|
159
164
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
```ruby
|
|
163
|
-
Chronos.configure do |config|
|
|
164
|
-
# required options omitted
|
|
165
|
-
config.ignored_environments = ["development", "test"]
|
|
166
|
-
end
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Version `0.9.0.pre.2` adds bounded local rules after configuration:
|
|
165
|
+
Ambientes inteiros podem ser ignorados na configuração. A versão `0.9.0.pre.2` introduziu regras locais limitadas, preservadas na API estável:
|
|
170
166
|
|
|
171
167
|
```ruby
|
|
172
168
|
Chronos.ignore_if do |notice|
|
|
@@ -174,17 +170,14 @@ Chronos.ignore_if do |notice|
|
|
|
174
170
|
end
|
|
175
171
|
```
|
|
176
172
|
|
|
177
|
-
|
|
173
|
+
A regra recebe um notice normalizado e imutável, e somente `true` descarta. Falhas do callback são contidas. Veja [Ignore rules](docs/modules/ignore-rules.md).
|
|
178
174
|
|
|
179
|
-
##
|
|
175
|
+
## Monitoramento de performance
|
|
180
176
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
SQL comments and literal values are removed before a bounded normalized query and SHA-256 fingerprint are produced. Binds are never read. Slow, repeated, possible N+1, long-transaction, connection-error, and deadlock signals are heuristic and require server-side confirmation. Group count, active trace count, fingerprints per trace, histogram buckets, and batch size all have fixed limits. See [Essential APM aggregation](docs/modules/apm-aggregation.md).
|
|
177
|
+
A Versão 0.7 introduziu agregação local de requests, queries e jobs em `metric_batch`; a Versão 0.8 adicionou HTTP externo. Grupos possuem contagem, erro, duração, histograma, status e breakdown limitados. Percentis são calculados no SaaS.
|
|
184
178
|
|
|
185
179
|
```ruby
|
|
186
180
|
Chronos.configure do |config|
|
|
187
|
-
# required connection settings omitted
|
|
188
181
|
config.apm_enabled = true
|
|
189
182
|
config.apm_max_groups = 200
|
|
190
183
|
config.apm_flush_count = 100
|
|
@@ -195,42 +188,22 @@ Chronos.configure do |config|
|
|
|
195
188
|
end
|
|
196
189
|
```
|
|
197
190
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Version `0.6.0.pre.1` adds optional Sidekiq 4/5 middleware:
|
|
191
|
+
SQL bruto e binds não são lidos. Sinais de query lenta, repetição, possível N+1, transação longa, conexão e deadlock são heurísticos. Veja [APM](docs/modules/apm-aggregation.md), [Requests](docs/modules/request-monitoring.md) e [SQL](docs/modules/sql-monitoring.md).
|
|
201
192
|
|
|
202
|
-
|
|
203
|
-
gem "sidekiq", "~> 5.0"
|
|
204
|
-
gem "chronos-ruby", "0.9.0.pre.3", :require => "chronos/sidekiq"
|
|
205
|
-
```
|
|
193
|
+
## Sidekiq e Active Job
|
|
206
194
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
When Active Job is available, the Rails integration propagates only bounded trace/request identifiers in a namespaced serialized field without changing job arguments. It records adapter, job/provider IDs, class, queue, attempts, duration, status, and error class, and captures a supplied failure once. See [Active Job legacy integration](docs/modules/active-job.md).
|
|
210
|
-
|
|
211
|
-
## External HTTP, cache, and dependencies
|
|
212
|
-
|
|
213
|
-
Version 0.8 instruments only explicitly selected `Net::HTTP` connection objects, avoiding a global monkey patch:
|
|
195
|
+
A versão `0.6.0.pre.1` introduziu middleware Sidekiq 4/5; a API estável mantém o require explícito:
|
|
214
196
|
|
|
215
197
|
```ruby
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
config.external_http_enabled = true
|
|
219
|
-
config.external_http_trace_headers = true
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
http = Net::HTTP.new("payments.example.com", 443)
|
|
223
|
-
http.use_ssl = true
|
|
224
|
-
Chronos.instrument_net_http(http)
|
|
198
|
+
gem "sidekiq", "~> 5.0"
|
|
199
|
+
gem "chronos-ruby", "~> 1.0.0", :require => "chronos/sidekiq"
|
|
225
200
|
```
|
|
226
201
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
Rails cache telemetry omits raw keys by default. Set `cache_key_mode = :sha256` to emit a project-scoped hash; `:none` is the default. Dependency reporting is enabled by default, reads at most 100 already loaded gem specs, and emits one independent `dependencies` event per agent. Set `dependency_reporting = false` to disable it. See [External HTTP](docs/modules/external-http.md), [Cache observability](docs/modules/cache-observability.md), and [Dependency inventory](docs/modules/dependencies.md).
|
|
202
|
+
O envelope de contexto não altera argumentos públicos e contém somente IDs limitados de trace/request. Active Job usa um campo serializado com namespace (`chronos_context`) e hooks públicos. Erros aninhados são deduplicados e reerguidos. Veja [Sidekiq legado](docs/modules/sidekiq-legacy.md), [Active Job](docs/modules/active-job.md) e [Jobs](docs/modules/job-monitoring.md).
|
|
230
203
|
|
|
231
204
|
## Deploy tracking
|
|
232
205
|
|
|
233
|
-
|
|
206
|
+
A Versão 0.9 introduziu deploy síncrono e correlação fixa em todos os eventos:
|
|
234
207
|
|
|
235
208
|
```ruby
|
|
236
209
|
Chronos.notify_deploy(
|
|
@@ -242,55 +215,35 @@ Chronos.notify_deploy(
|
|
|
242
215
|
)
|
|
243
216
|
```
|
|
244
217
|
|
|
245
|
-
Configure
|
|
246
|
-
|
|
247
|
-
Optional Capistrano support loads through `chronos/capistrano`. Manual, Kamal-command, and GitHub Actions examples share the explicit deploy command under `examples/deploy/`. See [Deploy tracking and release correlation](docs/modules/deploy-tracking.md).
|
|
218
|
+
Configure release/revision/deploy na inicialização de cada novo processo. A gem não lê Git ou variáveis automaticamente. Capistrano é opcional; Kamal e GitHub Actions usam exemplos em `examples/deploy/`. Veja [Deploys](docs/modules/deploys.md).
|
|
248
219
|
|
|
249
|
-
##
|
|
220
|
+
## Fila assíncrona
|
|
250
221
|
|
|
251
|
-
|
|
222
|
+
A fila tem capacidade fixa, descarta o evento mais novo quando cheia e cria workers somente após a primeira captura aceita.
|
|
252
223
|
|
|
253
224
|
```mermaid
|
|
254
225
|
flowchart LR
|
|
255
|
-
E[
|
|
256
|
-
N --> P[
|
|
257
|
-
P --> S[
|
|
258
|
-
S --> D[
|
|
259
|
-
D --> Q[
|
|
260
|
-
Q --> W[
|
|
261
|
-
W -->
|
|
262
|
-
|
|
263
|
-
R --> B[Bounded memory backlog]
|
|
226
|
+
E[Exceção ou telemetria] --> N[Normalização]
|
|
227
|
+
N --> P[Sanitização]
|
|
228
|
+
P --> S[Serialização limitada]
|
|
229
|
+
S --> D[Pipeline de entrega]
|
|
230
|
+
D --> Q[Fila limitada]
|
|
231
|
+
Q --> W[Workers fixos]
|
|
232
|
+
W --> H[Net::HTTP]
|
|
233
|
+
W --> B[Backlog em memória]
|
|
264
234
|
```
|
|
265
235
|
|
|
266
|
-
Use `Chronos.flush(timeout)`
|
|
267
|
-
|
|
268
|
-
## Retry and backlog
|
|
269
|
-
|
|
270
|
-
The resilience layer introduced in version 0.3 retries network errors, HTTP `408`, `429`, and `5xx` responses with exponential backoff, bounded jitter, and a finite attempt count. Other `4xx` responses are permanent and are not retried. A circuit breaker pauses requests after repeated failures, preventing retry storms.
|
|
271
|
-
|
|
272
|
-
After retries are exhausted, the already sanitized `SerializedEvent` may enter a fixed-capacity memory backlog. The backlog drops new items when full, is lost when the process exits, and never writes to disk. A later successful half-open probe drains backlog items as new events arrive.
|
|
273
|
-
|
|
274
|
-
The SaaS may return a JSON policy in the bounded `X-Chronos-Remote-Configuration` response header. Only sampling rate, enabled event types, a lower payload limit, exact ignored fingerprints, send interval, and kill switch are accepted. Remote values cannot change the host, project credentials, TLS, local maximums, code, or regular expressions. See [Retry and backlog](docs/modules/retry-backlog.md) and [Remote configuration](docs/modules/remote-configuration.md).
|
|
275
|
-
|
|
276
|
-
## How it works internally
|
|
236
|
+
Use `Chronos.flush(timeout)` antes de encerrar e `Chronos.close(timeout)` no shutdown. Workers são recriados após fork. Veja [Fila assíncrona](docs/modules/async-queue.md).
|
|
277
237
|
|
|
278
|
-
|
|
238
|
+
## Retry e backlog
|
|
279
239
|
|
|
280
|
-
|
|
281
|
-
- `Chronos::Application` coordinates capture;
|
|
282
|
-
- `Chronos::Application::DeliveryPipeline` owns bounded retry and remote policy;
|
|
283
|
-
- `Chronos::Ports` defines delivery behavior;
|
|
284
|
-
- `Chronos::Adapters` implements Net::HTTP delivery and thread-local context;
|
|
285
|
-
- `Chronos::Integrations::Rack` implements optional automatic Rack capture;
|
|
286
|
-
- `Chronos::Rails` implements the optional Railtie, installer, generator, and public-notification adapters;
|
|
287
|
-
- `Chronos::Internal` owns bounded queueing, workers, and defensive logging.
|
|
240
|
+
Retry cobre erros de rede, HTTP `408`, `429` e `5xx`, com backoff exponencial, jitter e tentativas limitadas. Outros `4xx` são permanentes. Circuit breaker reduz tempestades de retry.
|
|
288
241
|
|
|
289
|
-
|
|
242
|
+
O backlog guarda somente eventos já sanitizados/serializados, possui capacidade fixa, vive em memória e é perdido no encerramento. Configuração remota aceita apenas sampling, tipos habilitados, limite menor de payload, fingerprints exatas, intervalo e kill switch; nunca altera host, credenciais, TLS ou executa código. Veja [Retry e backlog](docs/modules/retry-backlog.md), [Sampling](docs/modules/sampling.md) e [Configuração remota](docs/modules/remote-configuration.md).
|
|
290
243
|
|
|
291
|
-
##
|
|
244
|
+
## Configuração por ambiente
|
|
292
245
|
|
|
293
|
-
|
|
246
|
+
A gem não varre o ambiente. Leia somente variáveis escolhidas pela aplicação:
|
|
294
247
|
|
|
295
248
|
```ruby
|
|
296
249
|
Chronos.configure do |config|
|
|
@@ -301,102 +254,69 @@ Chronos.configure do |config|
|
|
|
301
254
|
config.enabled = ENV["CHRONOS_ENABLED"] != "false"
|
|
302
255
|
config.queue_size = 100
|
|
303
256
|
config.workers = 1
|
|
304
|
-
config.timeout = 5.0
|
|
305
|
-
config.open_timeout = 2.0
|
|
306
257
|
config.max_retries = 3
|
|
307
|
-
config.retry_base_interval = 0.5
|
|
308
|
-
config.retry_max_interval = 30.0
|
|
309
|
-
config.retry_jitter = 0.25
|
|
310
258
|
config.backlog_size = 100
|
|
311
|
-
config.circuit_failure_threshold = 5
|
|
312
|
-
config.circuit_reset_timeout = 30.0
|
|
313
259
|
config.remote_configuration = true
|
|
314
|
-
config.context_store = :thread_local
|
|
315
|
-
config.breadcrumb_capacity = 20
|
|
316
|
-
config.breadcrumb_max_bytes = 2048
|
|
317
260
|
config.apm_enabled = true
|
|
318
|
-
config.apm_max_groups = 200
|
|
319
|
-
config.apm_flush_count = 100
|
|
320
261
|
config.external_http_enabled = false
|
|
321
262
|
config.cache_key_mode = :none
|
|
322
263
|
config.dependency_reporting = true
|
|
323
264
|
config.app_version = ENV["APP_VERSION"]
|
|
324
265
|
config.revision = ENV["GIT_SHA"]
|
|
325
266
|
config.deploy_id = ENV["DEPLOY_ID"]
|
|
326
|
-
config.region = ENV["REGION"]
|
|
327
|
-
config.instance_id = ENV["INSTANCE_ID"]
|
|
328
267
|
end
|
|
329
268
|
```
|
|
330
269
|
|
|
331
|
-
|
|
270
|
+
Todas as opções, defaults e limites estão em [Configuração](docs/configuration.md).
|
|
332
271
|
|
|
333
272
|
## Troubleshooting
|
|
334
273
|
|
|
335
|
-
|
|
274
|
+
Erros de configuração são levantados durante `Chronos.configure`; falhas de captura/entrega são contidas e podem ir ao logger seguro. Confirme TLS, credenciais, timeouts e retorno de `flush`. Consulte [Troubleshooting](docs/troubleshooting.md).
|
|
336
275
|
|
|
337
276
|
## Benchmark
|
|
338
277
|
|
|
339
|
-
|
|
278
|
+
O gate estável executa comparação Rack repetível e carga contra endpoint fake:
|
|
340
279
|
|
|
341
280
|
```bash
|
|
342
|
-
bundle _1.17.3_ exec ruby benchmarks/
|
|
343
|
-
bundle _1.17.3_ exec ruby benchmarks/
|
|
344
|
-
bundle _1.17.3_ exec ruby benchmarks/filtering.rb
|
|
345
|
-
bundle _1.17.3_ exec ruby benchmarks/queue.rb
|
|
346
|
-
bundle _1.17.3_ exec ruby benchmarks/retry_backlog.rb
|
|
347
|
-
bundle _1.17.3_ exec ruby benchmarks/request_overhead.rb
|
|
348
|
-
bundle _1.17.3_ exec ruby benchmarks/rails_notifications.rb
|
|
349
|
-
bundle _1.17.3_ exec ruby benchmarks/sidekiq_middleware.rb
|
|
350
|
-
bundle _1.17.3_ exec ruby benchmarks/apm_aggregation.rb
|
|
351
|
-
bundle _1.17.3_ exec ruby benchmarks/external_http.rb
|
|
352
|
-
bundle _1.17.3_ exec ruby benchmarks/correlation.rb
|
|
281
|
+
ITERATIONS=50000 WARMUP=5000 SAMPLES=7 bundle _1.17.3_ exec ruby benchmarks/comparative.rb
|
|
282
|
+
ITERATIONS=500 bundle _1.17.3_ exec ruby benchmarks/fake_endpoint_load.rb
|
|
353
283
|
```
|
|
354
284
|
|
|
355
|
-
|
|
285
|
+
Resultados dependem de runtime e hardware. Não há alegação genérica de superioridade; registre CPU, SO, Ruby, commit, warmup, amostras, mediana e dispersão. Outros benchmarks ficam em `benchmarks/` e estão descritos em [Performance](docs/performance.md).
|
|
356
286
|
|
|
357
|
-
##
|
|
287
|
+
## Migração do Airbrake
|
|
358
288
|
|
|
359
|
-
|
|
289
|
+
Migre por etapas e mantenha os dois agentes juntos somente durante a validação, evitando duplicidade prolongada. Callbacks e notices não são API-compatíveis e devem ser traduzidos/testados explicitamente. Consulte o [guia de migração do Airbrake](docs/migration-from-airbrake.md).
|
|
360
290
|
|
|
361
|
-
##
|
|
291
|
+
## Desenvolvimento local
|
|
362
292
|
|
|
363
|
-
|
|
293
|
+
Instale Bundler 1.17.3 e as dependências:
|
|
364
294
|
|
|
365
295
|
```bash
|
|
366
296
|
gem install bundler -v 1.17.3
|
|
367
297
|
bin/setup
|
|
368
298
|
```
|
|
369
299
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
bin/console
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
Install the current source locally:
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
bundle _1.17.3_ exec rake install
|
|
380
|
-
```
|
|
300
|
+
Use `bin/console` para inspeção e `bundle _1.17.3_ exec rake install` para instalar a fonte localmente. A arquitetura hexagonal está descrita em [Arquitetura](docs/architecture.md).
|
|
381
301
|
|
|
382
|
-
##
|
|
302
|
+
## Testes
|
|
383
303
|
|
|
384
|
-
|
|
304
|
+
Execute suíte e lint no runtime atual:
|
|
385
305
|
|
|
386
306
|
```bash
|
|
387
307
|
bundle _1.17.3_ exec rake
|
|
388
308
|
```
|
|
389
309
|
|
|
390
|
-
|
|
310
|
+
A matriz CI cobre Ruby 2.2.10–2.6.10, aplicações Rails 4.2/5.2 e Sidekiq 4/5. O workflow de release repete toda a matriz, documentação, benchmark comparativo e carga antes de publicar.
|
|
391
311
|
|
|
392
|
-
##
|
|
312
|
+
## Contribuição
|
|
393
313
|
|
|
394
|
-
|
|
314
|
+
Abra uma issue antes de adicionar API pública ou dependência. Classes públicas precisam de YARD, testes, documentação de módulo e evidência de compatibilidade. Veja [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
395
315
|
|
|
396
|
-
##
|
|
316
|
+
## Segurança
|
|
397
317
|
|
|
398
|
-
|
|
318
|
+
Nunca inclua credenciais no contexto. Releases usam Trusted Publishing, checksum SHA-256 e SBOM; dependências passam por auditoria. Reporte vulnerabilidades pelo canal privado de [SECURITY.md](SECURITY.md).
|
|
399
319
|
|
|
400
|
-
##
|
|
320
|
+
## Licença
|
|
401
321
|
|
|
402
|
-
Chronos Ruby
|
|
322
|
+
Chronos Ruby é distribuída sob a licença MIT. Veja [LICENSE.txt](LICENSE.txt).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://chronos.example/schemas/integration-verification-response-v1.schema.json",
|
|
4
|
+
"title": "Chronos integration verification response v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"success",
|
|
10
|
+
"status",
|
|
11
|
+
"verification_id",
|
|
12
|
+
"credentials_valid",
|
|
13
|
+
"event_received",
|
|
14
|
+
"event",
|
|
15
|
+
"project",
|
|
16
|
+
"receiver",
|
|
17
|
+
"error"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"schema_version": {"const": "1.0"},
|
|
21
|
+
"success": {"type": "boolean"},
|
|
22
|
+
"status": {
|
|
23
|
+
"enum": [
|
|
24
|
+
"accepted",
|
|
25
|
+
"invalid_credentials",
|
|
26
|
+
"project_inactive",
|
|
27
|
+
"receiver_unavailable",
|
|
28
|
+
"receiver_internal_error",
|
|
29
|
+
"request_rejected",
|
|
30
|
+
"rate_limited"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"verification_id": {"type": "string", "minLength": 1, "maxLength": 128},
|
|
34
|
+
"credentials_valid": {"type": ["boolean", "null"]},
|
|
35
|
+
"event_received": {"type": "boolean"},
|
|
36
|
+
"event": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["id"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"id": {"type": ["string", "null"], "maxLength": 128}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"project": {
|
|
45
|
+
"type": ["object", "null"],
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["id", "name", "status", "environment"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"id": {"type": ["string", "null"], "maxLength": 128},
|
|
50
|
+
"name": {"type": ["string", "null"], "maxLength": 128},
|
|
51
|
+
"status": {"type": ["string", "null"], "maxLength": 32},
|
|
52
|
+
"environment": {"type": ["string", "null"], "maxLength": 128}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"receiver": {
|
|
56
|
+
"type": ["object", "null"],
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": ["name", "status", "received_at"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"name": {"type": ["string", "null"], "maxLength": 64},
|
|
61
|
+
"status": {"type": ["string", "null"], "maxLength": 32},
|
|
62
|
+
"received_at": {"type": ["string", "null"], "maxLength": 64}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"error": {
|
|
66
|
+
"type": ["object", "null"],
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"required": ["code", "message", "guidance"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"code": {"type": "string", "maxLength": 64},
|
|
71
|
+
"message": {"type": "string", "maxLength": 512},
|
|
72
|
+
"guidance": {"type": "string", "maxLength": 512}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|