Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to batch ingestion endpoint #58

Merged
merged 29 commits into from
Dec 17, 2023

Conversation

maxdeichmann
Copy link
Member

No description provided.

langfuse-core/src/index.ts Dismissed Show dismissed Hide dismissed
@maxdeichmann maxdeichmann changed the base branch from main to v2 December 12, 2023 22:58
@maxdeichmann
Copy link
Member Author

2 integration tests failing because this test takes the latest main docker server and is not able to cope with the new usage format. Succeeds locally.

@@ -93,7 +104,7 @@ abstract class LangfuseCoreStateless {
this.publicKey = publicKey;
this.secretKey = secretKey;
this.baseUrl = removeTrailingSlash(options?.baseUrl || "https://cloud.langfuse.com");
this.flushAt = options?.flushAt ? Math.max(options?.flushAt, 1) : 1;
this.flushAt = options?.flushAt ? Math.max(options?.flushAt, 1) : 20;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default posthog behavior

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

means we set a lower bound to 1, we could go lower

@maxdeichmann maxdeichmann marked this pull request as ready for review December 13, 2023 19:54
langfuse-core/src/types.ts Outdated Show resolved Hide resolved
observationId?: string | null;
comment?: string | null;
};
export type UpdateLangfuseSpanBody = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd only specify what is different from the create here. can they be merged?

version?: string | null;
statusMessage?: string | null;
};
export type UpdateLangfuseGenerationBody = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can events not be updated?

@@ -93,7 +104,7 @@ abstract class LangfuseCoreStateless {
this.publicKey = publicKey;
this.secretKey = secretKey;
this.baseUrl = removeTrailingSlash(options?.baseUrl || "https://cloud.langfuse.com");
this.flushAt = options?.flushAt ? Math.max(options?.flushAt, 1) : 1;
this.flushAt = options?.flushAt ? Math.max(options?.flushAt, 1) : 20;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

means we set a lower bound to 1, we could go lower

}

// Flushes all events that are not yet sent to the server
// @returns {Promise[]} - list of promises for each item in the queue that is flushed
flush(): Promise<LangfuseFetchResponse>[] {
flush(callback?: (err?: any, data?: any) => void): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it return promise or void?

method: "POST",
body: payload,
});
console.debug("Sending payload", payload);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console

langfuse-core/src/converters.ts Outdated Show resolved Hide resolved
@@ -123,6 +124,7 @@ export class CallbackHandler extends BaseCallbackHandler {
async handleAgentAction(action: AgentAction, runId?: string, parentRunId?: string): Promise<void> {
try {
console.log("Agent action:", runId);

this.langfuse.span({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

._updateSpan() to only set end but not start?

@maxdeichmann maxdeichmann merged commit 5783114 into v2 Dec 17, 2023
4 of 5 checks passed
@maxdeichmann maxdeichmann deleted the migrate-to-ingestion-endpoint branch December 17, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants