Package dev.dokimos.server.service
Class TraceEvalRuleService
java.lang.Object
dev.dokimos.server.service.TraceEvalRuleService
Manages per-project trace eval rules. A rule names what to match (span name or attribute key/value)
and the judge configuration plus connection used to score matching spans. Rule names are unique within
a project. Every load is tenant-scoped so a cross-tenant id surfaces as a 404, and a new rule is
stamped with its owning project's tenant.
-
Constructor Summary
ConstructorsConstructorDescriptionTraceEvalRuleService(TraceEvalRuleRepository ruleRepository, ProjectRepository projectRepository, LlmConnectionRepository connectionRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate(UUID projectId, CreateTraceEvalRuleRequest request, TenantScope scope) Creates a rule for a project, stamped with the project's tenant.voiddelete(UUID projectId, UUID ruleId, TenantScope scope) Deletes a rule.list(UUID projectId, TenantScope scope) Lists the rules of a project, oldest first, within the scope.update(UUID projectId, UUID ruleId, CreateTraceEvalRuleRequest request, TenantScope scope) Replaces a rule's definition.
-
Constructor Details
-
TraceEvalRuleService
public TraceEvalRuleService(TraceEvalRuleRepository ruleRepository, ProjectRepository projectRepository, LlmConnectionRepository connectionRepository)
-
-
Method Details
-
create
@Transactional public TraceEvalRuleView create(UUID projectId, CreateTraceEvalRuleRequest request, TenantScope scope) Creates a rule for a project, stamped with the project's tenant.- Parameters:
projectId- the owning projectrequest- the rule definitionscope- the tenant scope of the caller- Returns:
- the public view of the created rule
- Throws:
IllegalArgumentException- if the project or connection does not exist under the scope (mapped to 404)IllegalStateException- if a rule with the same name already exists in the project (mapped to 409)
-
list
@Transactional(readOnly=true) public List<TraceEvalRuleView> list(UUID projectId, TenantScope scope) Lists the rules of a project, oldest first, within the scope.- Throws:
IllegalArgumentException- if the project does not exist under the scope (mapped to 404)
-
update
@Transactional public TraceEvalRuleView update(UUID projectId, UUID ruleId, CreateTraceEvalRuleRequest request, TenantScope scope) Replaces a rule's definition.- Throws:
IllegalArgumentException- if the rule, project, or connection does not exist under the scope (mapped to 404)IllegalStateException- if the new name collides with another rule in the project (mapped to 409)
-
delete
Deletes a rule. Its enqueued jobs cascade away via the foreign key.- Throws:
IllegalArgumentException- if the rule or project does not exist under the scope (mapped to 404)
-