You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ADVANCED_FEATURES-en.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -475,6 +475,83 @@ spring:
475
475
timeout: 600000 # 10 minute timeout
476
476
```
477
477
478
+
## Langfuse Observability
479
+
480
+
DataAgent integrates [Langfuse](https://langfuse.com/) as an LLM observability platform, reporting trace data via the OpenTelemetry protocol to help you monitor and analyze agent performance.
481
+
482
+
### Feature Overview
483
+
484
+
- **Request Tracing**: Records the full lifecycle of each Graph stream processing (including new queries and human feedback)
485
+
- **Token Usage Tracking**: Automatically accumulates prompt tokens and completion tokens per request
486
+
- **Error Tracking**: Records exception types and error messages for troubleshooting
487
+
- **Rich Metadata**: Records context attributes such as agentId, threadId, nl2sqlOnly, humanFeedback
488
+
489
+
### Configuration
490
+
491
+
Configure Langfuse connection in `application.yml`:
492
+
493
+
```yaml
494
+
spring:
495
+
ai:
496
+
alibaba:
497
+
data-agent:
498
+
langfuse:
499
+
enabled: ${LANGFUSE_ENABLED:true}
500
+
host: ${LANGFUSE_HOST:}
501
+
public-key: ${LANGFUSE_PUBLIC_KEY:}
502
+
secret-key: ${LANGFUSE_SECRET_KEY:}
503
+
```
504
+
505
+
Or configure via environment variables:
506
+
507
+
```bash
508
+
export LANGFUSE_ENABLED=true
509
+
export LANGFUSE_HOST=https://cloud.langfuse.com
510
+
export LANGFUSE_PUBLIC_KEY=pk-lf-xxx
511
+
export LANGFUSE_SECRET_KEY=sk-lf-xxx
512
+
```
513
+
514
+
> For detailed configuration parameters, refer to [Developer Guide - Langfuse Configuration](DEVELOPER_GUIDE-en.md#11-langfuse-observability-configuration).
515
+
516
+
### Technical Implementation
517
+
518
+
The system sends trace data to Langfuse via OpenTelemetry OTLP HTTP protocol:
519
+
520
+
```
521
+
GraphServiceImpl
522
+
├── startLLMSpan("graph-stream", request) // New query starts
523
+
├── startLLMSpan("graph-feedback", request) // Human feedback starts
524
+
├── FluxUtil.extractAndAccumulateTokens() // Accumulate tokens during streaming
0 commit comments