Skip to content

Add design proposal: Distributed tracing via OTLP and VictoriaTraces#38

Open
scooby87 wants to merge 9 commits into
mainfrom
design/distributed-tracing
Open

Add design proposal: Distributed tracing via OTLP and VictoriaTraces#38
scooby87 wants to merge 9 commits into
mainfrom
design/distributed-tracing

Conversation

@scooby87

@scooby87 scooby87 commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Adds a design proposal for distributed tracing in the Cozystack monitoring stack — the missing third observability signal alongside metrics (VictoriaMetrics) and logs (VictoriaLogs).

The proposal centers on VictoriaTraces (its VTCluster/VTSingle CRDs already ship in the victoria-metrics-operator Cozystack deploys), so no new operator is introduced. It mirrors the existing VictoriaLogs deployment, datasource-provisioning, and values conventions one-for-one.

Design highlights

  • OTLP ingest (gRPC 4317 / HTTP 4318) via an OpenTelemetry Collector in cozy-monitoring, following the monitoring-agents pattern.
  • VictoriaTraces backend via a new tracingStorages values list → VTCluster, lifted from the VLCluster template; retention configurable, default 14d.
  • Grafana traces datasource with trace↔logs↔metrics correlation.
  • Per-app opt-in tracing.enabled toggle (off by default), modelled on foundationdb's monitoring.enabled; native OTLP where the engine supports it (ClickHouse, NATS), sidecar/agent otherwise.
  • Preserves the multi-tenant central-backend topology and per-tenant isolation.

Grafana Tempo is documented as the drop-in fallback if VictoriaTraces proves immature.

Rendered: design-proposals/distributed-tracing/README.md

Status: Review — open for design review.

Summary by CodeRabbit

  • Documentation
    • Added a design proposal for distributed tracing in the monitoring stack.
    • Defined a staged approach for OTLP ingest with a stable port-facing gRPC service and an optional OpenTelemetry Collector gateway.
    • Documented Grafana tracing datasource provisioning for each tracing storage and expected trace correlation with logs and metrics.
    • Introduced an opt-in per-application tracing configuration contract, including sampling behavior, edge cases, and testing/rollout guidance.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds a distributed tracing design proposal covering VictoriaTraces storage, staged OTLP ingestion, Grafana correlation, per-application opt-in, tenant isolation, testing, and rollout behavior.

Changes

Distributed tracing proposal

Layer / File(s) Summary
Architecture and tracing storage
design-proposals/distributed-tracing/README.md
Introduces the tracing scope and defines tracingStorages, VictoriaTraces clusters, retention, and readiness requirements.
Ingest and application integration
design-proposals/distributed-tracing/README.md
Describes staged OTLP routing, Grafana trace correlation, and opt-in application tracing configuration.
Operations and rollout
design-proposals/distributed-tracing/README.md
Documents upgrade behavior, security, failure cases, testing, rollout, design decisions, and alternatives.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: a distributed tracing design proposal using OTLP and VictoriaTraces.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch design/distributed-tracing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a design proposal for integrating distributed tracing into the Cozystack monitoring stack using OTLP and VictoriaTraces. The feedback recommends making the replica counts configurable to prevent scheduling failures in resource-constrained environments, addressing cross-chart dependency issues when tenant apps have tracing enabled but no backend is configured, and supporting both VTCluster and VTSingle deployments to align with existing patterns.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +86 to +90
vtinsert: { replicaCount: 2 }
vtselect: { replicaCount: 2 }
vtstorage:
retentionPeriod: {{ .retentionPeriod | quote }}
replicaCount: 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding replicaCount: 2 for the VictoriaTraces components in the template can lead to scheduling failures in single-node or resource-constrained environments (such as local development or small testing clusters) due to pod anti-affinity or resource limits. Making the replica counts configurable within the tracingStorages schema, or dynamically defaulting them based on the cluster topology, would improve deployment flexibility.

Suggested change
vtinsert: { replicaCount: 2 }
vtselect: { replicaCount: 2 }
vtstorage:
retentionPeriod: {{ .retentionPeriod | quote }}
replicaCount: 2
vtinsert: { replicaCount: {{ .replicaCount | default 2 }} }\n vtselect: { replicaCount: {{ .replicaCount | default 2 }} }\n vtstorage:\n retentionPeriod: {{ .retentionPeriod | quote }}\n replicaCount: {{ .replicaCount | default 2 }}


## Failure and edge cases

- Empty `tracingStorages` while a consumer expects a backend → loud render failure (mirrors `cozystack/cozystack#3181`), never a silent span black hole.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While failing the render of the monitoring chart on an empty tracingStorages list prevents a silent black hole within that release, tenant applications (which are separate Helm releases) won't be aware of this at render time. If a tenant app has tracing.enabled: true but tracingStorages is empty, the app will attempt to send traces to a non-existent collector or backend, potentially causing connection timeouts or DNS errors. Detailing how this cross-chart dependency is managed, or if the platform collector should always be present (perhaps with a dummy/noop exporter) to safely discard spans when no backend is configured, would make the architecture more robust.

## Open questions

- **VictoriaTraces maturity**: the CRDs ship in the operator, but is VictoriaTraces production-ready at the version Cozystack pins? If not, Grafana Tempo is the drop-in fallback (see Alternatives) — the collector and per-app surfaces are backend-agnostic, so only the backend template and datasource type change.
- **`VTCluster` vs `VTSingle`** as the default: cluster for HA parity with metrics/logs, or single for a lighter footprint on small clusters?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Regarding the choice between VTCluster and VTSingle: to align with Cozystack's existing patterns for VictoriaMetrics and VictoriaLogs, supporting both is highly recommended. A VTSingle deployment is ideal for edge, single-node, or development environments to minimize overhead, while VTCluster should be used for production environments requiring high availability and scalability.

…ture

Direct-to-vtinsert MVP (mirrors logs) then an opt-in OpenTelemetry Collector
gateway; ExternalName redirect via cozystack-basics; poller readiness gate on
VTCluster; clarify WorkloadMonitor is operational-only so tracing opt-in lives
in app values.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
@scooby87
scooby87 marked this pull request as ready for review July 16, 2026 14:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
design-proposals/distributed-tracing/README.md (2)

126-128: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Specify how RED/span metrics are produced.

Direct Stage A ingestion creates no metrics, and the proposal does not define a Collector spanmetrics connector, application metric source, exemplars, or Grafana tracesToMetrics queries. Grafana’s trace-to-metrics feature links to pre-existing metrics; it does not generate them automatically. (grafana.com)

