chronos-ruby 0.9.0.pre.4 → 1.1.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +108 -197
  4. data/contracts/apm-batch-v1.schema.json +51 -1
  5. data/docs/adr/ADR-007-feature-detection.md +25 -0
  6. data/docs/adr/ADR-008-context-store.md +25 -0
  7. data/docs/adr/ADR-009-sampling.md +25 -0
  8. data/docs/adr/ADR-010-opentelemetry-interoperability.md +25 -0
  9. data/docs/adr/ADR-015-bounded-apm-aggregation.md +3 -3
  10. data/docs/adr/ADR-018-pre-1.0-hardening.md +6 -2
  11. data/docs/adr/ADR-019-bounded-query-diagnostics.md +44 -0
  12. data/docs/architecture.md +5 -2
  13. data/docs/compatibility.md +30 -23
  14. data/docs/configuration.md +21 -0
  15. data/docs/data-collected.md +9 -3
  16. data/docs/deprecation-policy.md +1 -1
  17. data/docs/examples/plain-ruby.md +6 -0
  18. data/docs/migration-from-airbrake.md +1 -1
  19. data/docs/modules/apm-aggregation.md +18 -5
  20. data/docs/modules/breadcrumbs.md +23 -0
  21. data/docs/modules/context.md +21 -0
  22. data/docs/modules/deploys.md +23 -0
  23. data/docs/modules/job-monitoring.md +22 -0
  24. data/docs/modules/request-monitoring.md +20 -0
  25. data/docs/modules/runtime-metrics.md +22 -0
  26. data/docs/modules/sampling.md +22 -0
  27. data/docs/modules/sidekiq-legacy.md +1 -1
  28. data/docs/modules/sql-monitoring.md +76 -0
  29. data/docs/modules/telemetry-events.md +1 -1
  30. data/docs/performance.md +30 -3
  31. data/docs/privacy-lgpd.md +6 -3
  32. data/docs/protocol-v1.md +2 -2
  33. data/docs/release-1.0-readiness.md +17 -15
  34. data/docs/release-1.1-readiness.md +51 -0
  35. data/docs/security-review.md +7 -3
  36. data/docs/troubleshooting.md +6 -0
  37. data/lib/chronos/agent.rb +12 -2
  38. data/lib/chronos/application/apm_aggregator.rb +179 -29
  39. data/lib/chronos/configuration/apm_validation.rb +51 -1
  40. data/lib/chronos/configuration.rb +17 -1
  41. data/lib/chronos/core/metric_aggregate.rb +69 -7
  42. data/lib/chronos/core/sql_query_analyzer.rb +309 -0
  43. data/lib/chronos/ports/query_inspector.rb +23 -0
  44. data/lib/chronos/rails/active_record_query_inspector.rb +235 -0
  45. data/lib/chronos/rails/notifications_subscriber.rb +163 -2
  46. data/lib/chronos/rails.rb +1 -0
  47. data/lib/chronos/version.rb +1 -1
  48. data/lib/chronos.rb +2 -0
  49. metadata +21 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84266b3c93fc92c15268d44e3625762f471c9cf99fa0523b6f5d883f846906e4
4
- data.tar.gz: bf3d2c641bbb7f117a1c9c76519fa756057f72108d899cb64d86e2eeff305423
3
+ metadata.gz: 0127def72275a2d4c08314040c04e34a9606fed13982d84b06c465dee7be4cf6
4
+ data.tar.gz: 99f272314517e6a525223ce86964b70fcdfce717eb0e434b9c77e275031913b7
5
5
  SHA512:
