@luanpdd/kit-mcp 1.34.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.
- package/README.md +1 -1
- package/bin/cli.js +2 -2
- package/bin/mcp.js +6 -6
- package/bin/ui.js +74 -74
- package/gates/ai-prompt-stability.md +120 -120
- package/gates/budget-description.md +68 -68
- package/gates/confidence.md +29 -29
- package/gates/dependency-check.md +33 -33
- package/gates/dept-cycle-prevention.md +179 -179
- package/gates/golden-signals-coverage.md +133 -133
- package/gates/legacy-refactor-safety.md +178 -178
- package/gates/multi-tenant-rls-coverage.md +102 -102
- package/gates/no-personal-uuid.md +72 -72
- package/gates/obs-agents-mcp-supabase.md +86 -86
- package/gates/obs-skills-frontmatter.md +76 -76
- package/gates/observability-coverage.md +151 -151
- package/gates/omm-no-regression.md +83 -83
- package/gates/postmortem-template-required.md +127 -127
- package/gates/prr-checklist-coverage.md +128 -128
- package/gates/regression.md +32 -32
- package/gates/release-pipeline-policy.md +132 -132
- package/gates/secrets-scan.md +33 -33
- package/gates/service-role-not-in-user-facing.md +113 -113
- package/gates/skill-must-include.md +71 -71
- package/gates/sync-idempotent.md +62 -62
- package/gates/verify-phase-goal.md +34 -34
- package/kit/agents/designer-ui.md +216 -216
- package/kit/agents/workflow-generator.md +537 -0
- package/kit/commands/adicionar-backlog.md +1 -1
- package/kit/commands/adicionar-fase.md +1 -1
- package/kit/commands/adicionar-tarefa.md +1 -1
- package/kit/commands/auditar-observabilidade.md +103 -103
- package/kit/commands/auditar-toil.md +129 -129
- package/kit/commands/caracterizar-prompt.md +195 -195
- package/kit/commands/criar-workflow.md +158 -0
- package/kit/commands/definir-perfil.md +1 -1
- package/kit/commands/definir-slo.md +108 -108
- package/kit/commands/fio.md +1 -1
- package/kit/commands/golden-signals.md +142 -142
- package/kit/commands/instrumentar-fase.md +200 -200
- package/kit/commands/investigar-producao.md +162 -162
- package/kit/commands/observabilidade.md +118 -118
- package/kit/commands/postmortem.md +179 -179
- package/kit/commands/prr.md +205 -205
- package/kit/commands/publicar-rapido.md +207 -207
- package/kit/commands/risk-budget.md +220 -220
- package/kit/commands/sre.md +230 -230
- package/kit/file-manifest.json +5 -2
- package/kit/framework/references/output-style.md +22 -22
- package/kit/hooks/post-apply-migration.js +199 -199
- package/kit/hooks/sidecar-tool-publisher.js +210 -210
- package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
- package/kit/skills/_shared-legacy/glossary.md +389 -389
- package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
- package/kit/skills/_shared-observability/glossary.md +396 -396
- package/kit/skills/_shared-sre/glossary.md +712 -712
- package/kit/skills/_shared-supabase/glossary.md +234 -234
- package/kit/skills/blameless-postmortems/SKILL.md +340 -340
- package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
- package/kit/skills/cascading-failures/SKILL.md +311 -311
- package/kit/skills/core-analysis-loop/SKILL.md +352 -352
- package/kit/skills/distributed-tracing/SKILL.md +362 -362
- package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -0
- package/kit/skills/eliminating-toil/SKILL.md +243 -243
- package/kit/skills/event-based-slos/SKILL.md +296 -296
- package/kit/skills/four-golden-signals/SKILL.md +314 -314
- package/kit/skills/hermetic-builds/SKILL.md +323 -323
- package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
- package/kit/skills/llm-as-dependency/SKILL.md +436 -436
- package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
- package/kit/skills/observability-driven-development/SKILL.md +315 -315
- package/kit/skills/observability-maturity-model/SKILL.md +222 -222
- package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
- package/kit/skills/production-readiness-review/SKILL.md +305 -305
- package/kit/skills/release-engineering/SKILL.md +367 -367
- package/kit/skills/retry-strategies/SKILL.md +372 -372
- package/kit/skills/sre-risk-management/SKILL.md +221 -221
- package/kit/skills/structured-events/SKILL.md +265 -265
- package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
- package/kit/skills/supabase-database-functions/SKILL.md +332 -332
- package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
- package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
- package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
- package/kit/skills/supabase-storage/SKILL.md +234 -234
- package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
- package/kit/skills/telemetry-sampling/SKILL.md +256 -256
- package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
- package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
- package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
- package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
- package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
- package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
- package/kit/skills/ui-tipografia/SKILL.md +211 -211
- package/package.json +1 -1
- package/src/cli/index.js +1114 -1114
- package/src/cli/render.js +194 -194
- package/src/cli/upgrade-check.js +135 -135
- package/src/core/error-redaction.js +76 -76
- package/src/core/failures.js +153 -153
- package/src/core/gate-runner.js +205 -205
- package/src/core/gates.js +82 -82
- package/src/core/logger.js +170 -170
- package/src/core/manifest-verify.js +174 -174
- package/src/core/metrics.js +268 -268
- package/src/core/notify.js +60 -60
- package/src/core/path-safety.js +141 -141
- package/src/core/replays.js +120 -120
- package/src/core/ui.js +185 -185
- package/src/mcp-server/install.js +149 -149
- package/src/mcp-server/roots.js +124 -124
- package/src/ui/auto-spawn.js +113 -113
- package/src/ui/browser.js +78 -78
- package/src/ui/client.js +130 -130
- package/src/ui/events.js +65 -65
- package/src/ui/lockfile.js +191 -191
- package/src/ui/port.js +67 -67
- package/src/ui/server.js +547 -547
- 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".*
|