@luanpdd/kit-mcp 1.35.0 → 1.36.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 (117) hide show
  1. package/bin/cli.js +2 -2
  2. package/bin/mcp.js +6 -6
  3. package/bin/ui.js +74 -74
  4. package/gates/ai-prompt-stability.md +120 -120
  5. package/gates/budget-description.md +68 -68
  6. package/gates/confidence.md +29 -29
  7. package/gates/dependency-check.md +33 -33
  8. package/gates/dept-cycle-prevention.md +179 -179
  9. package/gates/golden-signals-coverage.md +133 -133
  10. package/gates/legacy-refactor-safety.md +178 -178
  11. package/gates/multi-tenant-rls-coverage.md +102 -102
  12. package/gates/no-personal-uuid.md +72 -72
  13. package/gates/obs-agents-mcp-supabase.md +86 -86
  14. package/gates/obs-skills-frontmatter.md +76 -76
  15. package/gates/observability-coverage.md +151 -151
  16. package/gates/omm-no-regression.md +83 -83
  17. package/gates/postmortem-template-required.md +127 -127
  18. package/gates/prr-checklist-coverage.md +128 -128
  19. package/gates/regression.md +32 -32
  20. package/gates/release-pipeline-policy.md +132 -132
  21. package/gates/secrets-scan.md +33 -33
  22. package/gates/service-role-not-in-user-facing.md +113 -113
  23. package/gates/skill-must-include.md +71 -71
  24. package/gates/sync-idempotent.md +62 -62
  25. package/gates/verify-phase-goal.md +34 -34
  26. package/kit/agents/designer-ui.md +216 -216
  27. package/kit/agents/workflow-generator.md +537 -167
  28. package/kit/commands/adicionar-backlog.md +1 -1
  29. package/kit/commands/adicionar-fase.md +1 -1
  30. package/kit/commands/adicionar-tarefa.md +1 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -103
  32. package/kit/commands/auditar-toil.md +129 -129
  33. package/kit/commands/caracterizar-prompt.md +195 -195
  34. package/kit/commands/criar-workflow.md +158 -158
  35. package/kit/commands/definir-perfil.md +1 -1
  36. package/kit/commands/definir-slo.md +108 -108
  37. package/kit/commands/fio.md +1 -1
  38. package/kit/commands/golden-signals.md +142 -142
  39. package/kit/commands/instrumentar-fase.md +200 -200
  40. package/kit/commands/investigar-producao.md +162 -162
  41. package/kit/commands/observabilidade.md +118 -118
  42. package/kit/commands/postmortem.md +179 -179
  43. package/kit/commands/prr.md +205 -205
  44. package/kit/commands/publicar-rapido.md +207 -207
  45. package/kit/commands/risk-budget.md +220 -220
  46. package/kit/commands/sre.md +230 -230
  47. package/kit/file-manifest.json +424 -424
  48. package/kit/framework/references/output-style.md +22 -22
  49. package/kit/hooks/post-apply-migration.js +199 -199
  50. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  51. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  52. package/kit/skills/_shared-legacy/glossary.md +389 -389
  53. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  54. package/kit/skills/_shared-observability/glossary.md +396 -396
  55. package/kit/skills/_shared-sre/glossary.md +712 -712
  56. package/kit/skills/_shared-supabase/glossary.md +234 -234
  57. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  58. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  59. package/kit/skills/cascading-failures/SKILL.md +311 -311
  60. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  61. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  62. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -223
  63. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  64. package/kit/skills/event-based-slos/SKILL.md +296 -296
  65. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  66. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  67. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  68. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  69. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  70. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  71. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  72. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  73. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  74. package/kit/skills/release-engineering/SKILL.md +367 -367
  75. package/kit/skills/retry-strategies/SKILL.md +372 -372
  76. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  77. package/kit/skills/structured-events/SKILL.md +265 -265
  78. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  79. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  80. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  81. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  82. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  83. package/kit/skills/supabase-storage/SKILL.md +234 -234
  84. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  85. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  86. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  87. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  88. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  89. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  90. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  91. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  92. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  93. package/package.json +1 -1
  94. package/src/cli/index.js +1114 -1114
  95. package/src/cli/render.js +194 -194
  96. package/src/cli/upgrade-check.js +135 -135
  97. package/src/core/error-redaction.js +76 -76
  98. package/src/core/failures.js +153 -153
  99. package/src/core/gate-runner.js +205 -205
  100. package/src/core/gates.js +82 -82
  101. package/src/core/logger.js +170 -170
  102. package/src/core/manifest-verify.js +174 -174
  103. package/src/core/metrics.js +268 -268
  104. package/src/core/notify.js +60 -60
  105. package/src/core/path-safety.js +141 -141
  106. package/src/core/replays.js +120 -120
  107. package/src/core/ui.js +185 -185
  108. package/src/mcp-server/install.js +149 -149
  109. package/src/mcp-server/roots.js +124 -124
  110. package/src/ui/auto-spawn.js +113 -113
  111. package/src/ui/browser.js +78 -78
  112. package/src/ui/client.js +130 -130
  113. package/src/ui/events.js +65 -65
  114. package/src/ui/lockfile.js +191 -191
  115. package/src/ui/port.js +67 -67
  116. package/src/ui/server.js +547 -547
  117. package/src/ui/wrapper.js +129 -129
@@ -1,259 +1,259 @@
1
- ---
2
- name: telemetry-pipelines
3
- description: Use ao gerenciar coleta/transporte de telemetria — OTel Collector, routing por destino, buffering, filtering, security. App envia para sidecar; sidecar roteia.
4
- ---
5
-
6
- # Observabilidade — Telemetry Pipelines
7
-
8
- ## Quando usar
9
-
10
- LLM carrega esta skill ao desenhar pipeline de telemetria. Trigger phrases:
11
-
12
- - "OTel Collector", "telemetry pipeline"
13
- - "routing de telemetria"
14
- - "buffering, filtering, transformation"
15
- - "build vs buy de pipeline"
16
- - "1 backend ou múltiplos"
17
-
18
- ## Atributos do pipeline (Cap 18)
19
-
20
- | Atributo | Significado | Importância |
21
- |---|---|---|
22
- | Routing | Mandar dados a destinos diferentes baseado em conteúdo | Alta |
23
- | Security | TLS + auth headers + audit trail | Alta |
24
- | Workload isolation | Erros num destino não afetam outros | Alta |
25
- | Buffering | Tolerar lentidão temporária | Alta |
26
- | Capacity management | Backpressure quando upstream lento | Alta |
27
- | Data filtering | Drop dados sensíveis antes de export | Média-Alta |
28
- | Data augmentation | Adicionar resource attributes (region, env) | Média |
29
- | Data transformation | Renomear campos, normalizar formatos | Média |
30
- | Quality | Validação de schema | Média |
31
-
32
- ## Regras absolutas
33
-
34
- - **App envia para sidecar/Collector local** — nunca direto para backend remoto. Trocar destino = config no Collector, não redeploy do app.
35
- - **OTel Collector é o default** — vendor-neutral, plug-in arquitetura. Usar pipelines proprietários (vendor agent) cria lock-in.
36
- - **Multi-destino é normal** — 1 mesmo trace pode ir para Honeycomb (debug), Logflare (compliance), arquivo local (dev) simultaneamente.
37
- - **Buffering é obrigatório** — destinos remotos têm hiccups; sem buffer, perde dados.
38
- - **Filtragem por security/compliance** — drop campos PII antes de export externo. PII em arquivo local = ok; em vendor remoto = problema legal.
39
- - **Workload isolation** — erro/lentidão em 1 destino não bloqueia outros. Use exporters paralelos no Collector.
40
- - **Capacity managemement** — Collector deve ter limites de buffer e graceful drop quando saturado (não OOM).
41
-
42
- ## Patterns canônicos
43
-
44
- ### Pattern: Collector config canônico (multi-destino)
45
-
46
- ```yaml
47
- # PT-BR: otel-collector-config.yaml — recebe OTLP, processa, roteia
48
- receivers:
49
- otlp:
50
- protocols:
51
- http: { endpoint: 0.0.0.0:4318 }
52
- grpc: { endpoint: 0.0.0.0:4317 }
53
-
54
- processors:
55
- # PT-BR: batch para reduzir round-trips
56
- batch:
57
- timeout: 10s
58
- send_batch_size: 1024
59
-
60
- # PT-BR: tail sampling — 100% errors, 1% baseline
61
- tail_sampling:
62
- decision_wait: 10s
63
- policies:
64
- - name: errors
65
- type: status_code
66
- status_code: { status_codes: [ERROR] }
67
- - name: baseline
68
- type: probabilistic
69
- probabilistic: { sampling_percentage: 1 }
70
-
71
- # PT-BR: filter PII — drop campos sensíveis antes de export remoto
72
- attributes/redact_pii:
73
- actions:
74
- - key: user.email
75
- action: hash # hash em vez de drop — mantém cardinalidade
76
- - key: user.cpf
77
- action: delete
78
- - key: credit_card.number
79
- action: delete
80
-
81
- # PT-BR: augment com resource attributes
82
- resource:
83
- attributes:
84
- - key: deployment.environment
85
- value: ${env:NODE_ENV}
86
- action: insert
87
- - key: cloud.region
88
- value: ${env:AWS_REGION}
89
- action: insert
90
-
91
- exporters:
92
- # PT-BR: para Honeycomb (debug)
93
- otlphttp/honeycomb:
94
- endpoint: https://api.honeycomb.io
95
- headers:
96
- x-honeycomb-team: ${env:HONEYCOMB_API_KEY}
97
-
98
- # PT-BR: para Logflare (Supabase compliance)
99
- otlphttp/logflare:
100
- endpoint: https://api.logflare.app/otel
101
- headers:
102
- x-api-key: ${env:LOGFLARE_API_KEY}
103
-
104
- # PT-BR: arquivo local — debug local, retain 7d
105
- file:
106
- path: /var/log/otel/traces.json
107
- rotation:
108
- max_megabytes: 100
109
- max_days: 7
110
- max_backups: 10
111
-
112
- service:
113
- pipelines:
114
- traces:
115
- receivers: [otlp]
116
- processors: [tail_sampling, attributes/redact_pii, resource, batch]
117
- exporters: [otlphttp/honeycomb, otlphttp/logflare, file]
118
- metrics:
119
- receivers: [otlp]
120
- processors: [resource, batch]
121
- exporters: [otlphttp/honeycomb]
122
- logs:
123
- receivers: [otlp]
124
- processors: [attributes/redact_pii, batch]
125
- exporters: [otlphttp/logflare, file]
126
-
127
- # PT-BR: telemetria do collector próprio (meta-observability)
128
- telemetry:
129
- logs:
130
- level: info
131
- metrics:
132
- level: detailed
133
- address: 0.0.0.0:8888
134
- ```
135
-
136
- ### Pattern: routing por conteúdo
137
-
138
- ```yaml
139
- # PT-BR: rotear traces para destinos diferentes baseado em service.name
140
- processors:
141
- routing/service:
142
- from_attribute: service.name
143
- table:
144
- - value: orders-service
145
- exporters: [otlphttp/honeycomb]
146
- - value: payments-service
147
- exporters: [otlphttp/honeycomb, otlphttp/datadog] # 2 destinos
148
- default_exporters: [file]
149
- ```
150
-
151
- ### Pattern: backpressure
152
-
153
- ```yaml
154
- # PT-BR: limit memory + drop oldest se saturar
155
- processors:
156
- memory_limiter:
157
- check_interval: 1s
158
- limit_mib: 1500 # PT-BR: drop quando passar de 1.5 GB
159
- spike_limit_mib: 512 # PT-BR: tolerância a spikes de 512 MB
160
-
161
- service:
162
- pipelines:
163
- traces:
164
- processors: [memory_limiter, ...] # PT-BR: PRIMEIRO no pipeline
165
- ```
166
-
167
- ### Pattern: build vs buy
168
-
169
- ```text
170
- PT-BR: critérios para construir vs comprar pipeline (Cap 18 p239):
171
-
172
- CONSTRUIR (próprio Collector custom) se:
173
- - Volume > 10M spans/segundo (vendors caros nesse range)
174
- - Compliance específico que vendor não cobre
175
- - 5+ engineers full-time disponíveis para ops
176
-
177
- COMPRAR (vendor managed: Honeycomb / Datadog / etc.) se:
178
- - Volume < 1M spans/segundo
179
- - Time pequeno (≤ 3 engineers)
180
- - Compliance geral (SOC2, GDPR — vendors já cobrem)
181
-
182
- HÍBRIDO (default recomendado):
183
- - OTel Collector (open source) como sidecar local
184
- - Backend SaaS como destino primary
185
- - File local como secondary (compliance/debug)
186
- ```
187
-
188
- ## Anti-patterns
189
-
190
- ### ANTI: app envia direto para backend remoto
191
-
192
- ```text
193
- ANTI: SDK exporta direto para api.honeycomb.io
194
- Trocar para Datadog = redeploy de TODOS os services
195
- Pipeline vai abaixo se backend tem hiccup → app trava
196
-
197
- CERTO: app → localhost:4318 (Collector) → roteamento múltiplo
198
- Trocar destino = editar Collector config; sem redeploy
199
- ```
200
-
201
- ### ANTI: 1 destino monolítico
202
-
203
- ```text
204
- ANTI: Honeycomb único destino para tudo
205
- Vendor outage = visibilidade total perdida
206
- Compliance pode exigir cópia em region específica
207
-
208
- CERTO: Honeycomb (debug) + Logflare (compliance) + file (local)
209
- Cada destino independente; falha em 1 não afeta outros
210
- ```
211
-
212
- ### ANTI: sem PII filter antes de export remoto
213
-
214
- ```text
215
- ANTI: spans com `user.email`, `user.cpf` enviados literalmente para vendor SaaS
216
- GDPR / LGPD violado; vendor outage = leak
217
-
218
- CERTO: processor `attributes/redact_pii` — hash emails, drop docs.
219
- Cópia local pode reter para debug interno; remoto vê só hash.
220
- ```
221
-
222
- ### ANTI: sem buffering
223
-
224
- ```text
225
- ANTI: sync export — cada span é POST imediato
226
- Backend latência = app latência sobe
227
- Backend down = spans perdidos
228
-
229
- CERTO: batch processor (10s ou 1024 spans) + retry
230
- Buffer absorve hiccups de até segundos sem afetar app
231
- ```
232
-
233
- ### ANTI: vendor agent proprietary
234
-
235
- ```text
236
- ANTI: instalar dd-agent / new-relic-agent / etc. em todos os hosts
237
- Vendor lock-in; trocar = reinstrumentar tudo
238
-
239
- CERTO: OTel SDK + OTel Collector
240
- Vendor é apenas o destino do exporter; trocar = mudar 1 linha de config
241
- ```
242
-
243
- ## Verificação
244
-
245
- 1. **App configurado para localhost:4318** — `select * from connections` deve mostrar app→Collector apenas
246
- 2. **Multi-destino funciona** — fazer 1 request → trace aparece em Honeycomb + Logflare + file simultaneamente
247
- 3. **Filter PII testado** — span com user.email=foo@x.com → no destino remoto, atributo é hash, não literal
248
- 4. **Backpressure** — gerar carga sintética acima do limit → Collector dropa, não OOM
249
- 5. **Buffer recovery** — desligar destino remoto temporariamente → spans bufferados → ligar → flush
250
-
251
- ---
252
-
253
- ## Ver também
254
-
255
- - `kit/skills/_shared-observability/glossary.md` — telemetry pipeline, routing, buffering
256
- - `kit/skills/opentelemetry-standard/SKILL.md` — OTel Collector basics
257
- - `kit/skills/telemetry-sampling/SKILL.md` — tail_sampling processor
258
-
259
- *Material-fonte: Observability Engineering (O'Reilly, 2022) — Cap 18: "Telemetry Management with Pipelines".*
1
+ ---
2
+ name: telemetry-pipelines
3
+ description: Use ao gerenciar coleta/transporte de telemetria — OTel Collector, routing por destino, buffering, filtering, security. App envia para sidecar; sidecar roteia.
4
+ ---
5
+
6
+ # Observabilidade — Telemetry Pipelines
7
+
8
+ ## Quando usar
9
+
10
+ LLM carrega esta skill ao desenhar pipeline de telemetria. Trigger phrases:
11
+
12
+ - "OTel Collector", "telemetry pipeline"
13
+ - "routing de telemetria"
14
+ - "buffering, filtering, transformation"
15
+ - "build vs buy de pipeline"
16
+ - "1 backend ou múltiplos"
17
+
18
+ ## Atributos do pipeline (Cap 18)
19
+
20
+ | Atributo | Significado | Importância |
21
+ |---|---|---|
22
+ | Routing | Mandar dados a destinos diferentes baseado em conteúdo | Alta |
23
+ | Security | TLS + auth headers + audit trail | Alta |
24
+ | Workload isolation | Erros num destino não afetam outros | Alta |
25
+ | Buffering | Tolerar lentidão temporária | Alta |
26
+ | Capacity management | Backpressure quando upstream lento | Alta |
27
+ | Data filtering | Drop dados sensíveis antes de export | Média-Alta |
28
+ | Data augmentation | Adicionar resource attributes (region, env) | Média |
29
+ | Data transformation | Renomear campos, normalizar formatos | Média |
30
+ | Quality | Validação de schema | Média |
31
+
32
+ ## Regras absolutas
33
+
34
+ - **App envia para sidecar/Collector local** — nunca direto para backend remoto. Trocar destino = config no Collector, não redeploy do app.
35
+ - **OTel Collector é o default** — vendor-neutral, plug-in arquitetura. Usar pipelines proprietários (vendor agent) cria lock-in.
36
+ - **Multi-destino é normal** — 1 mesmo trace pode ir para Honeycomb (debug), Logflare (compliance), arquivo local (dev) simultaneamente.
37
+ - **Buffering é obrigatório** — destinos remotos têm hiccups; sem buffer, perde dados.
38
+ - **Filtragem por security/compliance** — drop campos PII antes de export externo. PII em arquivo local = ok; em vendor remoto = problema legal.
39
+ - **Workload isolation** — erro/lentidão em 1 destino não bloqueia outros. Use exporters paralelos no Collector.
40
+ - **Capacity managemement** — Collector deve ter limites de buffer e graceful drop quando saturado (não OOM).
41
+
42
+ ## Patterns canônicos
43
+
44
+ ### Pattern: Collector config canônico (multi-destino)
45
+
46
+ ```yaml
47
+ # PT-BR: otel-collector-config.yaml — recebe OTLP, processa, roteia
48
+ receivers:
49
+ otlp:
50
+ protocols:
51
+ http: { endpoint: 0.0.0.0:4318 }
52
+ grpc: { endpoint: 0.0.0.0:4317 }
53
+
54
+ processors:
55
+ # PT-BR: batch para reduzir round-trips
56
+ batch:
57
+ timeout: 10s
58
+ send_batch_size: 1024
59
+
60
+ # PT-BR: tail sampling — 100% errors, 1% baseline
61
+ tail_sampling:
62
+ decision_wait: 10s
63
+ policies:
64
+ - name: errors
65
+ type: status_code
66
+ status_code: { status_codes: [ERROR] }
67
+ - name: baseline
68
+ type: probabilistic
69
+ probabilistic: { sampling_percentage: 1 }
70
+
71
+ # PT-BR: filter PII — drop campos sensíveis antes de export remoto
72
+ attributes/redact_pii:
73
+ actions:
74
+ - key: user.email
75
+ action: hash # hash em vez de drop — mantém cardinalidade
76
+ - key: user.cpf
77
+ action: delete
78
+ - key: credit_card.number
79
+ action: delete
80
+
81
+ # PT-BR: augment com resource attributes
82
+ resource:
83
+ attributes:
84
+ - key: deployment.environment
85
+ value: ${env:NODE_ENV}
86
+ action: insert
87
+ - key: cloud.region
88
+ value: ${env:AWS_REGION}
89
+ action: insert
90
+
91
+ exporters:
92
+ # PT-BR: para Honeycomb (debug)
93
+ otlphttp/honeycomb:
94
+ endpoint: https://api.honeycomb.io
95
+ headers:
96
+ x-honeycomb-team: ${env:HONEYCOMB_API_KEY}
97
+
98
+ # PT-BR: para Logflare (Supabase compliance)
99
+ otlphttp/logflare:
100
+ endpoint: https://api.logflare.app/otel
101
+ headers:
102
+ x-api-key: ${env:LOGFLARE_API_KEY}
103
+
104
+ # PT-BR: arquivo local — debug local, retain 7d
105
+ file:
106
+ path: /var/log/otel/traces.json
107
+ rotation:
108
+ max_megabytes: 100
109
+ max_days: 7
110
+ max_backups: 10
111
+
112
+ service:
113
+ pipelines:
114
+ traces:
115
+ receivers: [otlp]
116
+ processors: [tail_sampling, attributes/redact_pii, resource, batch]
117
+ exporters: [otlphttp/honeycomb, otlphttp/logflare, file]
118
+ metrics:
119
+ receivers: [otlp]
120
+ processors: [resource, batch]
121
+ exporters: [otlphttp/honeycomb]
122
+ logs:
123
+ receivers: [otlp]
124
+ processors: [attributes/redact_pii, batch]
125
+ exporters: [otlphttp/logflare, file]
126
+
127
+ # PT-BR: telemetria do collector próprio (meta-observability)
128
+ telemetry:
129
+ logs:
130
+ level: info
131
+ metrics:
132
+ level: detailed
133
+ address: 0.0.0.0:8888
134
+ ```
135
+
136
+ ### Pattern: routing por conteúdo
137
+
138
+ ```yaml
139
+ # PT-BR: rotear traces para destinos diferentes baseado em service.name
140
+ processors:
141
+ routing/service:
142
+ from_attribute: service.name
143
+ table:
144
+ - value: orders-service
145
+ exporters: [otlphttp/honeycomb]
146
+ - value: payments-service
147
+ exporters: [otlphttp/honeycomb, otlphttp/datadog] # 2 destinos
148
+ default_exporters: [file]
149
+ ```
150
+
151
+ ### Pattern: backpressure
152
+
153
+ ```yaml
154
+ # PT-BR: limit memory + drop oldest se saturar
155
+ processors:
156
+ memory_limiter:
157
+ check_interval: 1s
158
+ limit_mib: 1500 # PT-BR: drop quando passar de 1.5 GB
159
+ spike_limit_mib: 512 # PT-BR: tolerância a spikes de 512 MB
160
+
161
+ service:
162
+ pipelines:
163
+ traces:
164
+ processors: [memory_limiter, ...] # PT-BR: PRIMEIRO no pipeline
165
+ ```
166
+
167
+ ### Pattern: build vs buy
168
+
169
+ ```text
170
+ PT-BR: critérios para construir vs comprar pipeline (Cap 18 p239):
171
+
172
+ CONSTRUIR (próprio Collector custom) se:
173
+ - Volume > 10M spans/segundo (vendors caros nesse range)
174
+ - Compliance específico que vendor não cobre
175
+ - 5+ engineers full-time disponíveis para ops
176
+
177
+ COMPRAR (vendor managed: Honeycomb / Datadog / etc.) se:
178
+ - Volume < 1M spans/segundo
179
+ - Time pequeno (≤ 3 engineers)
180
+ - Compliance geral (SOC2, GDPR — vendors já cobrem)
181
+
182
+ HÍBRIDO (default recomendado):
183
+ - OTel Collector (open source) como sidecar local
184
+ - Backend SaaS como destino primary
185
+ - File local como secondary (compliance/debug)
186
+ ```
187
+
188
+ ## Anti-patterns
189
+
190
+ ### ANTI: app envia direto para backend remoto
191
+
192
+ ```text
193
+ ANTI: SDK exporta direto para api.honeycomb.io
194
+ Trocar para Datadog = redeploy de TODOS os services
195
+ Pipeline vai abaixo se backend tem hiccup → app trava
196
+
197
+ CERTO: app → localhost:4318 (Collector) → roteamento múltiplo
198
+ Trocar destino = editar Collector config; sem redeploy
199
+ ```
200
+
201
+ ### ANTI: 1 destino monolítico
202
+
203
+ ```text
204
+ ANTI: Honeycomb único destino para tudo
205
+ Vendor outage = visibilidade total perdida
206
+ Compliance pode exigir cópia em region específica
207
+
208
+ CERTO: Honeycomb (debug) + Logflare (compliance) + file (local)
209
+ Cada destino independente; falha em 1 não afeta outros
210
+ ```
211
+
212
+ ### ANTI: sem PII filter antes de export remoto
213
+
214
+ ```text
215
+ ANTI: spans com `user.email`, `user.cpf` enviados literalmente para vendor SaaS
216
+ GDPR / LGPD violado; vendor outage = leak
217
+
218
+ CERTO: processor `attributes/redact_pii` — hash emails, drop docs.
219
+ Cópia local pode reter para debug interno; remoto vê só hash.
220
+ ```
221
+
222
+ ### ANTI: sem buffering
223
+
224
+ ```text
225
+ ANTI: sync export — cada span é POST imediato
226
+ Backend latência = app latência sobe
227
+ Backend down = spans perdidos
228
+
229
+ CERTO: batch processor (10s ou 1024 spans) + retry
230
+ Buffer absorve hiccups de até segundos sem afetar app
231
+ ```
232
+
233
+ ### ANTI: vendor agent proprietary
234
+
235
+ ```text
236
+ ANTI: instalar dd-agent / new-relic-agent / etc. em todos os hosts
237
+ Vendor lock-in; trocar = reinstrumentar tudo
238
+
239
+ CERTO: OTel SDK + OTel Collector
240
+ Vendor é apenas o destino do exporter; trocar = mudar 1 linha de config
241
+ ```
242
+
243
+ ## Verificação
244
+
245
+ 1. **App configurado para localhost:4318** — `select * from connections` deve mostrar app→Collector apenas
246
+ 2. **Multi-destino funciona** — fazer 1 request → trace aparece em Honeycomb + Logflare + file simultaneamente
247
+ 3. **Filter PII testado** — span com user.email=foo@x.com → no destino remoto, atributo é hash, não literal
248
+ 4. **Backpressure** — gerar carga sintética acima do limit → Collector dropa, não OOM
249
+ 5. **Buffer recovery** — desligar destino remoto temporariamente → spans bufferados → ligar → flush
250
+
251
+ ---
252
+
253
+ ## Ver também
254
+
255
+ - `kit/skills/_shared-observability/glossary.md` — telemetry pipeline, routing, buffering
256
+ - `kit/skills/opentelemetry-standard/SKILL.md` — OTel Collector basics
257
+ - `kit/skills/telemetry-sampling/SKILL.md` — tail_sampling processor
258
+
259
+ *Material-fonte: Observability Engineering (O'Reilly, 2022) — Cap 18: "Telemetry Management with Pipelines".*