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

Could not add LangFuse (regression of PR #7571) #7676

Closed
5 tasks done
CXwudi opened this issue Aug 26, 2024 · 5 comments · Fixed by #7684
Closed
5 tasks done

Could not add LangFuse (regression of PR #7571) #7676

CXwudi opened this issue Aug 26, 2024 · 5 comments · Fixed by #7684
Labels
🐞 bug Something isn't working

Comments

@CXwudi
Copy link
Contributor

CXwudi commented Aug 26, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a random App,
  2. Go to the Monitoring tab
  3. Setup Langfuse

✔️ Expected Behavior

Langfuse config should work given the valid secret/public key pairs and the domain.

❌ Actual Behavior

image

@dosubot dosubot bot added the 🐞 bug Something isn't working label Aug 26, 2024
Copy link

dosubot bot commented Aug 26, 2024

I found a similar unsolved discussion regarding a URL error when adding Langfuse [1].

To resolve the configuration error for LangfuseConfig in a self-hosted Dify 0.7.2 setup, where the error message indicates a missing project_key field, follow these steps:

  1. Create a project in Langfuse:

    • Register and log in to Langfuse on the official website.
    • Create a new project by clicking New on the homepage and note down the project details.
  2. Create project API credentials:

    • In the project settings, click Settings in the left sidebar.
    • Click Create API Keys to generate API credentials.
    • Copy and save the Secret Key, Public Key, and Host.
  3. Configure Langfuse in Dify:

    • Open the application you need to monitor in Dify.
    • Navigate to Monitoring in the side menu and select Tracing app performance.
    • Paste the Secret Key, Public Key, and Host into the configuration fields.
  4. Retrieve and set the project_key:

    • If the project_key is not automatically retrieved, you can manually set it in the configuration file. Here is an example of how the configuration might look:
langfuse:
  secret_key: "your_secret_key"
  public_key: "your_public_key"
  host: "your_host"
  project_key: "your_project_key"

Ensure that all the required fields, including project_key, are correctly set in your configuration file. This should resolve the missing project_key field error.

Additionally, if you are using the OpsService class in Dify, it automatically handles the retrieval and setting of the project_key if it is missing. The get_tracing_app_config method in OpsService checks if the project_key is present and retrieves it if necessary:

if tracing_provider == 'langfuse' and ('project_key' not in decrypt_tracing_config or not decrypt_tracing_config.get('project_key')):
    project_key = OpsTraceManager.get_trace_config_project_key(decrypt_tracing_config, tracing_provider)
    decrypt_tracing_config['project_key'] = project_key

Make sure your configuration and setup align with these methods to ensure the project_key is correctly managed [2][3][4][5].

To continue talking to Dosu, mention @dosu.

@CXwudi CXwudi changed the title Could not add LangFuse (regression of PR #7578) Could not add LangFuse (regression of PR #7571) Aug 26, 2024
@CXwudi
Copy link
Contributor Author

CXwudi commented Aug 26, 2024

PR #7571 added a new field called project_key. However, it looks like the pydantic check happens before

project_key = OpsTraceManager.get_trace_config_project_key(tracing_config, tracing_provider)
is get called. Hence, it is complaining missing the required field.

My suggestion fix is to keep LangfuseConfig as it, and create a new DTO object called maybe LangFuseNewConfigDto that only has public_key, secret_key, and host. This DTO is only used when setting up a new langfuse config.

@huangying-just
Copy link

same question occurred. need to be fixed.

@gaoyue1989
Copy link

I think this occurred when the front-end API call was made and the "project_key" field was not passed. When I manually invoked the API, it returned success.

@CXwudi
Copy link
Contributor Author

CXwudi commented Sep 1, 2024

@gaoyue1989 I figured that as well. But I am not sure if the project_key should be needed when setting up a brand new LangFuse tracing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@gaoyue1989 @huangying-just @CXwudi and others