🪢 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(web): reflect Parquet export-tuning override in blob-storage settings (LFE-10463) (#14534)
Niklas Semmlera5055ca03a98
diff --git a/packages/shared/src/features/analytics-integrations/index.ts b/packages/shared/src/features/analytics-integrations/index.tsindex c87d65e9d6..11d1630b63 100644--- a/packages/shared/src/features/analytics-integrations/index.ts+++ b/packages/shared/src/features/analytics-integrations/index.ts@@ -99,28 +99,50 @@ const EXPORT_FIELD_GROUP_LABELS = {// whenever the model group is selected — for both export paths.const MODEL_ENRICHMENT_FIELDS = ["input_price", "output_price", "total_price"];-// The `description` of EXPORT_FIELD_GROUP_LABELS lists the enriched-// observations fields of each group; the legacy observations table contains-// fewer columns. Derive the legacy description from the export contract so it-// stays in sync when the contract changes.+const legacyFieldsForGroup = (group: ObservationFieldGroupFull): string[] =>+ LEGACY_OBSERVATION_EXPORT_FIELDS.filter((f) => f.group === group).map(+ (f) => f.field,+ );++const joinFields = (fields: string[]): string =>+ fields.length > 0+ ? fields.join(", ")+ : "Not included in the legacy observations export";++const withoutPrices = (csv: string): string =>+ csv+ .split(", ")+ .filter((field) => !MODEL_ENRICHMENT_FIELDS.includes(field))+ .join(", ");++// EXPORT_FIELD_GROUP_LABELS describes the enriched schema; the legacy+// observations table is narrower. Derive legacy from the export contract so it+// stays in sync. The legacy standard export still enriches model prices, so+// they're listed here.const legacyDescriptionForGroup = (group: ObservationFieldGroupFull,): string => {- const fields = LEGACY_OBSERVATION_EXPORT_FIELDS.filter(- (f) => f.group === group,- ).map((f) => f.field);- if (group === "model") {- fields.push(...MODEL_ENRICHMENT_FIELDS);- }- return fields.length > 0- ? fields.join(", ")- : "Not included in the legacy observations export";+ const fields = legacyFieldsForGroup(group);+ if (group === "model") fields.push(...MODEL_ENRICHMENT_FIELDS);+ return joinFields(fields);};+// Parquet runs no JS enrichment, so model price columns are absent. The two+// variants differ by source: enriched parquet uses the enriched schema, legacy+// parquet the (already narrower) legacy schema.+const parquetDescriptionForGroup = (group: ObservationFieldGroupFull): string =>+ withoutPrices(EXPORT_FIELD_GROUP_LABELS[group].description);++const legacyParquetDescriptionForGroup = (+ group: ObservationFieldGroupFull,+): string => joinFields(legacyFieldsForGroup(group));+export const EXPORT_FIELD_GROUP_OPTIONS = OBSERVATION_FIELD_GROUPS_FULL.map((value) => ({value,...EXPORT_FIELD_GROUP_LABELS[value],legacyDescription: legacyDescriptionForGroup(value),+ parquetDescription: parquetDescriptionForGroup(value),+ legacyParquetDescription: legacyParquetDescriptionForGroup(value),}),);diff --git a/web/src/__tests__/blob-storage-form-field-groups.clienttest.ts b/web/src/__tests__/blob-storage-form-field-groups.clienttest.tsindex bf8d19b31f..35de47fea7 100644--- a/web/src/__tests__/blob-storage-form-field-groups.clienttest.ts+++ b/web/src/__tests__/blob-storage-form-field-groups.clienttest.ts@@ -4,6 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import {type BlobStorageIntegrationFormSchema,blobStorageIntegrationFormSchema,+ parquetEnabledFromTuning,} from "@/src/features/blobstorage-integration/types";import {AnalyticsIntegrationExportSource,@@ -11,6 +12,7 @@ import {BlobStorageExportMode,BlobStorageIntegrationFileType,BlobStorageIntegrationType,+ EXPORT_FIELD_GROUP_OPTIONS,} from "@langfuse/shared";const VALID_BASE: BlobStorageIntegrationFormSchema = {@@ -86,3 +88,66 @@ describe("blob storage form — exportFieldGroups validation", () => {expect(onSubmit).toHaveBeenCalledOnce();});});++describe("parquetEnabledFromTuning", () => {+ it.each([+ [{ parquet: true }, true],+ [{ parquet: true, gzipLevel: 1 }, true],+ [{ parquet: false }, false],+ [{ gzipLevel: 1 }, false],+ [{}, false],+ [null, false],+ [undefined, false],+ ["parquet", false],+ [["parquet"], false],+ ])("%o → %s", (input, expected) => {+ expect(parquetEnabledFromTuning(input)).toBe(expected);+ });+});++describe("EXPORT_FIELD_GROUP_OPTIONS — parquet description", () => {+ const PRICE_FIELDS = ["input_price", "output_price", "total_price"];+ const model = EXPORT_FIELD_GROUP_OPTIONS.find((o) => o.value === "model")!;++ it("model group lists price columns in the standard description", () => {+ expect(PRICE_FIELDS.every((f) => model.description.includes(f))).toBe(true);+ });++ it("model group drops price columns in the parquet description", () => {+ expect(PRICE_FIELDS.some((f) => model.parquetDescription.includes(f))).toBe(+ false,+ );+ // Non-price model columns are preserved.+ expect(model.parquetDescription).toContain("provided_model_name");+ });++ it("non-model groups have identical standard and parquet descriptions", () => {+ for (const option of EXPORT_FIELD_GROUP_OPTIONS) {+ if (option.value === "model") continue;+ expect(option.parquetDescription).toBe(option.description);+ }+ });++ it("legacy parquet drops prices and uses the narrower legacy schema", () => {+ const basic = EXPORT_FIELD_GROUP_OPTIONS.find((o) => o.value === "basic")!;+ const traceContext = EXPORT_FIELD_GROUP_OPTIONS.find(+ (o) => o.value === "trace_context",+ )!;++ // No price columns (parquet runs no enrichment) — unlike legacyDescription.+ expect(+ PRICE_FIELDS.some((f) => model.legacyParquetDescription.includes(f)),+ ).toBe(false);+ expect(PRICE_FIELDS.some((f) => model.legacyDescription.includes(f))).toBe(+ true,+ );++ // Enriched-only columns are absent from the legacy schema.+ expect(basic.parquetDescription).toContain("bookmarked");+ expect(basic.legacyParquetDescription).not.toContain("bookmarked");+ expect(traceContext.parquetDescription).toContain("trace_name");+ expect(traceContext.legacyParquetDescription).toBe(+ "Not included in the legacy observations export",+ );+ });+});diff --git a/web/src/features/blobstorage-integration/types.ts b/web/src/features/blobstorage-integration/types.tsindex a37a756381..a26a6345f8 100644--- a/web/src/features/blobstorage-integration/types.ts+++ b/web/src/features/blobstorage-integration/types.ts@@ -52,6 +52,17 @@ export const blobStorageIntegrationFormSchemaBase = z.object({compressed: z.boolean().default(true),});+// True when the internal, DB-set `exportTuning.parquet` override is on (no UI+// write path). Mirrors the worker resolver: only `{ parquet: true }` counts.+export function parquetEnabledFromTuning(exportTuning: unknown): boolean {+ return (+ typeof exportTuning === "object" &&+ exportTuning !== null &&+ !Array.isArray(exportTuning) &&+ (exportTuning as Record<string, unknown>).parquet === true+ );+}+export const blobStorageIntegrationFormSchema =blobStorageIntegrationFormSchemaBase.superRefine(validateAzureContainerName)diff --git a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsxindex 0ae8f5aa05..a4b11983ea 100644--- a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx+++ b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx@@ -30,6 +30,7 @@ import {import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import {blobStorageIntegrationFormSchema,+ parquetEnabledFromTuning,type BlobStorageIntegrationFormSchema,type BlobStorageSyncStatus,} from "@/src/features/blobstorage-integration/types";@@ -373,6 +374,9 @@ const BlobStorageIntegrationSettingsForm = ({const watchedExportMode = blobStorageForm.watch("exportMode");const watchedExportSource = blobStorageForm.watch("exportSource");+ // Internal `exportTuning.parquet` override (no write path); reflected read-only+ // below since the worker forces Parquet over the persisted fileType + gzip.+ const isParquetOverride = parquetEnabledFromTuning(state?.exportTuning);const exportSourceOptions = getExportSourceOptions(state?.exportSource,availability,@@ -700,7 +704,12 @@ const BlobStorageIntegrationSettingsForm = ({<FormItem><FormLabel>File Type</FormLabel><FormControl>- <Select value={field.value} onValueChange={field.onChange}>+ {/* "PARQUET" is display-only; the persisted fileType is kept but ignored. */}+ <Select+ value={isParquetOverride ? "PARQUET" : field.value}+ onValueChange={field.onChange}+ disabled={isParquetOverride}+ ><SelectTrigger><SelectValue placeholder="Select file type" /></SelectTrigger>@@ -708,11 +717,16 @@ const BlobStorageIntegrationSettingsForm = ({<SelectItem value="JSONL">JSONL</SelectItem><SelectItem value="CSV">CSV</SelectItem><SelectItem value="JSON">JSON</SelectItem>+ {isParquetOverride && (+ <SelectItem value="PARQUET">Parquet</SelectItem>+ )}</SelectContent></Select></FormControl><FormDescription>- The file format for exported data.+ {isParquetOverride+ ? "Exporting as Apache Parquet — a columnar binary format encoded and compressed by ClickHouse. This is configured for your project and overrides the file type; gzip compression is not applicable."+ : "The file format for exported data."}</FormDescription><FormMessage /></FormItem>@@ -899,9 +913,13 @@ const BlobStorageIntegrationSettingsForm = ({)}</div><div className="text-muted-foreground text-xs">- {isLegacyOnlyExport- ? option.legacyDescription- : option.description}+ {isParquetOverride+ ? isLegacyOnlyExport+ ? option.legacyParquetDescription+ : option.parquetDescription+ : isLegacyOnlyExport+ ? option.legacyDescription+ : option.description}</div></label></div>@@ -952,26 +970,30 @@ const BlobStorageIntegrationSettingsForm = ({/>)}- <FormField- control={blobStorageForm.control}- name="compressed"- render={({ field }) => (- <FormItem>- <FormLabel>Gzip Compression</FormLabel>- <FormControl>- <Switch- checked={field.value}- onCheckedChange={field.onChange}- className="mt-1 ml-4"- />- </FormControl>- <FormDescription>- Compress exported files with gzip (.csv.gz, .json.gz, .jsonl.gz)- </FormDescription>- <FormMessage />- </FormItem>- )}- />+ {/* Parquet compresses internally — gzip does not apply. */}+ {!isParquetOverride && (+ <FormField+ control={blobStorageForm.control}+ name="compressed"+ render={({ field }) => (+ <FormItem>+ <FormLabel>Gzip Compression</FormLabel>+ <FormControl>+ <Switch+ checked={field.value}+ onCheckedChange={field.onChange}+ className="mt-1 ml-4"+ />+ </FormControl>+ <FormDescription>+ Compress exported files with gzip (.csv.gz, .json.gz,+ .jsonl.gz)+ </FormDescription>+ <FormMessage />+ </FormItem>+ )}+ />+ )}<FormFieldcontrol={blobStorageForm.control}