6
- metadata.gz: 9b54a3aef38f706677794b39740558586d9c69f083a3c2b3f2dc6ea20e3b60f2fe84765eb61a44fe2f230a03c03dcb27047cdd7a1853b14fc805fcb914d7cfb8
7
- data.tar.gz: 2f915f461e658f93269d35e52f6d728ff32ef90a4a6ac765a6b92194a1fc53b06ca5350b2bc34c8d84197bf2263d523ead9a62ada46edbd9ae46363d3de27e05
6
+ metadata.gz: 93b37af1a5b51284a6c6de1c19e12de18ac23b04bfa4a04f33b7fce5cb611ec6f940d4ec2508c8a2b8d72f91e9a2a9a812a3b48d72f60dfefd642fb7cf3fe138
7
+ data.tar.gz: 4c653acb6d7aa90d534a7d496568fca64fb9ba9bce9039c6ca68fad71c1b5aef3f4e5de541a3f3d0f6064f08653359bcc2afc30e3a2d82c910942f0c1e103d4a
data/CHANGELOG.md CHANGED
@@ -4,6 +4,42 @@ All notable changes are documented here. The project follows Semantic Versioning
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.1.0] - 2026-08-05
8
+
9
+ ### Added
10
+
11
+ - bounded normalized SELECT analysis with access columns, index candidates, existing-index comparison, optional table statistics, and allowlisted non-executing query plans;
12
+ - structured query diagnostics and severity counts for errors, warnings, information, and suggestions, including actionable N+1 and index guidance;
13
+ - approximate p50/p95/p99 metrics, complete outer-transaction timing, expanded adapter error families, and trace/fingerprint loss counters;
14
+ - explicit low-risk defaults and bounded opt-in configuration for database index/statistics/plan inspection.
15
+
16
+ ### Changed
17
+
18
+ - aggregate drains preserve active trace trackers until request completion or idle TTL instead of discarding incomplete correlation;
19
+ - possible N+1 now requires a non-cached SELECT, and query analysis sent to consumers prefers inspected evidence over an earlier static-only observation.
20
+
21
+ ### Security
22
+
23
+ - query inspection never uses `EXPLAIN ANALYZE`, never executes DDL, omits raw SQL/binds/predicates/messages, and retains only bounded schema and planner fields.
24
+
25
+ ## [1.0.0] - 2026-07-29
26
+
27
+ ### Added
28
+
29
+ - 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;
30
+ - the remaining mandatory module documents and ADRs for feature detection, context storage, sampling, and future OpenTelemetry interoperability.
31
+
32
+ ### Changed
33
+
34
+ - promoted the reviewed public API and protocol v1 implementation from `0.9.0.pre.4` to `1.0.0`;
35
+ - release publishing now accepts `v1.*` tags and cannot publish until every legacy compatibility and release-readiness job succeeds;
36
+ - compatibility status is now `Supported` only for the exact runtime/framework combinations covered by green release gates.
37
+
38
+ ### Security
39
+
40
+ - stable artifacts continue to use RubyGems Trusted Publishing, SHA-256 checksums, SPDX SBOMs, strict payload privacy contracts, and dependency auditing;
41
+ - package signing remains deferred until a trusted signing-key lifecycle is available.
42
+
7
43
  ## [0.9.0.pre.4] - 2026-07-22
8
44
 
9
45
  ### Added
data/README.md CHANGED
@@ -1,73 +1,73 @@
1
1
  # Chronos Ruby
2
2
 
3
- Chronos Ruby is the framework-independent client for sending Ruby application errors and bounded telemetry to Chronos. Version 0.9 adds synchronous deploy tracking and bounded release correlation across every event.
3
+ Chronos Ruby 1.1.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
- ## What the gem collects
5
+ ## O que a gem coleta
6
6
 
7
- Version 0.9 can collect:
7
+ A versão 1.1 pode coletar:
8
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
- - Rack method, normalized route, status, duration, request ID, host, query-free path, optional user agent, controller/action, response size, trace ID, and already-parsed parameters when the middleware is used;
15
- - bounded breadcrumbs explicitly supplied by the application or integration.
16
- - release, revision, deploy ID, environment, service, region, and instance correlation;
17
- - explicit bounded deployment metadata supplied through the public API or integration.
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
- See [Data collected](docs/data-collected.md) for the complete field table.
19
+ Veja a tabela completa em [Dados coletados](docs/data-collected.md).
20
20
 
21
- ## What is not collected by default
21
+ ## O que não é coletado por padrão
22
22
 
23
- Chronos Ruby does not inspect environment variables, request/response bodies, cookies, Authorization headers, source code, database contents, lockfiles, or gem paths. Dependency reporting reads only already loaded gem names and versions once per agent. Application-supplied fields are recursively sanitized, but applications should still avoid sending unnecessary personal, health, financial, or authentication data.
23
+ A gem não varre variáveis de ambiente, sistema de arquivos ou lockfiles e não coleta bodies HTTP, cookies, headers de autorização, conteúdo de e-mail, SQL bruto, binds, valores de cache ou código-fonte. A inspeção de plano, desativada por padrão, usa o SQL original somente na conexão local para `EXPLAIN` sem `ANALYZE` e o descarta. 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
- ## Supported Ruby and Rails versions
25
+ ## Versões Ruby e Rails suportadas
26
26
 
