Skip to main content

E-11 Data Lineage

Brick E: Data, RAG, context, memory. French version: E-11-data-lineage

1. Role and responsibilities​

Tracks data origin and transformations (source -> document -> chunk -> answer) as OpenLineage events.

  • OpenLineage event ingestion
  • Queryable graph
  • Link with runs and audit

2. Position in the architecture and interactions​

  • Callers: Connector Hub, Document Processing, RAG, runs.
  • Execution path: Asynchronous (events).
  • Every interaction goes through the Control Plane API v1 (/v1) behind the API Gateway (D-14).

3. Open source component and developed part​

  • Open source: OpenLineage (Marquez optionnel)
  • Developed: Internal graph service.
  • External integration through an adapter eai/integrations/<system>.py with an in-process fallback when the URL is not configured.

4. Data model​

Tables (schema eai, tenant_id RLS):

  • eai.lineage_events

Common columns: id uuid, tenant_id uuid NOT NULL, created_at, updated_at; RLS policy current_setting('app.tenant_id', true)::uuid.

5. Contract​

  • Applied contract: OpenLineage RunEvent
  • Key fields: eventType, run, job, inputs, outputs
  • Validation: POST /v1/contracts/{name}/validate; manifest apply: POST /v1/manifests/apply.

6. API endpoints​

  • POST /v1/lineage/events
  • GET /v1/lineage/graph
  • GET /v1/lineage/datasets/{id}

Request POST /v1/lineage/events:

{
"eventType": "COMPLETE",
"eventTime": "2025-01-10T10:00:00Z",
"run": {
"runId": "run_01J9"
},
"job": {
"namespace": "eai",
"name": "kb_support.ingest"
},
"inputs": [
{
"namespace": "salesforce",
"name": "Case"
}
],
"outputs": [
{
"namespace": "eai",
"name": "kb_support"
}
]
}

Response:

{
"accepted": true,
"id": "lin_301"
}

7. SDK examples​

Python:

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_xxx_secret")
client.privacy.lineage_event(event)
g = client.privacy.lineage_graph(node="kb_support")

TypeScript:

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY });
await client.lineage.emit(event);

Java:

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.build();
client.lineage().emit(event);

Go:

c, _ := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")))
c.Lineage.Emit(ctx, event)

8. Configuration​

  • Environment variables: EAI_DATABASE_URL
  • Helm values keys: controlPlane.config, controlPlane.secrets

9. Security controls​

  • Read restricted to auditor / security_officer / developer
  • Every request carries the tenant resolved from the credential; PostgreSQL RLS
  • Every mutation and policy decision writes a hash-chained audit event

10. Observability​

  • Prometheus metrics: eai_lineage_events_total
  • Traces: OpenTelemetry spans with GenAI semantic conventions (gen_ai.operation.name, gen_ai.agent.id, gen_ai.tool.name), attributes eai.tenant_id, eai.run_id, traceparent propagation.
  • Audit actions: lineage.ingest

11. FinOps units​

  • Stored events.
  • Emitted as Usage Event (POST /v1/finops/usage) with tenant, project, agent and run.

12. Failure modes and resilience​

  • Events idempotent by (runId, eventType)
  • Normalized errors (error envelope, message_i18n en/fr)

13. Standalone adoption (client of a client)​

  • enterprise_ai.privacy + Control Plane.
  • SDK: enterprise_ai.privacy / dlp / knowledge_bases / memory / retention / lineage
  • Minimal deployment: Helm chart with controlPlane.enabled=true and PostgreSQL; disabled external components use their in-process fallback.

14. Acceptance tests​

  1. Graph links source -> knowledge base
  2. Cross-tenant access refused
  3. Error returned in fr with Accept-Language: fr

Governed RAG (kit L4)​

Ingestion emits an OpenLineage event source to versioned document (with the chunks); a query emits versioned document to answer (answer/<run_id>). Queryable through GET /v1/lineage/graph.