Skip to content

Commit 9f2e06f

Browse files
committed
feat(monitoring): add per-tenant OTLP collector for distributed tracing
Phase 2 of distributed tracing (design cozystack/community#38, epic #3761): a per-tenant OpenTelemetry Collector as the app-facing OTLP ingest gateway and trust boundary. Plain Deployment + ConfigMap + Service (no OTel operator exists in the platform), deployed in the tenant namespace so app->collector traffic is intra-namespace and never crosses the tenant boundary. - receivers OTLP gRPC :4317 / HTTP :4318; memory_limiter + head sampling (probabilistic_sampler, default 10%) + optional attribute redaction (PII/secret control point) + batch; exports OTLP/HTTP to the tracingStorages backend (vtinsert:10481 for cluster, vtsingle:10428 for single mode) - app-facing Service 'otel-traces' (4317/4318); PSS-restricted-compliant pod and container securityContext; config-checksum annotation to roll on config change - tracingCollector values (enabled/samplingPercentage/redactAttributes/resources) in extra (annotated) + system (image pinned via cozy-lib.image); regenerated values.schema.json / README / ApplicationDefinition; 13 helm-unittest cases Deferred to later phases (epic #3761): AccountID/ProjectID header injection for the shared-central topology (phase 4); engine integrations (phase 3). This PR stacks on the phase-1 backend PR #3762. Signed-off-by: Alexey Artamonov <[email protected]>
1 parent 25de4d8 commit 9f2e06f

7 files changed

Lines changed: 551 additions & 2 deletions

File tree

‎packages/extra/monitoring/README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@
6666
| `tracingStorages[i].retentionDiskUsageBytes` | Optional disk-usage cap as a byte quantity (e.g. "8GB"); bounds disk in addition to the age-based retentionPeriod. | `string` | `""` |
6767

6868

69+
### Traces collector configuration
70+
71+
| Name | Description | Type | Value |
72+
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------- |
73+
| `tracingCollector` | OpenTelemetry Collector for trace ingestion. | `object` | `{}` |
74+
| `tracingCollector.enabled` | Deploy the OTLP collector. When disabled, applications must send OTLP straight to the traces backend (no central sampling/redaction). | `bool` | `true` |
75+
| `tracingCollector.replicas` | Number of collector replicas. Head sampling is trace-id-deterministic, so replicas>1 are safe and remove the single-ingest-path SPOF. | `int` | `1` |
76+
| `tracingCollector.samplingPercentage` | Head-sampling percentage applied at the collector before export. | `int` | `10` |
77+
| `tracingCollector.redactAttributes` | Span attribute keys to drop before export (the PII/secret control point, e.g. db.statement). | `[]string` | `[]` |
78+
| `tracingCollector.resources` | Resource configuration for the collector. | `object` | `{}` |
79+
| `tracingCollector.resources.requests` | Resource requests. | `object` | `{}` |
80+
| `tracingCollector.resources.requests.cpu` | CPU request. | `quantity` | `100m` |
81+
| `tracingCollector.resources.requests.memory` | Memory request. | `quantity` | `256Mi` |
82+
| `tracingCollector.resources.limits` | Resource limits. | `object` | `{}` |
83+
| `tracingCollector.resources.limits.cpu` | CPU limit. | `quantity` | `1` |
84+
| `tracingCollector.resources.limits.memory` | Memory limit. | `quantity` | `1Gi` |
85+
86+
6987
### Alerta configuration
7088

7189
| Name | Description | Type | Value |

‎packages/extra/monitoring/values.schema.json‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,120 @@
372372
}
373373
}
374374
},
375+
"tracingCollector": {
376+
"description": "OpenTelemetry Collector for trace ingestion.",
377+
"type": "object",
378+
"default": {},
379+
"required": [
380+
"enabled",
381+
"replicas",
382+
"samplingPercentage"
383+
],
384+
"properties": {
385+
"enabled": {
386+
"description": "Deploy the OTLP collector. When disabled, applications must send OTLP straight to the traces backend (no central sampling/redaction).",
387+
"type": "boolean",
388+
"default": true
389+
},
390+
"redactAttributes": {
391+
"description": "Span attribute keys to drop before export (the PII/secret control point, e.g. db.statement).",
392+
"type": "array",
393+
"default": [],
394+
"items": {
395+
"type": "string"
396+
}
397+
},
398+
"replicas": {
399+
"description": "Number of collector replicas. Head sampling is trace-id-deterministic, so replicas\u003e1 are safe and remove the single-ingest-path SPOF.",
400+
"type": "integer",
401+
"default": 1
402+
},
403+
"resources": {
404+
"description": "Resource configuration for the collector.",
405+
"type": "object",
406+
"default": {},
407+
"properties": {
408+
"limits": {
409+
"description": "Resource limits.",
410+
"type": "object",
411+
"default": {},
412+
"properties": {
413+
"cpu": {
414+
"description": "CPU limit.",
415+
"default": 1,
416+
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
417+
"anyOf": [
418+
{
419+
"type": "integer"
420+
},
421+
{
422+
"type": "string"
423+
}
424+
],
425+
"x-kubernetes-int-or-string": true
426+
},
427+
"memory": {
428+
"description": "Memory limit.",
429+
"default": "1Gi",
430+
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
431+
"anyOf": [
432+
{
433+
"type": "integer"
434+
},
435+
{
436+
"type": "string"
437+
}
438+
],
439+
"x-kubernetes-int-or-string": true
440+
}
441+
}
442+
},
443+
"requests": {
444+
"description": "Resource requests.",
445+
"type": "object",
446+
"default": {},
447+
"properties": {
448+
"cpu": {
449+
"description": "CPU request.",
450+
"default": "100m",
451+
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
452+
"anyOf": [
453+
{
454+
"type": "integer"
455+
},
456+
{
457+
"type": "string"
458+
}
459+
],
460+
"x-kubernetes-int-or-string": true
461+
},
462+
"memory": {
463+
"description": "Memory request.",
464+
"default": "256Mi",
465+
"pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
466+
"anyOf": [
467+
{
468+
"type": "integer"
469+
},
470+
{
471+
"type": "string"
472+
}
473+
],
474+
"x-kubernetes-int-or-string": true
475+
}
476+
}
477+
}
478+
}
479+
},
480+
"samplingPercentage": {
481+
"description": "Head-sampling percentage applied at the collector before export.",
482+
"type": "integer",
483+
"default": 10,
484+
"maximum": 100,
485+
"minimum": 0
486+
}
487+
}
488+
},
375489
"alerta": {
376490
"description": "Configuration for the Alerta service.",
377491
"type": "object",

‎packages/extra/monitoring/values.yaml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,33 @@ logsStorages:
111111
## @param {[]TracingStorage} tracingStorages - Configuration of traces storage instances. Empty by default (tracing off): nothing writes spans until the trace collector ships, so no backend is provisioned. Add an entry to enable a VictoriaTraces backend.
112112
tracingStorages: []
113113

114+
##
115+
## @section Traces collector configuration
116+
##
117+
118+
## @typedef {struct} TracingCollector - Per-tenant OpenTelemetry Collector that fronts the traces backend. It is the app-facing OTLP ingest gateway and the point where sampling/redaction are enforced; tenant isolation itself comes from the tenant NetworkPolicies, not from this workload.
119+
## @field {bool} enabled=true - Deploy the OTLP collector. When disabled, applications must send OTLP straight to the traces backend (no central sampling/redaction).
120+
## @field {int} replicas=1 - Number of collector replicas. Head sampling is trace-id-deterministic, so replicas>1 are safe and remove the single-ingest-path SPOF.
121+
## @field {int} samplingPercentage=10 - Head-sampling percentage applied at the collector before export.
122+
## @minimum 0
123+
## @maximum 100
124+
## @field {[]string} [redactAttributes] - Span attribute keys to drop before export (the PII/secret control point, e.g. db.statement).
125+
## @field {Resources} [resources] - Resource configuration for the collector.
126+
127+
## @param {TracingCollector} tracingCollector - OpenTelemetry Collector for trace ingestion.
128+
tracingCollector:
129+
enabled: true
130+
replicas: 1
131+
samplingPercentage: 10
132+
redactAttributes: []
133+
resources:
134+
limits:
135+
cpu: "1"
136+
memory: 1Gi
137+
requests:
138+
cpu: 100m
139+
memory: 256Mi
140+
114141
##
115142
## @section Alerta configuration
116143
##

0 commit comments

Comments
 (0)