27
- Version 0.x targets Ruby 2.2.10 through Ruby 2.6. Version 0.5 provides best-effort Rails 4.2 through 5.2 integration through public framework APIs and feature detection. All supported combinations must pass dedicated CI before being listed as supported.
27
+ A versão 1.1.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. Ruby 2.7/Rails 6 não é declarado nesta release porque ainda não possui aplicação e matriz completas.
28
28
 
29
- See [Compatibility](docs/compatibility.md).
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
- ## Plain Ruby installation
31
+ ## Instalação em Ruby puro
32
32
 
33
- The current public build is a pre-release. Add its exact version to the application's `Gemfile`:
33
+ Obrigatório: adicione a versão estável ao `Gemfile`.
34
34
 
35
35
  ```ruby
36
- gem "chronos-ruby", "0.9.0.pre.4"
36
+ gem "chronos-ruby", "~> 1.1.0"
37
37
  ```
38
38
 
39
- Install with a Bundler version compatible with the application. For the oldest supported runtime:
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
- Without Bundler:
46
+ Sem Bundler:
47
47
 
48
48
  ```bash
49
- gem install chronos-ruby --pre
49
+ gem install chronos-ruby -v 1.1.0
50
50
  ```
51
51
 
52
- ## Rails installation
52
+ ## Instalação em Rails
53
53
 
54
- Version 0.5 exposes Rails support explicitly, keeping Rails and ActiveSupport out of plain Ruby applications:
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.9.0.pre.4", :require => "chronos/rails"
57
+ gem "chronos-ruby", "~> 1.1.0", :require => "chronos/rails"
58
58
  ```
59
59
 
60
- Generate the initializer with:
60
+ Gere o initializer:
61
61
 
62
62
  ```bash
63
63
  rails generate chronos:install
64
64
  ```
65
65
 
66
- The Railtie installs the Rack middleware and notification subscribers idempotently. Automatic integration is disabled in test and console by default and can be controlled with `rails_enabled`, `rails_capture_in_test`, `rails_capture_in_console`, and `rails_capture_user_agent`. See [Rails 4.2 and 5.2 integration](docs/modules/rails-legacy.md).
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
- ## Minimum configuration
68
+ ## Configuração mínima
69
69
 
70
- `project_id`, `project_key`, and an HTTPS `host` are required while the agent is enabled:
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,43 +82,28 @@ Chronos.configure do |config|
82
82
  end
83
83
  ```
84
84
 
85
- HTTPS verification is enabled by default. HTTP requires explicitly setting `ssl_verify = false` and should only be used with a local test server.
86
-
87
- ## Verify the Chronos integration
88
-
89
- After configuring the application, Rails projects can verify credentials and end-to-end ingestion with:
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:
90
86
 
91
87
  ```bash
92
88
  bundle exec rake chronos:verify_integration
93
89
  ```
94
90
 
95
- The task sends one synthetic exception identified as an integration verification and prints one JSON object. It exits with status `0` only when Chronos confirms valid credentials and receipt of the correlated event; configuration, authentication, inactive-project, network, protocol, rate-limit, and receiver failures exit nonzero with safe guidance.
96
-
97
- Plain Ruby Rakefiles can install the same task explicitly after loading their configuration:
91
+ O task envia uma exceção sintética identificada e 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).
98
92
 
99
- ```ruby
100
- require "chronos"
101
- # Chronos.configure { |config| ... }
102
- require "chronos/rake_tasks"
103
- Chronos::RakeTasks.install
104
- ```
93
+ ## Captura automática
105
94
 
106
- Ruby code may call `result = Chronos.verify_integration`, inspect `result.success?`, and serialize `result.to_h` or `result.to_json`. The result contains only bounded contract fields; it never exposes `project_key`, raw server responses, stack traces, source paths, or receiver internals. See [Integration verification](docs/modules/integration-verification.md).
107
-
108
- ## Automatic capture
109
-
110
- Rack applications can capture unhandled exceptions automatically and preserve the application error semantics:
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.
111
96
 
112
97
  ```ruby
113
98
  use Chronos::Integrations::Rack::Middleware,
114
99
  :include_user_agent => false
115
100
  ```
116
101
 
117
- The middleware notifies asynchronously and re-raises the same exception. It never reads the request body, raw query string, cookies, authorization headers, or response body. See [Rack integration and context](docs/modules/rack-context.md).
102
+ Em Rails, o Railtie instala middleware e subscribers uma única vez. Veja [Monitoramento de requests](docs/modules/request-monitoring.md).
118
103
 
119
- ## Manual capture
104
+ ## Captura manual
120
105
 
121
- Asynchronous capture is recommended for application code:
106
+ Recomendado no fluxo da aplicação: captura assíncrona.
122
107
 
123
108
  ```ruby
124
109
  begin
@@ -129,27 +114,27 @@ rescue StandardError => error
129
114
  end
130
115
  ```
131
116
 
132
- Synchronous capture waits for the HTTP result and is useful in scripts or controlled shutdown paths:
117
+ Opcional para scripts e shutdown controlado: captura síncrona.
133
118
 
134
119
  ```ruby
135
120
  delivered = Chronos.notify_sync(RuntimeError.new("import failed"))
136
121
  ```
137
122
 
138
- Both methods return `false` instead of allowing an internal agent error to escape.
123
+ Falhas internas retornam `false` e não escapam para o fluxo principal.
139
124
 
140
- ## User context
125
+ ## Contexto de usuário
141
126
 
142
- User data is opt-in and must contain only values your application is allowed to send:
127
+ Contexto de usuário é opt-in. Envie somente campos necessários e autorizados:
143
128
 
144
129
  ```ruby
145
130
  Chronos.notify(error, :user => {"id" => "customer-42", "role" => "operator"})
146
131
  ```
147
132
 
148
- Version 0.4 sanitizes this context before delivery and before it can enter retry storage. Data minimization remains the application's responsibility.
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).
149
134
 
150
135
  ## Breadcrumbs
151
136
 
152
- Breadcrumbs use a fixed circular buffer scoped to the current execution:
137
+ Breadcrumbs formam um buffer circular delimitado no escopo atual:
153
138
 
154
139
  ```ruby
155
140
  Chronos.add_breadcrumb(
@@ -159,35 +144,25 @@ Chronos.add_breadcrumb(
159
144
  )
160
145
  ```
161
146
 
162
- No log, SQL, HTTP, cache, job, request body, or response body payload is collected automatically. Unknown categories become `custom`, and metadata is bounded and sanitized before queueing.
147
+ A gem não transforma logs, SQL ou bodies em breadcrumbs brutos. Veja [Breadcrumbs](docs/modules/breadcrumbs.md).
163
148
 
164
- ## Filters and LGPD
149
+ ## Filtros e LGPD
165
150
 
166
- Version 0.4 recursively redacts sensitive keys and detects Bearer tokens, JWTs, e-mail addresses, CPF, CNPJ, and valid payment-card candidates in free text. IPv4 addresses are anonymized by default. Applications can add blocklist matchers, hash selected identifiers, or install custom filters:
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:
167
152
 
168
153
  ```ruby
169
154
  Chronos.configure do |config|
170
- # required options omitted
171
155
  config.blocklist_keys += [:medical_record, /bank_account/i]
172
156
  config.hash_keys += [:customer_id]
173
157
  config.filters << proc { |key, value| key.to_s == "internal_reference" ? "[REMOVED]" : value }
174
158
  end
175
159
  ```
176
160
 
177
- Sanitization runs before queueing and transport. See [Privacy and LGPD](docs/privacy-lgpd.md) for behavior, limitations, health and financial examples, and a payload audit procedure.
161
+ Sanitização ocorre antes de fila, retry e backlog. Veja [Privacidade e LGPD](docs/privacy-lgpd.md).
178
162
 
179
163
  ## Ignore rules
180
164
 
181
- Entire environments can be ignored:
182
-
183
- ```ruby
184
- Chronos.configure do |config|
185
- # required options omitted
186
- config.ignored_environments = ["development", "test"]
187
- end
188
- ```
189
-
190
- 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:
191
166
 
192
167
  ```ruby
193
168
  Chronos.ignore_if do |notice|
@@ -195,17 +170,14 @@ Chronos.ignore_if do |notice|
195
170
  end
196
171
  ```
197
172
 
198
- Rules receive an immutable normalized notice, run before serialization/queueing, and must return exactly `true` to discard. The default limit is 20 and the hard configurable maximum is 100. A failing rule is contained. See [Bounded local ignore rules](docs/modules/ignore-rules.md).
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).
199
174
 
200
- ## Performance monitoring
175
+ ## Monitoramento de performance
201
176
 
202
- Version 0.7 aggregates request, query, and job observations into bounded `metric_batch` events. Groups include count, error count/rate, total/min/max/average duration, fixed histogram buckets, status counts, and component breakdown. Percentiles are calculated in the SaaS without retaining every local duration.
203
-
204
- 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, percentis aproximados, severidades, diagnósticos, status e breakdown limitados.
205
178
 
206
179
  ```ruby
207
180
  Chronos.configure do |config|
208
- # required connection settings omitted
209
181
  config.apm_enabled = true
210
182
  config.apm_max_groups = 200
211
183
  config.apm_flush_count = 100
@@ -213,45 +185,37 @@ Chronos.configure do |config|
213
185
  config.apm_max_queries_per_request = 100
214
186
  config.apm_slow_query_threshold_ms = 500.0
215
187
  config.apm_n_plus_one_threshold = 5
188
+ config.apm_trace_ttl_seconds = 60.0
189
+ config.apm_query_analysis_enabled = true
190
+ config.apm_query_analysis_max_queries = 100
191
+
192
+ # Opt-in: cada fingerprint elegível pode consultar catálogo/estatística/plano.
193
+ config.apm_query_inspection_enabled = false
194
+ config.apm_query_statistics_enabled = false
195
+ config.apm_query_plan_enabled = false
196
+ config.apm_query_inspection_min_duration_ms = 500.0
197
+ config.apm_query_inspection_max_queries = 20
198
+ config.apm_transaction_tracking_enabled = true
199
+ config.apm_transaction_max_connections = 100
216
200
  end
217
201
  ```
218
202
 
219
- ## Sidekiq and Active Job
220
-
221
- Version `0.6.0.pre.1` adds optional Sidekiq 4/5 middleware:
222
-
223
- ```ruby
224
- gem "sidekiq", "~> 5.0"
225
- gem "chronos-ruby", "0.9.0.pre.4", :require => "chronos/sidekiq"
226
- ```
227
-
228
- The client middleware propagates only trace/request identifiers in a versioned Sidekiq-envelope field and never changes worker arguments. The server records class, queue, JID, retry count, duration, calculable queue latency, bounded arguments/tags, status, and error class. Values pass through the shared sanitizer before delivery. Failed jobs are notified once and the original exception is re-raised. See [Sidekiq 4/5 legacy integration](docs/modules/sidekiq-legacy.md).
203
+ Por padrão, SQL bruto e binds não são lidos pelo pipeline de análise. A inspeção opt-in usa o SQL original apenas localmente para solicitar `EXPLAIN` sem `ANALYZE`; nunca o inclui no evento. A análise estática produz candidatos, não ordens de criação de índice. Erros usam severidade `error`; lentidão e risco usam `warning`; padrões observados usam `info`; correções propostas usam `suggestion`. Veja [APM](docs/modules/apm-aggregation.md), [Requests](docs/modules/request-monitoring.md) e [SQL](docs/modules/sql-monitoring.md).
229
204
 
230
- 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).
205
+ ## Sidekiq e Active Job
231
206
 
232
- ## External HTTP, cache, and dependencies
233
-
234
- Version 0.8 instruments only explicitly selected `Net::HTTP` connection objects, avoiding a global monkey patch:
207
+ A versão `0.6.0.pre.1` introduziu middleware Sidekiq 4/5; a API estável mantém o require explícito:
235
208
 
236
209
  ```ruby
237
- Chronos.configure do |config|
238
- # required connection settings omitted
239
- config.external_http_enabled = true
240
- config.external_http_trace_headers = true
241
- end
242
-
243
- http = Net::HTTP.new("payments.example.com", 443)
244
- http.use_ssl = true
245
- Chronos.instrument_net_http(http)
210
+ gem "sidekiq", "~> 5.0"
211
+ gem "chronos-ruby", "~> 1.1.0", :require => "chronos/sidekiq"
246
212
  ```
247
213
 
248
- The wrapper records only sanitized host, method, status, duration, timeout, connection-error flag, and error class. It propagates `X-Chronos-Trace-ID` and `X-Chronos-Request-ID` when available and never reads URL path/query, Authorization, request body, response body, or error message.
249
-
250
- 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).
214
+ 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).
251
215
 
252
216
  ## Deploy tracking
253
217
 
254
- Version 0.9 sends deployment metadata synchronously and adds a bounded correlation block to every event:
218
+ A Versão 0.9 introduziu deploy síncrono e correlação fixa em todos os eventos:
255
219
 
256
220
  ```ruby
257
221
  Chronos.notify_deploy(
@@ -263,55 +227,35 @@ Chronos.notify_deploy(
263
227
  )
264
228
  ```
265
229
 
266
- Configure `app_version`, `revision`, `deploy_id`, `environment`, `service_name`, `region`, and `instance_id` in each newly deployed process so subsequent telemetry carries the same release identity. The gem never scans environment variables or Git automatically.
230
+ Configure release/revision/deploy na inicialização de cada novo processo. A gem não Git ou variáveis automaticamente. Capistrano é opcional; Kamal e GitHub Actions usam exemplos em `examples/deploy/`. Veja [Deploys](docs/modules/deploys.md).
267
231
 
268
- 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).
232
+ ## Fila assíncrona
269
233
 
270
- ## Asynchronous queue
271
-
272
- 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.
234
+ A fila tem capacidade fixa, descarta o evento mais novo quando cheia e cria workers somente após a primeira captura aceita.
273
235
 
274
236
  ```mermaid
275
237
  flowchart LR
276
- E[Exception] --> N[Notice builder]
277
- N --> P[Privacy sanitizer]
278
- P --> S[Safe bounded serializer]
279
- S --> D[Delivery pipeline]
280
- D --> Q[Bounded queue]
281
- Q --> W[Fixed worker pool]
282
- W --> R[Retry and circuit breaker]
283
- R --> H[Net::HTTP transport]
284
- R --> B[Bounded memory backlog]
238
+ E[Exceção ou telemetria] --> N[Normalização]
239
+ N --> P[Sanitização]
240
+ P --> S[Serialização limitada]
241
+ S --> D[Pipeline de entrega]
242
+ D --> Q[Fila limitada]
243
+ Q --> W[Workers fixos]
244
+ W --> H[Net::HTTP]
245
+ W --> B[Backlog em memória]
285
246
  ```
286
247
 
287
- Use `Chronos.flush(timeout)` to wait for accepted events and `Chronos.close(timeout)` during shutdown. Workers are recreated after a process fork.
288
-
289
- ## Retry and backlog
290
-
291
- 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.
292
-
293
- 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.
294
-
295
- 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).
248
+ 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).
296
249
 
297
- ## How it works internally
250
+ ## Retry e backlog
298
251
 
299
- The code follows hexagonal boundaries:
252
+ 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.
300
253
 
301
- - `Chronos::Core` contains immutable notices, sanitization, and safe normalization;
302
- - `Chronos::Application` coordinates capture;
303
- - `Chronos::Application::DeliveryPipeline` owns bounded retry and remote policy;
304
- - `Chronos::Ports` defines delivery behavior;
305
- - `Chronos::Adapters` implements Net::HTTP delivery and thread-local context;
306
- - `Chronos::Integrations::Rack` implements optional automatic Rack capture;
307
- - `Chronos::Rails` implements the optional Railtie, installer, generator, and public-notification adapters;
308
- - `Chronos::Internal` owns bounded queueing, workers, and defensive logging.
254
+ 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).
309
255
 
310
- The core has no dependency on Rails, Rack, Sidekiq, or ActiveSupport. See [Architecture](docs/architecture.md).
256
+ ## Configuração por ambiente
311
257
 
312
- ## Environment-specific configuration
313
-
314
- Configuration values are explicit; the gem never scans the process environment. Read only the variables your application chooses:
258
+ A gem não varre o ambiente. Leia somente variáveis escolhidas pela aplicação:
315
259
 
316
260
  ```ruby
317
261
  Chronos.configure do |config|
@@ -322,102 +266,69 @@ Chronos.configure do |config|
322
266
  config.enabled = ENV["CHRONOS_ENABLED"] != "false"
323
267
  config.queue_size = 100
324
268
  config.workers = 1
325
- config.timeout = 5.0
326
- config.open_timeout = 2.0
327
269
  config.max_retries = 3
328
- config.retry_base_interval = 0.5
329
- config.retry_max_interval = 30.0
330
- config.retry_jitter = 0.25
331
270
  config.backlog_size = 100
332
- config.circuit_failure_threshold = 5
333
- config.circuit_reset_timeout = 30.0
334
271
  config.remote_configuration = true
335
- config.context_store = :thread_local
336
- config.breadcrumb_capacity = 20
337
- config.breadcrumb_max_bytes = 2048
338
272
  config.apm_enabled = true
339
- config.apm_max_groups = 200
340
- config.apm_flush_count = 100
341
273
  config.external_http_enabled = false
342
274
  config.cache_key_mode = :none
343
275
  config.dependency_reporting = true
344
276
  config.app_version = ENV["APP_VERSION"]
345
277
  config.revision = ENV["GIT_SHA"]
346
278
  config.deploy_id = ENV["DEPLOY_ID"]
347
- config.region = ENV["REGION"]
348
- config.instance_id = ENV["INSTANCE_ID"]
349
279
  end
350
280
  ```
351
281
 
352
- All options are documented in [Configuration](docs/configuration.md).
282
+ Todas as opções, defaults e limites estão em [Configuração](docs/configuration.md).
353
283
 
354
284
  ## Troubleshooting
355
285
 
356
- 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).
286
+ 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).
357
287
 
358
288
  ## Benchmark
359
289
 
360
- Run the version 0.9 benchmarks with:
290
+ O gate estável executa comparação Rack repetível e carga contra endpoint fake:
361
291
 
362
292
  ```bash
363
- bundle _1.17.3_ exec ruby benchmarks/capture_exception.rb
364
- bundle _1.17.3_ exec ruby benchmarks/serialization.rb
365
- bundle _1.17.3_ exec ruby benchmarks/filtering.rb
366
- bundle _1.17.3_ exec ruby benchmarks/queue.rb
367
- bundle _1.17.3_ exec ruby benchmarks/retry_backlog.rb
368
- bundle _1.17.3_ exec ruby benchmarks/request_overhead.rb
369
- bundle _1.17.3_ exec ruby benchmarks/rails_notifications.rb
370
- bundle _1.17.3_ exec ruby benchmarks/sidekiq_middleware.rb
371
- bundle _1.17.3_ exec ruby benchmarks/apm_aggregation.rb
372
- bundle _1.17.3_ exec ruby benchmarks/external_http.rb
373
- bundle _1.17.3_ exec ruby benchmarks/correlation.rb
293
+ ITERATIONS=50000 WARMUP=5000 SAMPLES=7 bundle _1.17.3_ exec ruby benchmarks/comparative.rb
294
+ ITERATIONS=500 bundle _1.17.3_ exec ruby benchmarks/fake_endpoint_load.rb
374
295
  ```
375
296
 
376
- Results depend on runtime, hardware, and payload. No performance comparison is claimed until repeatable measurements are published.
297
+ 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).
377
298
 
378
- ## Migration from Airbrake
299
+ ## Migração do Airbrake
379
300
 
380
- An Airbrake migration guide will be added before the legacy 1.0 release. Version 0.9 does not claim API compatibility or automatic replacement.
301
+ 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).
381
302
 
382
- ## Local development
303
+ ## Desenvolvimento local
383
304
 
384
- Clone the repository, install Bundler 1.17.3, and run setup:
305
+ Instale Bundler 1.17.3 e as dependências:
385
306
 
386
307
  ```bash
387
308
  gem install bundler -v 1.17.3
388
309
  bin/setup
389
310
  ```
390
311
 
391
- Open an interactive console:
392
-
393
- ```bash
394
- bin/console
395
- ```
396
-
397
- Install the current source locally:
398
-
399
- ```bash
400
- bundle _1.17.3_ exec rake install
401
- ```
312
+ 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).
402
313
 
403
- ## Tests
314
+ ## Testes
404
315
 
405
- Run the complete suite on the current Ruby:
316
+ Execute suíte e lint no runtime atual:
406
317
 
407
318
  ```bash
408
319
  bundle _1.17.3_ exec rake
409
320
  ```
410
321
 
411
- 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.
322
+ A matriz CI cobre Ruby 2.2.102.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.
412
323
 
413
- ## Contributing
324
+ ## Contribuição
414
325
 
415
- 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).
326
+ 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).
416
327
 
417
- ## Security
328
+ ## Segurança
418
329
 
419
- 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.
330
+ 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).
420
331
 
421
- ## License
332
+ ## Licença
422
333
 
423
- Chronos Ruby is distributed under the terms of the MIT License. See [LICENSE.txt](LICENSE.txt).
334
+ Chronos Ruby é distribuída sob a licença MIT. Veja [LICENSE.txt](LICENSE.txt).