Getting a 404 error from langfuse in a spring ai + kotlin app #10960
-
Describe your questionGetting the following error from langfuse: Followed the setup instructions found here: https://langfuse.com/integrations/frameworks/spring-ai build.gradle.kts: application.properties: Using the following ENV vars: Also tried the following with no success: I'm creating my authentication key from the CLI as follows: $ echo -n <my public key> | base64Can you please help? I'm trying to eval the platform for a project and this is time sensitive. Thanks! Langfuse Cloud or Self-Hosted?Langfuse Cloud If Self-HostedNo response If Langfuse Cloudhttps://cloud.langfuse.com/project/cmivtj9v8009dad07heea7du0 SDK and integration versionsPre-Submission Checklist
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
The 404 error you're seeing is expected behavior. Langfuse only supports trace ingestion via OpenTelemetry—logs and metrics are not supported at the OTLP endpoint(1). The error message about failing to export logs can be safely ignored as it doesn't affect tracing functionality(1). However, there are two configuration issues to address: 1. Use the correct endpoint for Spring AI Your environment variable should point to the base OTLP endpoint, not the traces-specific path(2)(3): If your Spring Boot setup requires signal-specific variables, use(3): 2. Fix your authentication header Your The base64 encoding should include both your public and secret keys in the format echo -n "pk-lf-...:sk-lf-..." | base643. Add the custom span processor The Spring AI integration requires a custom After making these corrections, your traces should appear in Langfuse without 404 errors for the trace data itself (though log-related 404s may still appear and can be ignored). 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
Generated using both my public and private keys as follows:
Unfortunately i'm still getting the following error and don't see any traces in my project: |
Beta Was this translation helpful? Give feedback.
-
|
The 404 error for logs is expected and can be ignored(1). Langfuse does not support OpenTelemetry metrics or logs—only traces are ingested at the Since you're not seeing traces in your project despite correct configuration, here are additional troubleshooting steps: 1. Verify protocol configuration Langfuse does not support gRPC for the OpenTelemetry endpoint—you must use HTTP/protobuf(2). Add this to your 2. Confirm Spring AI observations are enabled Ensure these properties are set in 3. Check for mixed environment variable usage When using Spring Boot's OpenTelemetry starter, environment variables and application properties can conflict. Try setting the endpoint and headers only in 4. Verify the ChatModelCompletionContentObservationFilter bean The custom observation filter must be registered as a Spring bean to capture prompt and completion content properly(3). Confirm your implementation matches the documentation exactly. 5. Test with a minimal example Try a simple chat call to verify traces are being generated. If you still don't see traces after addressing the above points, the issue may be with how Spring Boot's OpenTelemetry auto-configuration is initializing(3). The log export 404 errors will continue to appear but should not prevent trace data from reaching Langfuse(1). 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
The connection error to Use environment variables instead of Spring properties Based on the Spring AI integration documentation and community troubleshooting, the recommended approach is to use OpenTelemetry environment variables rather than Spring Boot management properties(2)(1): The endpoint should be the base OTLP path ( Verify your dependencies match the documentation Confirm your dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.ai:spring-ai-starter-model-openai")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter")
implementation("io.opentelemetry:opentelemetry-exporter-otlp")
implementation("io.micrometer:micrometer-tracing-bridge-otel")
}
dependencyManagement {
imports {
mavenBom("org.springframework.ai:spring-ai-bom:1.0.0")
mavenBom("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:2.17.0")
}
}Keep your application.properties minimal Your Remove the Common issue from the community A user reported this exact same error pattern and confirmed that switching to environment variables resolved the connection issue(1). The Spring Boot OpenTelemetry starter appears to prioritize environment variables over application properties for OTLP configuration. After making these changes, restart your application and the traces should flow to Langfuse Cloud. The 404 log errors will still appear but can be ignored as Langfuse only supports trace ingestion via OpenTelemetry(4). 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
The connection error to
localhost:4318indicates that Spring Boot's OpenTelemetry auto-configuration is ignoring yourmanagement.otlp.tracing.endpointproperty and falling back to the default local endpoint(1).Use environment variables instead of Spring properties
Based on the Spring AI integration documentation and community troubleshooting, the recommended approach is to use OpenTelemetry environment variables rather than Spring Boot management properties(2)(1):
The endpoint should be the base OTLP path (
/api/public/otel), not the traces-speci…