@Service public static class AnnotationTraceExample.LlmService extends Object
| Constructor and Description |
|---|
LlmService() |
| Modifier and Type | Method and Description |
|---|---|
String |
customTrace(String model,
String query)
Customization: Specify span name, type, and capture input/output.
|
void |
errorTrace()
Error handling: The aspect automatically captures exceptions and records them as span errors.
|
void |
rootTrace(org.springframework.context.ConfigurableApplicationContext context)
Basic usage: Automatically captures method name as span name.
|
void |
simpleTrace(String input)
Basic usage: Automatically captures method name as span name.
|
Map<String,Object> |
spelTrace(String action,
Map<String,Object> params)
Advanced usage: Use SpEL expressions for dynamic span names and precise data extraction.
|
@CozeTrace public void rootTrace(org.springframework.context.ConfigurableApplicationContext context)
@CozeTrace public void simpleTrace(String input)
@CozeTrace(name="llm_chat_v1",
spanType="model",
captureArgs=true,
captureReturn=true)
public String customTrace(String model,
String query)
@CozeTrace(name="operation_#{#arg0}",
spanType="business",
inputExpression="#arg1",
outputExpression="#result")
public Map<String,Object> spelTrace(String action,
Map<String,Object> params)
@CozeTrace(name="unstable_operation") public void errorTrace()
Copyright © 2026. All rights reserved.