🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(blob-export): expose exportSource and exportFieldGroups in public REST API (#13598)
Niklas Semmler65311ce6284d
diff --git a/fern/apis/server/definition/blob-storage-integrations.yml b/fern/apis/server/definition/blob-storage-integrations.ymlindex 33c844f53f..b5ac84cd02 100644--- a/fern/apis/server/definition/blob-storage-integrations.yml+++ b/fern/apis/server/definition/blob-storage-integrations.yml@@ -61,6 +61,34 @@ types:- daily- weekly+ 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`.++ **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.+ enum:+ - EVENTS+ - TRACES_OBSERVATIONS+ - TRACES_OBSERVATIONS_EVENTS++ BlobStorageExportFieldGroup:+ docs: Field group for the EVENTS export.+ enum:+ - core+ - basic+ - time+ - io+ - metadata+ - model+ - usage+ - prompt+ - metrics+ - tools+ - trace_context+CreateBlobStorageIntegrationRequest:properties:projectId:@@ -100,6 +128,21 @@ types:compressed:type: optional<boolean>docs: Enable gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz). Defaults to true.+ 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.++ 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 `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.BlobStorageIntegrationResponse:properties:@@ -118,6 +161,11 @@ types:exportMode: BlobStorageExportModeexportStartDate: nullable<datetime>compressed: boolean+ exportSource: BlobStorageExportSource+ 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).nextSyncAt: nullable<datetime>lastSyncAt: nullable<datetime>lastError: nullable<string>diff --git a/web/public/generated/api/openapi.yml b/web/public/generated/api/openapi.ymlindex a9a5356275..be664ee9a0 100644--- a/web/public/generated/api/openapi.yml+++ b/web/public/generated/api/openapi.yml@@ -7244,9 +7244,51 @@ components:title: BlobStorageExportFrequencytype: stringenum:+ - every_20_minutes- hourly- daily- weekly+ BlobStorageExportSource:+ title: BlobStorageExportSource+ type: string+ enum:+ - EVENTS+ - TRACES_OBSERVATIONS+ - TRACES_OBSERVATIONS_EVENTS+ description: >-+ 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`.+++ **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.+ BlobStorageExportFieldGroup:+ title: BlobStorageExportFieldGroup+ type: string+ enum:+ - core+ - basic+ - time+ - io+ - metadata+ - model+ - usage+ - prompt+ - metrics+ - tools+ - trace_context+ description: Field group for the EVENTS export.CreateBlobStorageIntegrationRequest:title: CreateBlobStorageIntegrationRequesttype: object@@ -7309,6 +7351,37 @@ components:description: >-Enable gzip compression for exported files (.csv.gz, .json.gz,.jsonl.gz). Defaults to true.+ exportSource:+ $ref: '#/components/schemas/BlobStorageExportSource'+ nullable: true+ 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.+ exportFieldGroups:+ type: array+ items:+ $ref: '#/components/schemas/BlobStorageExportFieldGroup'+ nullable: true+ description: >-+ 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 `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.required:- projectId- type@@ -7357,6 +7430,18 @@ components:nullable: truecompressed:type: boolean+ exportSource:+ $ref: '#/components/schemas/BlobStorageExportSource'+ exportFieldGroups:+ type: array+ items:+ $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).nextSyncAt:type: stringformat: date-time@@ -7391,6 +7476,7 @@ components:- fileType- exportMode- compressed+ - exportSource- createdAt- updatedAtBlobStorageIntegrationsResponse:@@ -7432,9 +7518,9 @@ components:Compare `lastSyncAt` against yourETL bookmark to determine if new data is available. Note that exports- run with a 30-minute lag buffer,+ run with a 20-minute lag buffer,- so `lastSyncAt` will always be at least 30 minutes behind real-time.+ so `lastSyncAt` will always be at least 20 minutes behind real-time.BlobStorageIntegrationStatusResponse:title: BlobStorageIntegrationStatusResponsetype: objectdiff --git a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts b/web/src/__tests__/server/blob-storage-integration-api.servertest.tsindex d209406d3c..a15a5a240a 100644--- a/web/src/__tests__/server/blob-storage-integration-api.servertest.ts+++ b/web/src/__tests__/server/blob-storage-integration-api.servertest.ts@@ -9,6 +9,7 @@ import {createAndAddApiKeysToDb,createBasicAuthHeader,} from "@langfuse/shared/src/server";+import { BLOB_EXPORT_FIELD_GROUPS } from "@langfuse/shared";import { decrypt } from "@langfuse/shared/encryption";// Schemas based on Fern schema definition@@ -21,13 +22,19 @@ const BlobStorageIntegrationResponseSchema = z.object({region: z.string(),accessKeyId: z.string().nullable(),prefix: z.string(),- exportFrequency: z.enum(["hourly", "daily", "weekly"]),+ exportFrequency: z.enum(["every_20_minutes", "hourly", "daily", "weekly"]),enabled: z.boolean(),forcePathStyle: z.boolean(),fileType: z.enum(["JSON", "CSV", "JSONL"]),exportMode: z.enum(["FULL_HISTORY", "FROM_TODAY", "FROM_CUSTOM_DATE"]),exportStartDate: z.coerce.date().nullable(),compressed: z.boolean(),+ exportSource: z.enum([+ "TRACES_OBSERVATIONS",+ "TRACES_OBSERVATIONS_EVENTS",+ "EVENTS",+ ]),+ exportFieldGroups: z.array(z.enum(BLOB_EXPORT_FIELD_GROUPS)).nullable(),nextSyncAt: z.coerce.date().nullable(),lastSyncAt: z.coerce.date().nullable(),createdAt: z.coerce.date(),@@ -620,6 +627,575 @@ describe("Blob Storage Integrations API", () => {});});+ describe("PUT/GET exportSource + exportFieldGroups behavior", () => {+ afterEach(async () => {+ await prisma.blobStorageIntegration.deleteMany({+ where: {+ projectId: { in: [testProject1Id, testProject2Id] },+ },+ });+ });++ // ---- EVENTS / TRACES_OBSERVATIONS_EVENTS path ----++ it("EVENTS + exportFieldGroups=[core,io] -> 200 and GET returns same value", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "EVENTS" as const,+ exportFieldGroups: ["core", "io"],+ };++ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);+ expect(putResponse.body.exportSource).toBe("EVENTS");+ expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);++ 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("EVENTS");+ expect(integration?.exportFieldGroups).toStrictEqual(["core", "io"]);+ });++ it("EVENTS + exportFieldGroups=[io] (missing core) -> 400", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "EVENTS" as const,+ exportFieldGroups: ["io"],+ };++ const result = await makeAPICall(+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(result.status).toBe(400);+ });++ it("EVENTS + exportFieldGroups omitted -> 200 and GET returns all 11 groups", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "EVENTS" as const,+ };++ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);++ 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("EVENTS");+ expect(integration?.exportFieldGroups).toBeDefined();+ expect(integration?.exportFieldGroups).toHaveLength(+ BLOB_EXPORT_FIELD_GROUPS.length,+ );+ expect(new Set(integration?.exportFieldGroups)).toStrictEqual(+ new Set(BLOB_EXPORT_FIELD_GROUPS),+ );+ });++ it("EVENTS + exportFieldGroups=null -> 200 and GET returns all 11 groups", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "EVENTS" as const,+ exportFieldGroups: null,+ };++ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);++ 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?.exportFieldGroups).toBeDefined();+ expect(integration?.exportFieldGroups).toHaveLength(+ BLOB_EXPORT_FIELD_GROUPS.length,+ );+ expect(new Set(integration?.exportFieldGroups)).toStrictEqual(+ new Set(BLOB_EXPORT_FIELD_GROUPS),+ );+ });++ // ---- TRACES_OBSERVATIONS path ----++ it("TRACES_OBSERVATIONS + exportFieldGroups omitted -> 200; GET hides field groups", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ };++ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);++ 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("TRACES_OBSERVATIONS");+ expect(integration?.exportFieldGroups).toBeNull();+ });++ it("TRACES_OBSERVATIONS + exportFieldGroups=null -> 200; GET hides field groups", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ exportFieldGroups: null,+ };++ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);++ 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?.exportFieldGroups).toBeNull();+ });++ it("TRACES_OBSERVATIONS + exportFieldGroups=[] -> 400 with 'not applicable'", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ exportFieldGroups: [],+ };++ const result = await makeAPICall(+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(result.status).toBe(400);+ const message = JSON.stringify(result.body);+ expect(message.toLowerCase()).toContain("not applicable");+ });++ it("TRACES_OBSERVATIONS + exportFieldGroups=[core,io] -> 400 with 'not applicable'", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ exportFieldGroups: ["core", "io"],+ };++ const result = await makeAPICall(+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(result.status).toBe(400);+ const message = JSON.stringify(result.body);+ expect(message.toLowerCase()).toContain("not applicable");+ });++ it("GET hides exportFieldGroups for legacy TRACES_OBSERVATIONS rows seeded via Prisma", async () => {+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "legacy-bucket",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "TRACES_OBSERVATIONS",+ 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("TRACES_OBSERVATIONS");+ expect(integration?.exportFieldGroups).toBeNull();+ });++ it("PUT TRACES_OBSERVATIONS preserves existing export_field_groups column in DB", async () => {+ // Seed with a custom subset+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "initial-bucket",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "TRACES_OBSERVATIONS",+ exportFieldGroups: ["core", "io"],+ },+ });++ await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ bucketName: "updated-bucket",+ },+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );++ const saved = await prisma.blobStorageIntegration.findUnique({+ where: { projectId: testProject1Id },+ });+ expect(saved?.bucketName).toBe("updated-bucket");+ // REST never overwrites export_field_groups for this source.+ expect(saved?.exportFieldGroups).toStrictEqual(["core", "io"]);+ });++ // ---- Response shape ----++ it("PUT response includes exportSource and exportFieldGroups (null for TRACES_OBSERVATIONS)", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "TRACES_OBSERVATIONS" as const,+ };++ const response = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(response.status).toBe(200);+ expect(response.body).toHaveProperty(+ "exportSource",+ "TRACES_OBSERVATIONS",+ );+ expect(response.body).toHaveProperty("exportFieldGroups");+ expect(response.body.exportFieldGroups).toBeNull();+ });++ it("GET response includes exportSource always and exportFieldGroups with source-conditional null", async () => {+ // Seed two integrations on different projects with different sources+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "bucket-1",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "TRACES_OBSERVATIONS",+ exportFieldGroups: ["core", "io", "metadata"],+ },+ });+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject2Id,+ type: "S3",+ bucketName: "bucket-2",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "EVENTS",+ exportFieldGroups: ["core", "io"],+ },+ });++ const getResponse = await makeZodVerifiedAPICall(+ z.object({ data: z.array(BlobStorageIntegrationResponseSchema) }),+ "GET",+ "/api/public/integrations/blob-storage",+ undefined,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ 200,+ );++ const tracesObsIntegration = getResponse.body.data.find(+ (i) => i.projectId === testProject1Id,+ );+ const eventsIntegration = 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([+ "core",+ "io",+ ]);+ });++ it("PUT without exportSource preserves existing EVENTS source and field groups", async () => {+ // Pre-seed an EVENTS row with a custom field-group subset+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "initial-bucket",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "EVENTS",+ exportFieldGroups: ["core", "io"],+ },+ });++ // PUT update with exportSource and exportFieldGroups both omitted+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ bucketName: "updated-bucket",+ };+ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);+ expect(putResponse.body.exportSource).toBe("EVENTS");+ expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);++ // DB row preserved on both columns; bucket updated+ const saved = await prisma.blobStorageIntegration.findUnique({+ where: { projectId: testProject1Id },+ });+ expect(saved?.exportSource).toBe("EVENTS");+ expect(saved?.exportFieldGroups).toStrictEqual(["core", "io"]);+ 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+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "initial-bucket",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "EVENTS",+ exportFieldGroups: ["core", "io"],+ },+ });++ // PUT with exportSource explicitly null — mirrors what an OpenAPI/SDK+ // client would emit for a not-provided value+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: null,+ bucketName: "updated-bucket",+ };+ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);+ expect(putResponse.body.exportSource).toBe("EVENTS");+ expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);++ const saved = await prisma.blobStorageIntegration.findUnique({+ where: { projectId: testProject1Id },+ });+ expect(saved?.exportSource).toBe("EVENTS");+ 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+ await prisma.blobStorageIntegration.create({+ data: {+ projectId: testProject1Id,+ type: "S3",+ bucketName: "initial-bucket",+ region: "us-east-1",+ accessKeyId: "key",+ secretAccessKey: "secret",+ prefix: "",+ exportFrequency: "daily",+ enabled: true,+ forcePathStyle: false,+ fileType: "JSONL",+ exportMode: "FULL_HISTORY",+ exportSource: "EVENTS",+ exportFieldGroups: ["core", "io"],+ },+ });++ // PUT with explicit exportSource=EVENTS but exportFieldGroups omitted+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportSource: "EVENTS" as const,+ bucketName: "updated-bucket",+ };+ const putResponse = await makeZodVerifiedAPICall(+ BlobStorageIntegrationResponseSchema,+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(putResponse.status).toBe(200);+ expect(putResponse.body.exportSource).toBe("EVENTS");+ expect(putResponse.body.exportFieldGroups).toStrictEqual(["core", "io"]);++ const saved = await prisma.blobStorageIntegration.findUnique({+ where: { projectId: testProject1Id },+ });+ expect(saved?.exportFieldGroups).toStrictEqual(["core", "io"]);+ expect(saved?.bucketName).toBe("updated-bucket");+ });++ it("PUT with exportFieldGroups but no exportSource -> 400", async () => {+ const requestBody = {+ ...validBlobStorageConfig,+ projectId: testProject1Id,+ exportFieldGroups: ["core", "io"],+ };++ const result = await makeAPICall(+ "PUT",+ "/api/public/integrations/blob-storage",+ requestBody,+ createBasicAuthHeader(testApiKey, testApiSecretKey),+ );+ expect(result.status).toBe(400);+ const message = JSON.stringify(result.body).toLowerCase();+ expect(message).toContain("exportsource is required");+ });+ });+describe("DELETE /api/public/integrations/blob-storage/{id}", () => {let testIntegrationId: string;diff --git a/web/src/features/public-api/types/blob-storage-integrations.ts b/web/src/features/public-api/types/blob-storage-integrations.tsindex 4db1c5c81c..56de7c635c 100644--- a/web/src/features/public-api/types/blob-storage-integrations.ts+++ b/web/src/features/public-api/types/blob-storage-integrations.ts@@ -1,5 +1,12 @@import { z } from "zod";-import { validateAzureContainerName } from "@/src/features/blobstorage-integration/validation";+import {+ AnalyticsIntegrationExportSource,+ BLOB_EXPORT_FIELD_GROUPS,+} from "@langfuse/shared";+import {+ validateAzureContainerName,+ validateExportFieldGroups,+} from "@/src/features/blobstorage-integration/validation";/*** Enums@@ -19,6 +26,10 @@ export const BlobStorageExportMode = z.enum(["FROM_CUSTOM_DATE",]);+export const BlobStorageExportSource = z.enum(AnalyticsIntegrationExportSource);++export const BlobStorageExportFieldGroup = z.enum(BLOB_EXPORT_FIELD_GROUPS);+/*** Request/Response Types*/@@ -47,6 +58,11 @@ export const CreateBlobStorageIntegrationRequest = zexportMode: BlobStorageExportMode,exportStartDate: z.coerce.date().nullable().optional(),compressed: z.boolean().optional().default(true),+ exportSource: BlobStorageExportSource.nullable().optional(),+ exportFieldGroups: z+ .array(BlobStorageExportFieldGroup)+ .nullable()+ .optional(),}).strict().refine(@@ -59,7 +75,39 @@ export const CreateBlobStorageIntegrationRequest = zpath: ["exportStartDate"],},)- .superRefine(validateAzureContainerName);+ .superRefine(validateAzureContainerName)+ .superRefine((data, ctx) => {+ if (data.exportSource == null && data.exportFieldGroups != null) {+ ctx.addIssue({+ code: "custom",+ message: "exportSource is required when exportFieldGroups is provided",+ path: ["exportSource"],+ });+ return;+ }+ if (+ data.exportSource ===+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS &&+ data.exportFieldGroups != null+ ) {+ ctx.addIssue({+ code: "custom",+ message:+ "exportFieldGroups is not applicable when exportSource is TRACES_OBSERVATIONS",+ path: ["exportFieldGroups"],+ });+ return;+ }+ if (data.exportFieldGroups != null && data.exportSource != null) {+ validateExportFieldGroups(+ {+ exportSource: data.exportSource,+ exportFieldGroups: data.exportFieldGroups,+ },+ ctx,+ );+ }+ });export const BlobStorageIntegrationResponse = z.object({@@ -78,6 +126,8 @@ export const BlobStorageIntegrationResponse = zexportMode: BlobStorageExportMode,exportStartDate: z.coerce.date().nullable(),compressed: z.boolean(),+ exportSource: BlobStorageExportSource,+ exportFieldGroups: z.array(BlobStorageExportFieldGroup).nullable(),nextSyncAt: z.coerce.date().nullable(),lastSyncAt: z.coerce.date().nullable(),lastError: z.string().nullable(),diff --git a/web/src/pages/api/public/integrations/blob-storage/index.ts b/web/src/pages/api/public/integrations/blob-storage/index.tsindex bc59d1d068..96314c8f87 100644--- a/web/src/pages/api/public/integrations/blob-storage/index.ts+++ b/web/src/pages/api/public/integrations/blob-storage/index.ts@@ -9,6 +9,8 @@ import {type BlobStorageIntegrationResponseType,} from "@/src/features/public-api/types/blob-storage-integrations";import {+ AnalyticsIntegrationExportSource,+ type BlobExportFieldGroup,LangfuseNotFoundError,UnauthorizedError,ForbiddenError,@@ -87,6 +89,12 @@ async function handleGetBlobStorageIntegrations(exportMode: integration.exportMode,exportStartDate: integration.exportStartDate,compressed: integration.compressed,+ exportSource: integration.exportSource,+ exportFieldGroups:+ integration.exportSource ===+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS+ ? null+ : (integration.exportFieldGroups as BlobExportFieldGroup[]),nextSyncAt: integration.nextSyncAt,lastSyncAt: integration.lastSyncAt,lastError: integration.lastError,@@ -174,6 +182,8 @@ async function handleUpsertBlobStorageIntegration(exportMode: validatedData.exportMode,exportStartDate: validatedData.exportStartDate ?? null,compressed: validatedData.compressed,+ exportSource: validatedData.exportSource ?? undefined,+ exportFieldGroups: validatedData.exportFieldGroups ?? undefined,},});@@ -194,6 +204,12 @@ async function handleUpsertBlobStorageIntegration(exportMode: integration.exportMode,exportStartDate: integration.exportStartDate,compressed: integration.compressed,+ exportSource: integration.exportSource,+ exportFieldGroups:+ integration.exportSource ===+ AnalyticsIntegrationExportSource.TRACES_OBSERVATIONS+ ? null+ : (integration.exportFieldGroups as BlobExportFieldGroup[]),nextSyncAt: integration.nextSyncAt,lastSyncAt: integration.lastSyncAt,lastError: integration.lastError,