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

chore: adds admin mode #455

Merged
merged 5 commits into from
Nov 20, 2024
Merged

chore: adds admin mode #455

merged 5 commits into from
Nov 20, 2024

Conversation

hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Nov 18, 2024

Problem

Changes

Release info Sub-libraries affected

Bump level

  • Major
  • Minor
  • Patch

Libraries affected

  • All of them
  • langfuse
  • langfuse-node

Changelog notes

  • Added support for X

Important

Adds admin mode to Langfuse SDK to store events locally, with tests verifying no network requests in this mode.

  • Behavior:
    • Introduces admin mode in LangfuseCoreStateless to store events locally instead of sending to server when LANGFUSE_SDK_ADMIN_ENABLED is true.
    • Adds _shutdownAdmin() to retrieve stored events in admin mode.
  • Tests:
    • Adds test should export events in admin mode in langfuse-integration-langchain.spec.ts to verify event storage and retrieval.
    • Adds test should not send events in admin mode in langfuse.flush.spec.ts to ensure no network requests are made in admin mode.

This description was created by Ellipsis for 7c8e88b. It will automatically update as commits are pushed.

Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
langfuse-js ✅ Ready (Inspect) Visit Preview Nov 20, 2024 8:39am

@hassiebp hassiebp marked this pull request as ready for review November 19, 2024 16:31
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Disclaimer: Experimental PR review

PR Summary

Added admin mode functionality to Langfuse SDK allowing events to be stored locally instead of being sent to the server, with environment variable control and integration test coverage.

  • Added adminEnabled flag and adminIngestionEvents array in langfuse-core/src/index.ts to store events locally when admin mode is active
  • Added _shutdownAdmin() method to retrieve stored events and clear buffer when admin mode is enabled
  • Added integration test in integration-test/langfuse-integration-langchain.spec.ts verifying correct event sequence generation in admin mode
  • Modified flush logic to prevent server calls when admin mode is enabled via LANGFUSE_SDK_ADMIN_ENABLED environment variable
  • Added test case in langfuse-core/test/langfuse.flush.spec.ts to verify no fetch calls occur in admin mode

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp
Copy link
Contributor Author

TODO: think about additional protection to have events scoped to a projectId only

@hassiebp hassiebp merged commit 84195d6 into main Nov 20, 2024
9 checks passed
@hassiebp hassiebp deleted the add-server-side-tracing branch November 20, 2024 08:57
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