Also applies to: 193-195

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@design-proposals/distributed-tracing/README.md` around lines 126 - 128,
Update the distributed tracing proposal’s RED/span metrics design to explicitly
specify their source and production path, including whether they come from a
Collector spanmetrics connector or application instrumentation. Define how
exemplars are attached and provide the Grafana tracesToMetrics
queries/configuration that consume the resulting metrics, covering both the
trace-to-metrics and metrics-to-trace links.

Source: MCP tools


72-90: 🩺 Stability & Availability | 🔵 Trivial

Do not equate vtstorage.replicaCount with HA replication.

VictoriaTraces cluster mode does not replicate data between storage nodes; losing one node can make complete queries fail. If “HA parity” is intended, document this limitation and use Collector replication to independent VictoriaTraces clusters or another supported durability design. (docs.victoriametrics.com)

Also applies to: 208-208

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@design-proposals/distributed-tracing/README.md` around lines 72 - 90, Update
the VTCluster template documentation and configuration guidance around the
tracingStorages render to state that vtstorage.replicaCount provides no data
replication or HA durability. Document the limitation and direct HA deployments
to replicate through Collectors into independent VictoriaTraces clusters or use
another supported durability design; do not present the existing replicaCount
settings as HA parity.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@design-proposals/distributed-tracing/README.md`:
- Around line 72-103: The tracing template must distinguish an absent
tracingStorages value from an explicitly empty list and enforce the intended
behavior consistently. Update the VTCluster rendering template and related tests
so the chosen contract is encoded: preserve successful rendering when the list
is absent if that remains supported, but fail rendering for an explicitly empty
list; ensure tests cover both cases and the guard produces a clear failure.
- Around line 186-187: Update the “Backend storage exhausted” failure mode to
distinguish age-based retention from VictoriaTraces disk-retention limits,
referencing vtstorage.retentionDiskSpaceUsage or the equivalent retention flags.
Document that PVC exhaustion can block ingest before old traces are evicted, and
add capacity alerts plus a test covering PVC exhaustion.
- Around line 112-120: Update the Stage A design around the ExternalName
redirect to define how OTLP ports 4317/4318 and the OTLP/HTTP path are served by
vtinsert, whose defaults are port 10481 and /insert/opentelemetry/v1/traces.
Specify an explicit Service/listener port mapping or path-aware proxy, rather
than relying on ExternalName DNS aliasing alone, while preserving the existing
monitoring-enabled gating and tenant routing.
- Around line 114-120: Update the Stage B collector deployment design to
preserve trace affinity for tail sampling: run the sampling tier with a single
replica, or introduce trace-ID-aware routing/load balancing before multiple
Collector replicas. Do not rely on a regular Kubernetes Service alone to
distribute traffic to the Collector gateway.
- Around line 112-118: Update the distributed-tracing proposal so Stage A
explicitly injects VictoriaTraces AccountID and ProjectID headers using
authenticated workload identity, via the application, trusted proxy, or exporter
rather than relying on the ExternalName redirect. Extend Stage B’s Collector
design to map the authenticated tenant identity to those VictoriaTraces headers
in the OTLP exporter path, in addition to stamping the tenant resource
attribute.

---

Nitpick comments:
In `@design-proposals/distributed-tracing/README.md`:
- Around line 126-128: Update the distributed tracing proposal’s RED/span
metrics design to explicitly specify their source and production path, including
whether they come from a Collector spanmetrics connector or application
instrumentation. Define how exemplars are attached and provide the Grafana
tracesToMetrics queries/configuration that consume the resulting metrics,
covering both the trace-to-metrics and metrics-to-trace links.
- Around line 72-90: Update the VTCluster template documentation and
configuration guidance around the tracingStorages render to state that
vtstorage.replicaCount provides no data replication or HA durability. Document
the limitation and direct HA deployments to replicate through Collectors into
independent VictoriaTraces clusters or use another supported durability design;
do not present the existing replicaCount settings as HA parity.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2261fb92-b1e9-4672-ad8a-0b19c956a39c

📥 Commits

Reviewing files that changed from the base of the PR and between 789654a and bd75a12.

📒 Files selected for processing (1)
  • design-proposals/distributed-tracing/README.md

Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
@IvanHunters

Copy link
Copy Markdown
Contributor

Verdict

LGTM with non-blocking notes

This is a Draft design proposal (docs-only, single README.md, no code touched under packages/). I verified the load-bearing claims against the live cozystack/cozystack tree rather than taking them on trust, and they hold up:

  • VTCluster/VTSingle CRDs do ship in the vendored victoria-metrics-operator (crd.yaml), served at operator.victoriametrics.com/v1 — the rendered template correctly uses v1, matching VLCluster.
  • The empty-logsStorages render guard ({{- fail … #3181 }}) exists verbatim; the proposal's plan to replicate it for tracingStorages is grounded in the real mechanism.
  • The VLCluster template shape (vlinsert/vlselect/vlstorage, claim-template label for the release-scoped post-delete cleanup) matches what the proposal lifts from.
  • foundationdb's monitoring.enabled toggle exists — the tracing.enabled model is a faithful copy.
  • cozystack-basics/templates/monitoring-external-services.yaml with the ExternalName redirects gated on _cluster.monitoring-enabled (fed from monitoring.rootEnabled) exists exactly as described.

The design is conservative, single-vendor, additive/opt-in, and reuses established conventions. Good doc. The notes below are for the design discussion, none block merging a Draft.

Findings (non-blocking)

[MINOR] Stage A read-side tenant isolation is under-specified. Security section frames per-tenant tenant attribution, rate-limiting and sampling as write-side properties the Stage B collector adds. But on a shared central backend, the open question is the read path: does the per-tenant Grafana jaeger/vtselect datasource scope a tenant to its own spans, or can tenant A query tenant B's traces? Logs/metrics solve this with tenant labelling + per-tenant stacks; the proposal says traces "keep the existing tenant-labelling model" but doesn't state how a Jaeger-compatible query API enforces that on read. Worth an explicit paragraph (or a new Open Question) — this is the part most likely to bite in central-backend mode, and it's not clearly a Stage B concern.

[MINOR] Jaeger-compatible datasource type is the one unverified external claim. type: jaeger pointed at vtselect rests on VictoriaTraces exposing a Jaeger-compatible query API. This is the single load-bearing claim I could not confirm against the repo (it's external VictoriaTraces behavior). The doc already hedges it ("or the dedicated VictoriaTraces datasource plugin"), which is the right posture — just flag it as a confirm-before-implementation item, since the whole trace↔logs↔metrics correlation UX depends on which datasource type actually lands.

[NIT] Leftover authoring instruction in committed doc. Line 1 is <!-- Place this file at design-proposals/distributed-tracing/README.md --> — a note-to-self that shouldn't ship in the merged file. Drop it.

[NIT] Sketch VTCluster drops a managedMetadata label present on VLCluster. The real vlogs.yaml stamps apps.cozystack.io/application.group: apps.cozystack.io alongside .kind/.name; the proposal's example only carries .kind/.name. Purely a sketch-fidelity nit — carry all three when this becomes a real template so dashboard/ownership grouping stays consistent.

Notes on the prior gemini-code-assist review

  • Configurable replica counts: valid, but the existing vlogs.yaml also hardcodes replicaCount: 2, so this proposal faithfully mirrors current convention rather than introducing a regression. The "VTCluster vs VTSingle default" Open Question already covers the small-cluster footprint case.
  • Cross-chart dependency (tracing.enabled with no backend): already handled in "Failure and edge cases" — the ExternalName resolves to nothing and the OTLP exporter drops/retries harmlessly; the toggle is documented to require a tracingStorages backend.
  • Support both VTCluster and VTSingle: already raised as an Open Question.

Phase 5b (upgrade / fresh-install impact)

N/A — the diff touches only design-proposals/, nothing under packages/. No chart, migration, RBAC, or default-flip surface exists to regress an existing-customer upgrade or a fresh install.

…y, disk retention

- Stage A: document AccountID/ProjectID tenant-header injection and the real
  vtinsert OTLP contract (port 10481, /insert/opentelemetry/v1/traces); ExternalName
  aliases DNS only.
- Stage B: otlphttp exporter sets tenant headers; tail-sampling trace affinity
  (single replica or loadbalancingexporter routing_key=traceID).
- Backend: configurable replicaCount; retentionDiskSpaceUsage vs age retention;
  durability caveat (replicaCount != data replication); absent-vs-empty contract.
- Grafana: span-metrics need a spanmetrics connector; read-side tenant isolation.
- Security/Failure/Testing/Open questions updated accordingly.
- Drop leftover authoring comment; add application.group managedMetadata label.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
@scooby87

Copy link
Copy Markdown
Author

Thanks for the reviews — IvanHunters and the bots. Pushed 39e0205 addressing the valid findings; summary below.

Addressed in the doc

  • Tenant routing via AccountID/ProjectID headers (CodeRabbit 🔴): added an explicit "Tenant routing needs headers" note in Stage A and an exporter headers: mapping in Stage B — ExternalName/resource processor don't set them, so without injection everything lands in the default tenant 0:0. Also flagged in Security (must come from authenticated identity, not tenant-controlled config).
  • Stage A OTLP service contract (CodeRabbit 🟠): corrected to the real vtinsert defaults — OTLP/HTTP :10481 at /insert/opentelemetry/v1/traces, gRPC only via -otlpGRPCListenAddr. Documented that ExternalName aliases DNS only (no port/path remap); apps hit the real endpoint or go through the Stage-B collector which owns the canonical 4317/4318.
  • Tail-sampling trace affinity (CodeRabbit 🟠): sampling tier runs single-replica or behind a loadbalancingexporter (routing_key: traceID); a plain Service would split a trace across replicas. Recorded in Design + Resolved.
  • Disk vs age retention / PVC exhaustion (CodeRabbit 🟠): added retentionDiskSpaceUsage (retentionMaxDiskSpaceUsagePercent) alongside retentionPeriod, a capacity alert, and a PVC-exhaustion test; failure mode now says a full PVC blocks ingest before age-based eviction.
  • Absent vs empty tracingStorages (CodeRabbit 🟠): explicit contract — absent → tracing disabled, render succeeds; tracingStorages: [] → render fails (the #3181 guard). Both covered by tests.
  • Span/RED metrics source (CodeRabbit nit): documented that Grafana only links to existing metrics; RED metrics need a Collector spanmetrics connector (Stage B) or app instrumentation — so trace↔metrics is a Stage-B capability.
  • replicaCount != HA replication (CodeRabbit nit): made replicaCount configurable and added a durability caveat — VictoriaTraces cluster mode doesn't replicate spans across storage nodes; real durability needs collector replication into independent backends (Open question).
  • Read-side tenant isolation (IvanHunters MINOR): new Grafana note + Open question + e2e assertion that tenant B can't read tenant A's spans.
  • Jaeger datasource is the unverified external claim (IvanHunters MINOR): promoted to an explicit "confirm before implementation" Open question.
  • Nits (IvanHunters): dropped the leftover <!-- Place this file… --> line; added the apps.cozystack.io/application.group managedMetadata label to the VTCluster sketch.
  • VTSingle support (Gemini / CodeRabbit): Open question now leans toward supporting both VTCluster and VTSingle (edge/dev vs prod), matching metrics/logs.

Already covered (pre-existing)

  • Cross-chart tracing.enabled with no backend (Gemini): the ExternalName resolves to nothing and the OTLP exporter drops/retries harmlessly; the toggle is documented to require a tracingStorages backend.

Everything requiring live-cluster verification (Jaeger datasource type, exact operator field names like retentionMaxDiskSpaceUsagePercent, gRPC listener config) is called out as confirm-before-implementation rather than assumed. This stays a Draft-stage design; concrete template/test work lands in the cozystack/cozystack implementation PRs.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@design-proposals/distributed-tracing/README.md`:
- Around line 123-135: The Stage A-to-Stage B migration contract uses
incompatible ports and paths that an ExternalName alone cannot translate. Update
the Stage A and Stage B endpoint descriptions and all corresponding references
to choose one stable application-facing OTLP contract, adding explicit
proxy/listener port and path mapping in both stages, or explicitly require
applications to change endpoints during promotion. Ensure the guidance is
consistent across the nearby repeated sections.
- Around line 66-67: Update the retentionDiskSpaceUsage configuration and its
related references to accept only percentage values, since rendering uses
retentionMaxDiskSpaceUsagePercent. Remove byte-value examples and documentation,
and validate or clearly constrain inputs to percent formats consistently at the
additional referenced locations.
- Around line 125-131: Update the Stage B gateway design around the otlphttp
exporter so AccountID/ProjectID are injected per request from authenticated
tenant identity, not configured as static headers. Specify a trusted per-tenant
proxy or a Collector mechanism such as headers_setter using validated request
metadata, and ensure clients cannot spoof these routing headers; retain the
tenant resource attribute for query-time labeling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: afb3914c-e395-4e33-a027-b5da1dd9a7d8

📥 Commits

Reviewing files that changed from the base of the PR and between bd75a12 and 441b472.

📒 Files selected for processing (1)
  • design-proposals/distributed-tracing/README.md

Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
Comment thread design-proposals/distributed-tracing/README.md Outdated
…act, headers_setter

- retentionDiskUsagePercent is percent-only (maps to retentionMaxDiskSpaceUsagePercent);
  drop the ambiguous bytes-or-percent field.
- Fix the Stage A->B endpoint contradiction: fix the app-facing contract to a
  port-explicit OTLP/gRPC :4317 Service (bare ExternalName can't carry port/path);
  gRPC chosen because vtinsert and collector OTLP/HTTP paths differ.
- Stage B tenant headers via headers_setter extension (from_context), not static
  otlphttp.headers which cannot derive per-tenant AccountID/ProjectID.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
@scooby87

Copy link
Copy Markdown
Author

Pushed 65f5f0c addressing the second CodeRabbit pass:

  • Percent vs bytes on the disk cap (🟠): dropped the ambiguous retentionDiskSpaceUsage (docs said %-or-bytes but the template only rendered retentionMaxDiskSpaceUsagePercent). Replaced with a percent-only retentionDiskUsagePercent field; the mutually-exclusive bytes flag is deliberately not exposed to keep the field unambiguous.
  • Stage A→B endpoint stability (🟠): fixed the contradiction — a bare ExternalName can't carry port/path. The app-facing contract is now a port-explicit OTLP/gRPC :4317 Service (otel-traces.cozy-monitoring.svc); gRPC is chosen precisely because vtinsert's OTLP/HTTP path (/insert/opentelemetry/v1/traces) differs from the collector's (/v1/traces), so only gRPC stays interchangeable across stages. Promotion re-points that Service (vtinsert→collector); OTLP/HTTP users adopt the collector from the start.
  • Static exporter headers can't do per-tenant (🟠): Stage B now injects AccountID/ProjectID via the headers_setter extension (from_context, receiver include_metadata: true, batch preserves metadata), not a static otlphttp.headers block — with a trusted per-tenant proxy as the alternative and tenants barred from setting their own routing headers.

These were all consequences of the first-pass half-fixes; the design is now internally consistent. Remaining live-cluster specifics (exact operator field/flag names, Jaeger datasource type) stay flagged as confirm-before-implementation.

Alexey Artamonov added 2 commits July 20, 2026 14:32
…ification

Blocking fixes from /branch-review, verified against the pinned operator CRD:
- VTCluster sub-spec keys are spec.insert/select/storage (prefix dropped), NOT
  vtinsert/vtselect/vtstorage; rendered workloads/services keep the vt prefix.
- Disk cap field is spec.storage.retentionMaxDiskSpaceUsageBytes (bytes); no
  percent CR field exists. values field is now retentionDiskUsageBytes (bytes);
  earlier percent-only mapping was inverted.
- Topology: monitoring installs into cozy-monitoring; ExternalName redirects live
  in cozy-monitoring and resolve to *.tenant-root.svc.cluster.local.
- Nits: storageSize values key (avoid triple-storage stutter); WorkloadMonitor
  wording tightened + redis listed; confirm-before-impl caveat lists OTLP wire
  details + service-name prefix.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
Keep the substantive points; remove the review-attribution asides so the
document reads as a standalone design rather than a review-response artifact.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
@IvanHunters

Copy link
Copy Markdown
Contributor

Verdict

LGTM with non-blocking notes

A well-researched, technically accurate design proposal for the third observability signal; verification against the actual cozystack/cozystack repo confirmed nearly every load-bearing technical claim, with three minor gaps worth fixing before implementation begins.

Findings

[MINOR] design-proposals/distributed-tracing/README.md:123-125 — the parenthetical "(query-string equivalents take priority)" for VictoriaTraces/VictoriaLogs AccountID/ProjectID tenant attribution does not match upstream documentation.

Checked against docs.victoriametrics.com/victoriatraces/#multitenancy, docs.victoriametrics.com/victorialogs/#multitenancy, and docs.victoriametrics.com/victorialogs/data-ingestion/: all three describe AccountID/ProjectID as settable only via request headers, with no query-string parameter mechanism and no precedence rule documented. The "URL takes priority over headers" rule that does exist is a VictoriaMetrics cluster (vminsert/vmselect) mechanism using URL path segments (/insert/<accountID>/...), a different product with a different mechanism (path segment, not query string). This doesn't change the proposal's core security recommendation (inject AccountID/ProjectID at a trusted boundary, never from tenant-controlled input), but the specific claim should be corrected before an implementer builds support for a tenant-override path that doesn't exist upstream.

[MINOR] design-proposals/distributed-tracing/README.md:59-71 — the tracingStorages[].storageSize values-key name diverges from the sibling convention without an inline rationale.

Verified against the real cozystack/cozystack repo: metricsStorages/logsStorages both use a field literally named storage for PVC size (packages/system/monitoring/values.yaml, and the vlogs.yaml template reads .storage). This proposal's tracingStorages entry uses storageSize instead. The rename is defensible — the vendored VTCluster CRD nests a second storage object inside spec.storage (spec.storage.storage.volumeClaimTemplate, confirmed against packages/system/victoria-metrics-operator/charts/victoria-metrics-operator/charts/crds/crds/crd.yaml), so reusing storage as the values key would read confusingly — but that rationale exists only in the PR's commit history ("avoid triple-storage stutter"), not in the document a future reader of the merged proposal will see. Per the explicit-tradeoff-surfacing principle, a naming deviation from an established sibling convention should be justified inline.

[MINOR] Security section (design-proposals/distributed-tracing/README.md:193-199) does not address Pod Security Standards for the new workloads this design introduces.

The new OTLP Collector Deployment and the new per-app sidecar/agent containers (Kafka, RabbitMQ, MariaDB, Redis, Postgres) run inside tenant-* namespaces, which enforce PSS-restricted. The Security section covers trust boundaries, RBAC, and TLS, but says nothing about non-root, dropped capabilities, or seccomp posture for these new containers — every other new-workload class in this stack is expected to state its pod-security posture up front.

Claim mismatches

[PARTIAL] PR body states Status: Draft — opening for early feedback, but the file itself states **Status:** Review (README.md:6) — the file's status is actually correct per this repo's own convention (design-proposals/template.md:9, "Draft → Review (PR opened)"); the PR-body text is just stale/inaccurate, not a defect in the proposal.

Caveats

  • Phases 5b/5c/5d (upgrade/fresh-install impact, config-toggle matrix, test-adequacy) are N/A: this PR touches only one docs file in the cozystack/community repo — no packages/, chart, migration, CRD, or values file. Stated explicitly per the mandatory-phase requirement.
  • Read-side tenant isolation on a shared VictoriaTraces backend (scoping a tenant's Grafana datasource to its own AccountID/ProjectID on vtselect) is left as an unresolved Open Question, despite the Security section asserting it "must" exist. This matches the convention of every sibling proposal in this repo currently at Review status (compute-plane, external-database-exposure, kubernetes-nodes-split, tenant-oidc-per-tenant-realm, unified-tls-pki all carry unresolved architectural forks as Open Questions), so it is process-consistent rather than a defect unique to this PR — but it is the single highest-severity unresolved item in the design (the mechanism protecting cross-tenant trace confidentiality on the shared backend is not yet specified) and should be closed out per this repo's own guidance ("Close these out ... before the proposal is accepted," design-proposals/README.md).
  • Extensive spot-verification against the real cozystack/cozystack repo (local clone, commit 5d13c15d6) confirmed the proposal's other load-bearing technical claims are accurate: victoria-metrics-operator appVersion: v0.68.4 (Chart.yaml), the vlogs.yaml #3181 empty-list guard (near-verbatim match in wording), foundationdb's monitoring.enabled toggle (values.yaml:137), the cozy-monitoring/tenant-root ExternalName topology (monitoring-external-services.yaml), the extra/monitoring HelmRelease waitStrategy: poller + healthCheckExprs on status.updateStatus (helmrelease.yaml), Harbor's jaeger/otel trace-provider config (harbor chart values.yaml:447-471), and the VTCluster CRD's spec.insert/spec.select/spec.storage key names plus the nested spec.storage.retentionMaxDiskSpaceUsageBytes/retentionPeriod fields (vendored CRD) — all present exactly as described.
  • The OTLP wire-protocol details (vtinsert HTTP :10481 + /insert/opentelemetry/v1/traces path, -otlpGRPCListenAddr flag, rendered service-name prefixes) were not independently re-verified beyond what the proposal itself already labels "Confirm-before-implementation... taken on upstream faith" — no further action needed there beyond what the author already flagged.

Recommended follow-ups

  • Once unified-tls-pki reaches Accepted status, cross-link this proposal from its "Scope and related proposals" consumer list (it currently lists external-database-exposure and structured-external-exposure as consumers of the TLS/PKI contract; this proposal references it one-way from its Security section but isn't listed there as a consumer).
  • Before Stage A implementation, confirm the Grafana datasource type (type: jaeger vs. a dedicated VictoriaTraces plugin) against the actual pinned grafana-operator/Grafana plugin catalog — already flagged as an open item, but it determines the whole trace-correlation UX.

Alexey Artamonov added 2 commits July 20, 2026 19:26
…ence

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
…x ExternalName wording

- Resolve read-side tenant isolation open question: structural isolation
  (isolated per-tenant stack + same-namespace vtselect datasource +
  NetworkPolicy, account 0), matching logs/metrics; vtselect has no authz
  so a datasource header pin is routing, not a security boundary; shared
  backend needs vmauth (deferred). Reconcile Grafana + Security sections.
- Resolve VTCluster-vs-VTSingle: per-entry mode: cluster|single (default cluster).
- Fix contradiction on the no-backend failure mode: Service has no backing
  endpoints, not 'ExternalName resolves to nothing' (design uses a
  port-explicit Service, not a bare ExternalName).
- Soften the vtinsert-* service-name prefix to confirm-before-implementation.
- Align write-path AccountID/ProjectID framing with the current account-0 + tenant-label convention.
- Add revised-date suffix.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants