| name | langfuse-migration-deep-dive |
| description | Execute complex Langfuse migrations including data migration and platform changes.
Use when migrating from other observability platforms, moving between Langfuse instances,
or performing major infrastructure migrations.
Trigger with phrases like "langfuse migration", "migrate to langfuse",
"langfuse data migration", "langfuse platform migration", "switch to langfuse".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*) |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","langfuse","observability","migration"] |
| compatibility | Designed for Claude Code |
Langfuse Migration Deep Dive
Current State
!npm list langfuse @langfuse/client 2>/dev/null | head -5 || echo 'No langfuse packages'
Overview
Comprehensive guide for complex migrations: cloud-to-self-hosted, LangSmith-to-Langfuse, cross-instance data migration, and zero-downtime dual-write patterns.
Prerequisites
- Understanding of source and target Langfuse instances
- API keys for both source and target
- Git branch for migration work
- Rollback plan documented
Migration Scenarios
| Scenario | Complexity | Downtime | Data Loss Risk |
|---|
| Cloud to Cloud (different project) | Low | None | None |
| Cloud to Self-hosted | Medium | Minutes | Low |
| Self-hosted to Cloud | Medium | Minutes | Low |
| LangSmith to Langfuse | High | Hours | Medium |
| SDK v3 to v4+ (no data migration) | Low | None | None |
Instructions
Step 1: Export Data from Source Instance
import { LangfuseClient } from "@langfuse/client";
import { writeFileSync, mkdirSync } from "fs";
const source = new LangfuseClient({
publicKey: process.env.SOURCE_LANGFUSE_PUBLIC_KEY,
secretKey: process.env.SOURCE_LANGFUSE_SECRET_KEY,
baseUrl: process.env.SOURCE_LANGFUSE_BASE_URL,
});
async function () {
(outputDir, { : });
page = ;
: [] = [];
hasMore = ;
.();
(hasMore) {
result = source...({ : , page });
allTraces.(...result.);
hasMore = result.. === ;
page++;
( (r, ));
}
(, .(allTraces, , ));
.();
page = ;
: [] = [];
hasMore = ;
.();
(hasMore) {
result = source...({ : , page });
allScores.(...result.);
hasMore = result.. === ;
page++;
( (r, ));
}
(, .(allScores, , ));
.();
.();
prompts = source...({ : });
(, .(prompts., , ));
.();
.();
datasets = source...({ : });
fullDatasets = [];
( ds datasets.) {
items = source...({ : ds., : });
fullDatasets.({ ...ds, : items. });
( (r, ));
}
(, .(fullDatasets, , ));
.();
}
();