Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(blob-export): replace internal exportSource enum with public LEGACY_TRACES_OBSERVATIONS/OBSERVATIONS_V2/LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS (#13619)

Niklas Semmler4ae71e59be0b
diff --git a/fern/apis/server/definition/blob-storage-integrations.yml b/fern/apis/server/definition/blob-storage-integrations.yml
index b5ac84cd02..672a5c09a9 100644
--- a/fern/apis/server/definition/blob-storage-integrations.yml
+++ b/fern/apis/server/definition/blob-storage-integrations.yml
@@ -64,18 +64,18 @@ types:
BlobStorageExportSource:
docs: |
What data the integration exports.
- - `TRACES_OBSERVATIONS`: legacy traces + observations + scores tables with a fixed column set. The `exportFieldGroups` field is not applicable.
- - `EVENTS`: enriched observations_v2 events; columns are controlled by `exportFieldGroups`.
- - `TRACES_OBSERVATIONS_EVENTS`: both sets. For the `EVENTS` portion, columns are controlled by `exportFieldGroups`.
+ - `LEGACY_TRACES_OBSERVATIONS`: traces, observations, and scores tables with a fixed column set. The `exportFieldGroups` field is not applicable.
+ - `OBSERVATIONS_V2`: same data model as the `/api/public/v2/observations` endpoint, plus scores. Columns are controlled by `exportFieldGroups`.
+ - `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: both sets. For the `OBSERVATIONS_V2` portion, columns are controlled by `exportFieldGroups`.
- **Note:** `EVENTS` and the events portion of `TRACES_OBSERVATIONS_EVENTS` rely on the observations_v2 events table (Langfuse Fast Preview / v4), which is currently available on Langfuse Cloud only. See https://langfuse.com/docs/v4.
+ **Note:** `OBSERVATIONS_V2` and the enriched-observations portion of `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` rely on the enriched observations table (Langfuse Fast Preview / v4), which is currently available on Langfuse Cloud only. See https://langfuse.com/docs/v4.
enum:
- - EVENTS
- - TRACES_OBSERVATIONS
- - TRACES_OBSERVATIONS_EVENTS
+ - LEGACY_TRACES_OBSERVATIONS
+ - OBSERVATIONS_V2
+ - LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS
BlobStorageExportFieldGroup:
- docs: Field group for the EVENTS export.
+ docs: Field group for the OBSERVATIONS_V2 and LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS export.
enum:
- core
- basic
@@ -131,16 +131,16 @@ types:
exportSource:
type: optional<BlobStorageExportSource>
docs: |
- Data to export. When omitted on update, the existing value is preserved; when omitted on create, the column default (`TRACES_OBSERVATIONS`) applies. Required when `exportFieldGroups` is provided.
+ Data to export. When omitted on update, the existing value is preserved; when omitted on create, the column default (`LEGACY_TRACES_OBSERVATIONS`) applies. Required when `exportFieldGroups` is provided.
exportFieldGroups:
type: optional<list<BlobStorageExportFieldGroup>>
docs: |
Field groups to include in each exported row.
- For exportSource `EVENTS` or `TRACES_OBSERVATIONS_EVENTS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.
+ For exportSource `OBSERVATIONS_V2` or `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if provided. When omitted on create, the column default (all groups) applies. When omitted on update, the existing value is preserved.
- For exportSource `TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
+ For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be omitted or null. Sending an array (including an empty array) returns 400, because that source uses a fixed column set and does not honor field groups.
`exportFieldGroups` requires `exportSource` to be provided in the same request.
@@ -165,7 +165,7 @@ types:
exportFieldGroups:
type: nullable<list<BlobStorageExportFieldGroup>>
docs: |
- Field groups included in each exported row for `EVENTS` / `TRACES_OBSERVATIONS_EVENTS` sources. Always `null` when exportSource is `TRACES_OBSERVATIONS` (the field does not apply to that source; any legacy DB value is hidden from the public surface).
+ Field groups included in each exported row for `OBSERVATIONS_V2` / `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` sources. Always `null` when exportSource is `LEGACY_TRACES_OBSERVATIONS` (the field does not apply to that source; any legacy DB value is hidden from the public surface).
nextSyncAt: nullable<datetime>
lastSyncAt: nullable<datetime>
lastError: nullable<string>
diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.yml
index be664ee9a0..94b97247c0 100644
--- a/web/public/generated/api/openapi.yml
+++ b/web/public/generated/api/openapi.yml
@@ -7252,27 +7252,29 @@ components:
title: BlobStorageExportSource
type: string
enum:
- - EVENTS
- - TRACES_OBSERVATIONS
- - TRACES_OBSERVATIONS_EVENTS
+ - LEGACY_TRACES_OBSERVATIONS
+ - OBSERVATIONS_V2
+ - LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS
description: >-
What data the integration exports.
- - `TRACES_OBSERVATIONS`: legacy traces + observations + scores tables
+ - `LEGACY_TRACES_OBSERVATIONS`: traces, observations, and scores tables
with a fixed column set. The `exportFieldGroups` field is not
applicable.
- - `EVENTS`: enriched observations_v2 events; columns are controlled by
- `exportFieldGroups`.
+ - `OBSERVATIONS_V2`: same data model as the
+ `/api/public/v2/observations` endpoint, plus scores. Columns are
+ controlled by `exportFieldGroups`.
- - `TRACES_OBSERVATIONS_EVENTS`: both sets. For the `EVENTS` portion,
- columns are controlled by `exportFieldGroups`.
+ - `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: both sets. For the
+ `OBSERVATIONS_V2` portion, columns are controlled by
+ `exportFieldGroups`.
- **Note:** `EVENTS` and the events portion of
- `TRACES_OBSERVATIONS_EVENTS` rely on the observations_v2 events table
- (Langfuse Fast Preview / v4), which is currently available on Langfuse
- Cloud only. See https://langfuse.com/docs/v4.
+ **Note:** `OBSERVATIONS_V2` and the enriched-observations portion of
+ `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` rely on the enriched
+ observations table (Langfuse Fast Preview / v4), which is currently
+ available on Langfuse Cloud only. See https://langfuse.com/docs/v4.
BlobStorageExportFieldGroup:
title: BlobStorageExportFieldGroup
type: string
@@ -7288,7 +7290,9 @@ components:
- metrics
- tools
- trace_context
- description: Field group for the EVENTS export.
+ description: >-
+ Field group for the OBSERVATIONS_V2 and
+ LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS export.
CreateBlobStorageIntegrationRequest:
title: CreateBlobStorageIntegrationRequest
type: object
@@ -7357,8 +7361,8 @@ components:
description: >-
Data to export. When omitted on update, the existing value is
preserved; when omitted on create, the column default
- (`TRACES_OBSERVATIONS`) applies. Required when `exportFieldGroups`
- is provided.
+ (`LEGACY_TRACES_OBSERVATIONS`) applies. Required when
+ `exportFieldGroups` is provided.
exportFieldGroups:
type: array
items:
@@ -7368,16 +7372,16 @@ components:
Field groups to include in each exported row.
- For exportSource `EVENTS` or `TRACES_OBSERVATIONS_EVENTS`: must
- include `core` if provided. When omitted on create, the column
- default (all groups) applies. When omitted on update, the existing
- value is preserved.
+ For exportSource `OBSERVATIONS_V2` or
+ `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS`: must include `core` if
+ provided. When omitted on create, the column default (all groups)
+ applies. When omitted on update, the existing value is preserved.
- For exportSource `TRACES_OBSERVATIONS`: this field must be omitted
- or null. Sending an array (including an empty array) returns 400,
- because that source uses a fixed column set and does not honor field
- groups.
+ For exportSource `LEGACY_TRACES_OBSERVATIONS`: this field must be
+ omitted or null. Sending an array (including an empty array) returns
+ 400, because that source uses a fixed column set and does not honor
+ field groups.
`exportFieldGroups` requires `exportSource` to be provided in the
@@ -7438,10 +7442,11 @@ components:
$ref: '#/components/schemas/BlobStorageExportFieldGroup'
nullable: true
description: >-
- Field groups included in each exported row for `EVENTS` /
- `TRACES_OBSERVATIONS_EVENTS` sources. Always `null` when
- exportSource is `TRACES_OBSERVATIONS` (the field does not apply to
- that source; any legacy DB value is hidden from the public surface).
+ Field groups included in each exported row for `OBSERVATIONS_V2` /
+ `LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS` sources. Always `null`
+ when exportSource is `LEGACY_TRACES_OBSERVATIONS` (the field does
+ not apply to that source; any legacy DB value is hidden from the
+ public surface).
nextSyncAt:
type: string
format: date-time
diff --git a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts b/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
index a15a5a240a..244a484b4b 100644
--- a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
+++ b/web/src/__tests__/server/blob-storage-integration-api.servertest.ts
@@ -30,9 +30,9 @@ const BlobStorageIntegrationResponseSchema = z.object({
exportStartDate: z.coerce.date().nullable(),
compressed: z.boolean(),
exportSource: z.enum([
- "TRACES_OBSERVATIONS",
- "TRACES_OBSERVATIONS_EVENTS",
- "EVENTS",
+ "LEGACY_TRACES_OBSERVATIONS",
+ "OBSERVATIONS_V2",
+ "LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS",
]),
exportFieldGroups: z.array(z.enum(BLOB_EXPORT_FIELD_GROUPS)).nullable(),
nextSyncAt: z.coerce.date().nullable(),
@@ -636,13 +636,13 @@ describe("Blob Storage Integrations API", () => {
});
});
- // ---- EVENTS / TRACES_OBSERVATIONS_EVENTS path ----
+ // ---- OBSERVATIONS_V2 / LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS path ----
- it("EVENTS + exportFieldGroups=[core,io] -> 200 and GET returns same value", async () => {
+ it("OBSERVATIONS_V2 + exportFieldGroups=[core,io] -> 200 and GET returns same value", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "EVENTS" as const,
+ exportSource: "OBSERVATIONS_V2" as const,
exportFieldGroups: ["core", "io"],
};
@@ -654,7 +654,7 @@ describe("Blob Storage Integrations API", () => {
createBasicAuthHeader(testApiKey, testApiSecretKey),
);
expect(putResponse.status).toBe(200);
- expect(putResponse.body.exportSource).toBe("EVENTS");
+ expect(putResponse.body.exportSource).toBe("OBSERVATIONS_V2");
expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);
const getResponse = await makeZodVerifiedAPICall(
@@ -669,15 +669,15 @@ describe("Blob Storage Integrations API", () => {
(i) => i.projectId === testProject1Id,
);
expect(integration).toBeDefined();
- expect(integration?.exportSource).toBe("EVENTS");
+ expect(integration?.exportSource).toBe("OBSERVATIONS_V2");
expect(integration?.exportFieldGroups).toStrictEqual(["core", "io"]);
});
- it("EVENTS + exportFieldGroups=[io] (missing core) -> 400", async () => {
+ it("OBSERVATIONS_V2 + exportFieldGroups=[io] (missing core) -> 400", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "EVENTS" as const,
+ exportSource: "OBSERVATIONS_V2" as const,
exportFieldGroups: ["io"],
};
@@ -690,11 +690,11 @@ describe("Blob Storage Integrations API", () => {
expect(result.status).toBe(400);
});
- it("EVENTS + exportFieldGroups omitted -> 200 and GET returns all 11 groups", async () => {
+ it("OBSERVATIONS_V2 + exportFieldGroups omitted -> 200 and GET returns all 11 groups", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "EVENTS" as const,
+ exportSource: "OBSERVATIONS_V2" as const,
};
const putResponse = await makeZodVerifiedAPICall(
@@ -718,7 +718,7 @@ describe("Blob Storage Integrations API", () => {
(i) => i.projectId === testProject1Id,
);
expect(integration).toBeDefined();
- expect(integration?.exportSource).toBe("EVENTS");
+ expect(integration?.exportSource).toBe("OBSERVATIONS_V2");
expect(integration?.exportFieldGroups).toBeDefined();
expect(integration?.exportFieldGroups).toHaveLength(
BLOB_EXPORT_FIELD_GROUPS.length,
@@ -728,11 +728,11 @@ describe("Blob Storage Integrations API", () => {
);
});
- it("EVENTS + exportFieldGroups=null -> 200 and GET returns all 11 groups", async () => {
+ it("OBSERVATIONS_V2 + exportFieldGroups=null -> 200 and GET returns all 11 groups", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "EVENTS" as const,
+ exportSource: "OBSERVATIONS_V2" as const,
exportFieldGroups: null,
};
@@ -766,13 +766,13 @@ describe("Blob Storage Integrations API", () => {
);
});
- // ---- TRACES_OBSERVATIONS path ----
+ // ---- LEGACY_TRACES_OBSERVATIONS path ----
- it("TRACES_OBSERVATIONS + exportFieldGroups omitted -> 200; GET hides field groups", async () => {
+ it("LEGACY_TRACES_OBSERVATIONS + exportFieldGroups omitted -> 200; GET hides field groups", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
};
const putResponse = await makeZodVerifiedAPICall(
@@ -796,15 +796,15 @@ describe("Blob Storage Integrations API", () => {
(i) => i.projectId === testProject1Id,
);
expect(integration).toBeDefined();
- expect(integration?.exportSource).toBe("TRACES_OBSERVATIONS");
+ expect(integration?.exportSource).toBe("LEGACY_TRACES_OBSERVATIONS");
expect(integration?.exportFieldGroups).toBeNull();
});
- it("TRACES_OBSERVATIONS + exportFieldGroups=null -> 200; GET hides field groups", async () => {
+ it("LEGACY_TRACES_OBSERVATIONS + exportFieldGroups=null -> 200; GET hides field groups", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
exportFieldGroups: null,
};
@@ -832,11 +832,11 @@ describe("Blob Storage Integrations API", () => {
expect(integration?.exportFieldGroups).toBeNull();
});
- it("TRACES_OBSERVATIONS + exportFieldGroups=[] -> 400 with 'not applicable'", async () => {
+ it("LEGACY_TRACES_OBSERVATIONS + exportFieldGroups=[] -> 400 with 'not applicable'", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
exportFieldGroups: [],
};
@@ -851,11 +851,11 @@ describe("Blob Storage Integrations API", () => {
expect(message.toLowerCase()).toContain("not applicable");
});
- it("TRACES_OBSERVATIONS + exportFieldGroups=[core,io] -> 400 with 'not applicable'", async () => {
+ it("LEGACY_TRACES_OBSERVATIONS + exportFieldGroups=[core,io] -> 400 with 'not applicable'", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
exportFieldGroups: ["core", "io"],
};
@@ -870,7 +870,7 @@ describe("Blob Storage Integrations API", () => {
expect(message.toLowerCase()).toContain("not applicable");
});
- it("GET hides exportFieldGroups for legacy TRACES_OBSERVATIONS rows seeded via Prisma", async () => {
+ it("GET hides exportFieldGroups for legacy LEGACY_TRACES_OBSERVATIONS rows seeded via Prisma", async () => {
await prisma.blobStorageIntegration.create({
data: {
projectId: testProject1Id,
@@ -903,11 +903,11 @@ describe("Blob Storage Integrations API", () => {
(i) => i.projectId === testProject1Id,
);
expect(integration).toBeDefined();
- expect(integration?.exportSource).toBe("TRACES_OBSERVATIONS");
+ expect(integration?.exportSource).toBe("LEGACY_TRACES_OBSERVATIONS");
expect(integration?.exportFieldGroups).toBeNull();
});
- it("PUT TRACES_OBSERVATIONS preserves existing export_field_groups column in DB", async () => {
+ it("PUT LEGACY_TRACES_OBSERVATIONS preserves existing export_field_groups column in DB", async () => {
// Seed with a custom subset
await prisma.blobStorageIntegration.create({
data: {
@@ -935,7 +935,7 @@ describe("Blob Storage Integrations API", () => {
{
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
bucketName: "updated-bucket",
},
createBasicAuthHeader(testApiKey, testApiSecretKey),
@@ -951,11 +951,11 @@ describe("Blob Storage Integrations API", () => {
// ---- Response shape ----
- it("PUT response includes exportSource and exportFieldGroups (null for TRACES_OBSERVATIONS)", async () => {
+ it("PUT response includes exportSource and exportFieldGroups (null for LEGACY_TRACES_OBSERVATIONS)", async () => {
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "TRACES_OBSERVATIONS" as const,
+ exportSource: "LEGACY_TRACES_OBSERVATIONS" as const,
};
const response = await makeZodVerifiedAPICall(
@@ -968,7 +968,7 @@ describe("Blob Storage Integrations API", () => {
expect(response.status).toBe(200);
expect(response.body).toHaveProperty(
"exportSource",
- "TRACES_OBSERVATIONS",
+ "LEGACY_TRACES_OBSERVATIONS",
);
expect(response.body).toHaveProperty("exportFieldGroups");
expect(response.body.exportFieldGroups).toBeNull();
@@ -1022,23 +1022,75 @@ describe("Blob Storage Integrations API", () => {
200,
);
- const tracesObsIntegration = getResponse.body.data.find(
+ const legacyIntegration = getResponse.body.data.find(
(i) => i.projectId === testProject1Id,
);
- const eventsIntegration = getResponse.body.data.find(
+ const enrichedIntegration = getResponse.body.data.find(
(i) => i.projectId === testProject2Id,
);
- expect(tracesObsIntegration?.exportSource).toBe("TRACES_OBSERVATIONS");
- expect(tracesObsIntegration?.exportFieldGroups).toBeNull();
- expect(eventsIntegration?.exportSource).toBe("EVENTS");
- expect(eventsIntegration?.exportFieldGroups).toStrictEqual([
+ expect(legacyIntegration?.exportSource).toBe(
+ "LEGACY_TRACES_OBSERVATIONS",
+ );
+ expect(legacyIntegration?.exportFieldGroups).toBeNull();
+ expect(enrichedIntegration?.exportSource).toBe("OBSERVATIONS_V2");
+ expect(enrichedIntegration?.exportFieldGroups).toStrictEqual([
+ "core",
+ "io",
+ ]);
+ });
+
+ it("GET response maps internal TRACES_OBSERVATIONS_EVENTS to public LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS", async () => {
+ // Seed via Prisma with the third internal enum value to exercise the
+ // mapping for LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS through the public REST surface.
+ // satisfies-enforced exhaustiveness in INTERNAL_TO_PUBLIC_EXPORT_SOURCE
+ // catches a missing key at compile time, but only a runtime assertion
+ // catches a copy-paste regression (e.g. "OBSERVATIONS_V2" written twice).
+ await prisma.blobStorageIntegration.create({
+ data: {
+ projectId: testProject1Id,
+ type: "S3",
+ bucketName: "bucket-mixed",
+ region: "us-east-1",
+ accessKeyId: "key",
+ secretAccessKey: "secret",
+ prefix: "",
+ exportFrequency: "daily",
+ enabled: true,
+ forcePathStyle: false,
+ fileType: "JSONL",
+ exportMode: "FULL_HISTORY",
+ exportSource: "TRACES_OBSERVATIONS_EVENTS",
+ exportFieldGroups: ["core", "io", "metadata"],
+ },
+ });
+
+ const getResponse = await makeZodVerifiedAPICall(
+ z.object({ data: z.array(BlobStorageIntegrationResponseSchema) }),
+ "GET",
+ "/api/public/integrations/blob-storage",
+ undefined,
+ createBasicAuthHeader(testApiKey, testApiSecretKey),
+ 200,
+ );
+
+ const integration = getResponse.body.data.find(
+ (i) => i.projectId === testProject1Id,
+ );
+ expect(integration).toBeDefined();
+ expect(integration?.exportSource).toBe(
+ "LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS",
+ );
+ // exportFieldGroups is only masked to null for LEGACY_TRACES_OBSERVATIONS — the
+ // LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS source returns the raw DB array.
+ expect(integration?.exportFieldGroups).toStrictEqual([
"core",
"io",
+ "metadata",
]);
});
- it("PUT without exportSource preserves existing EVENTS source and field groups", async () => {
- // Pre-seed an EVENTS row with a custom field-group subset
+ it("PUT without exportSource preserves existing OBSERVATIONS_V2 source and field groups", async () => {
+ // Pre-seed an OBSERVATIONS_V2 row with a custom field-group subset
await prisma.blobStorageIntegration.create({
data: {
projectId: testProject1Id,
@@ -1072,7 +1124,7 @@ describe("Blob Storage Integrations API", () => {
createBasicAuthHeader(testApiKey, testApiSecretKey),
);
expect(putResponse.status).toBe(200);
- expect(putResponse.body.exportSource).toBe("EVENTS");
+ expect(putResponse.body.exportSource).toBe("OBSERVATIONS_V2");
expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);
// DB row preserved on both columns; bucket updated
@@ -1084,8 +1136,8 @@ describe("Blob Storage Integrations API", () => {
expect(saved?.bucketName).toBe("updated-bucket");
});
- it("PUT exportSource=null preserves existing EVENTS source and field groups", async () => {
- // Pre-seed an EVENTS row with a custom field-group subset
+ it("PUT exportSource=null preserves existing OBSERVATIONS_V2 source and field groups", async () => {
+ // Pre-seed an OBSERVATIONS_V2 row with a custom field-group subset
await prisma.blobStorageIntegration.create({
data: {
projectId: testProject1Id,
@@ -1121,7 +1173,7 @@ describe("Blob Storage Integrations API", () => {
createBasicAuthHeader(testApiKey, testApiSecretKey),
);
expect(putResponse.status).toBe(200);
- expect(putResponse.body.exportSource).toBe("EVENTS");
+ expect(putResponse.body.exportSource).toBe("OBSERVATIONS_V2");
expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);
const saved = await prisma.blobStorageIntegration.findUnique({
@@ -1131,8 +1183,8 @@ describe("Blob Storage Integrations API", () => {
expect(saved?.exportFieldGroups).toStrictEqual(["core", "io"]);
});
- it("PUT exportSource=EVENTS without exportFieldGroups on existing EVENTS row preserves field groups", async () => {
- // Pre-seed an EVENTS row with a custom field-group subset
+ it("PUT exportSource=OBSERVATIONS_V2 without exportFieldGroups on existing OBSERVATIONS_V2 row preserves field groups", async () => {
+ // Pre-seed an OBSERVATIONS_V2 row with a custom field-group subset
await prisma.blobStorageIntegration.create({
data: {
projectId: testProject1Id,
@@ -1152,11 +1204,11 @@ describe("Blob Storage Integrations API", () => {
},
});
- // PUT with explicit exportSource=EVENTS but exportFieldGroups omitted
+ // PUT with explicit exportSource=OBSERVATIONS_V2 but exportFieldGroups omitted
const requestBody = {
...validBlobStorageConfig,
projectId: testProject1Id,
- exportSource: "EVENTS" as const,
+ exportSource: "OBSERVATIONS_V2" as const,
bucketName: "updated-bucket",
};
const putResponse = await makeZodVerifiedAPICall(
@@ -1167,7 +1219,7 @@ describe("Blob Storage Integrations API", () => {
createBasicAuthHeader(testApiKey, testApiSecretKey),
);
expect(putResponse.status).toBe(200);
- expect(putResponse.body.exportSource).toBe("EVENTS");
+ expect(putResponse.body.exportSource).toBe("OBSERVATIONS_V2");
expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);
const saved = await prisma.blobStorageIntegration.findUnique({
diff --git a/web/src/features/public-api/types/blob-storage-integrations.ts b/web/src/features/public-api/types/blob-storage-integrations.ts
index 56de7c635c..bc0f790217 100644
--- a/web/src/features/public-api/types/blob-storage-integrations.ts
+++ b/web/src/features/public-api/types/blob-storage-integrations.ts
@@ -26,7 +26,50 @@ export const BlobStorageExportMode = z.enum([
"FROM_CUSTOM_DATE",
]);
-export const BlobStorageExportSource = z.enum(AnalyticsIntegrationExportSource);
+/**
+ * Public REST enum for the blob-storage export source. Intentionally distinct
+ * from the internal `AnalyticsIntegrationExportSource` (Prisma): names here
+ * mirror the labels users see in the UI rather than the legacy internal
+ * identifiers. Maps to the internal enum via `toInternalExportSource` /
+ * `toPublicExportSource`.
+ */
+export const BlobStorageExportSource = z.enum([
+ "LEGACY_TRACES_OBSERVATIONS",
+ "OBSERVATIONS_V2",
+ "LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS",
+]);
+
+const PUBLIC_TO_INTERNAL_EXPORT_SOURCE = {
+ LEGACY_TRACES_OBSERVATIONS:
+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS,
+ OBSERVATIONS_V2: AnalyticsIntegrationExportSource.EVENTS,
+ LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS:
+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS,
+} as const satisfies Record<
+ z.infer<typeof BlobStorageExportSource>,
+ AnalyticsIntegrationExportSource
+>;
+
+const INTERNAL_TO_PUBLIC_EXPORT_SOURCE = {
+ [AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS]:
+ "LEGACY_TRACES_OBSERVATIONS",
+ [AnalyticsIntegrationExportSource.EVENTS]: "OBSERVATIONS_V2",
+ [AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS_EVENTS]:
+ "LEGACY_TRACES_AND_ENRICHED_OBSERVATIONS",
+} as const satisfies Record<
+ AnalyticsIntegrationExportSource,
+ z.infer<typeof BlobStorageExportSource>
+>;
+
+export const toInternalExportSource = (
+ publicValue: z.infer<typeof BlobStorageExportSource>,
+): AnalyticsIntegrationExportSource =>
+ PUBLIC_TO_INTERNAL_EXPORT_SOURCE[publicValue];
+
+export const toPublicExportSource = (
+ internalValue: AnalyticsIntegrationExportSource,
+): z.infer<typeof BlobStorageExportSource> =>
+ INTERNAL_TO_PUBLIC_EXPORT_SOURCE[internalValue];
export const BlobStorageExportFieldGroup = z.enum(BLOB_EXPORT_FIELD_GROUPS);
@@ -86,14 +129,13 @@ export const CreateBlobStorageIntegrationRequest = z
return;
}
if (
- data.exportSource ===
- AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS &&
+ data.exportSource === "LEGACY_TRACES_OBSERVATIONS" &&
data.exportFieldGroups != null
) {
ctx.addIssue({
code: "custom",
message:
- "exportFieldGroups is not applicable when exportSource is TRACES_OBSERVATIONS",
+ "exportFieldGroups is not applicable when exportSource is LEGACY_TRACES_OBSERVATIONS",
path: ["exportFieldGroups"],
});
return;
@@ -101,7 +143,7 @@ export const CreateBlobStorageIntegrationRequest = z
if (data.exportFieldGroups != null && data.exportSource != null) {
validateExportFieldGroups(
{
- exportSource: data.exportSource,
+ exportSource: toInternalExportSource(data.exportSource),
exportFieldGroups: data.exportFieldGroups,
},
ctx,
diff --git a/web/src/pages/api/public/integrations/blob-storage/index.ts b/web/src/pages/api/public/integrations/blob-storage/index.ts
index 96314c8f87..a5f05ae414 100644
--- a/web/src/pages/api/public/integrations/blob-storage/index.ts
+++ b/web/src/pages/api/public/integrations/blob-storage/index.ts
@@ -6,6 +6,8 @@ import { type NextApiRequest, type NextApiResponse } from "next";
import { hasEntitlementBasedOnPlan } from "@/src/features/entitlements/server/hasEntitlement";
import {
CreateBlobStorageIntegrationRequest,
+ toInternalExportSource,
+ toPublicExportSource,
type BlobStorageIntegrationResponseType,
} from "@/src/features/public-api/types/blob-storage-integrations";
import {
@@ -89,7 +91,7 @@ async function handleGetBlobStorageIntegrations(
exportMode: integration.exportMode,
exportStartDate: integration.exportStartDate,
compressed: integration.compressed,
- exportSource: integration.exportSource,
+ exportSource: toPublicExportSource(integration.exportSource),
exportFieldGroups:
integration.exportSource ===
AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS
@@ -182,7 +184,10 @@ async function handleUpsertBlobStorageIntegration(
exportMode: validatedData.exportMode,
exportStartDate: validatedData.exportStartDate ?? null,
compressed: validatedData.compressed,
- exportSource: validatedData.exportSource ?? undefined,
+ exportSource:
+ validatedData.exportSource != null
+ ? toInternalExportSource(validatedData.exportSource)
+ : undefined,
exportFieldGroups: validatedData.exportFieldGroups ?? undefined,
},
});
@@ -204,7 +209,7 @@ async function handleUpsertBlobStorageIntegration(
exportMode: integration.exportMode,
exportStartDate: integration.exportStartDate,
compressed: integration.compressed,
- exportSource: integration.exportSource,
+ exportSource: toPublicExportSource(integration.exportSource),
exportFieldGroups:
integration.exportSource ===
AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS