Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
Expand All @@ -12,5 +13,8 @@ public class MonitoringAdminController {
public MonitoringAdminController(MonitoringAdminService service) { this.service = service; }

@GetMapping("/overview")
MonitoringAdminService.MonitoringResponse overview() { return service.overview(); }
MonitoringAdminService.MonitoringResponse overview(
@RequestParam(defaultValue = "24h") String range) {
return service.overview(range);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public final class AlibabaObservabilityStatus {
private final String project;
private final String auditLogstore;
private final String inferenceLogstore;
private final String usageLogstore;
private final boolean credentialsConfigured;
private final boolean prometheusEnabled;

Expand All @@ -19,10 +20,11 @@ public AlibabaObservabilityStatus(
@Value("${unispeaking.integrations.aliyun.project:}") String project,
@Value("${unispeaking.integrations.aliyun.audit-logstore:bailian-model-audit-log}") String auditLogstore,
@Value("${unispeaking.integrations.aliyun.inference-logstore:bailian-model-inference-log}") String inferenceLogstore,
@Value("${unispeaking.integrations.aliyun.usage-logstore:${unispeaking.integrations.aliyun.audit-logstore:bailian-model-audit-log}}") String usageLogstore,
@Value("${unispeaking.integrations.aliyun.access-key-id:}") String accessKeyId,
@Value("${unispeaking.integrations.aliyun.access-key-secret:}") String accessKeySecret,
@Value("${unispeaking.integrations.aliyun.prometheus-enabled:false}") boolean prometheusEnabled) {
this(region, project, auditLogstore, inferenceLogstore,
this(region, project, auditLogstore, inferenceLogstore, usageLogstore,
!accessKeyId.isBlank() && !accessKeySecret.isBlank(), prometheusEnabled);
}

Expand All @@ -33,10 +35,23 @@ public AlibabaObservabilityStatus(
String inferenceLogstore,
boolean credentialsConfigured,
boolean prometheusEnabled) {
this(region, project, auditLogstore, inferenceLogstore, auditLogstore,
credentialsConfigured, prometheusEnabled);
}

public AlibabaObservabilityStatus(
String region,
String project,
String auditLogstore,
String inferenceLogstore,
String usageLogstore,
boolean credentialsConfigured,
boolean prometheusEnabled) {
this.region = region;
this.project = project;
this.auditLogstore = auditLogstore;
this.inferenceLogstore = inferenceLogstore;
this.usageLogstore = usageLogstore;
this.credentialsConfigured = credentialsConfigured;
this.prometheusEnabled = prometheusEnabled;
}
Expand All @@ -45,6 +60,7 @@ public AlibabaObservabilityStatus(
public String project() { return project; }
public String auditLogstore() { return auditLogstore; }
public String inferenceLogstore() { return inferenceLogstore; }
public String usageLogstore() { return usageLogstore; }
public boolean credentialsConfigured() { return credentialsConfigured; }
public boolean prometheusEnabled() { return prometheusEnabled; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.unispeaking.admin.quality;

import com.unispeaking.admin.auth.domain.AdminAccount;
import com.unispeaking.admin.auth.application.AuthService.CurrentAdmin;
import com.unispeaking.admin.quality.QualityIssueAdminService.CreateIssueRequest;
import com.unispeaking.admin.quality.QualityIssueAdminService.IssueEventsResponse;
import com.unispeaking.admin.quality.QualityIssueAdminService.IssueListResponse;
Expand Down Expand Up @@ -61,15 +61,15 @@ IssueEventsResponse events(
@PostMapping("/issues")
QualityIssueView create(
@Valid @RequestBody CreateIssueRequest request,
@AuthenticationPrincipal AdminAccount administrator) {
@AuthenticationPrincipal CurrentAdmin administrator) {
return service.create(request, administrator.id(), administrator.login());
}

@PatchMapping("/issues/{issueId}")
QualityIssueView update(
@PathVariable UUID issueId,
@Valid @RequestBody UpdateIssueRequest request,
@AuthenticationPrincipal AdminAccount administrator) {
@AuthenticationPrincipal CurrentAdmin administrator) {
return service.update(issueId, request, administrator.id(), administrator.login());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public QualitySummary summary() {
WHERE occurred_at >= CURRENT_TIMESTAMP - INTERVAL '7 days'
AND (user_id IS NOT NULL OR NULLIF(anonymous_id, '') IS NOT NULL)) AS affected_users_7d,
COUNT(*) FILTER (WHERE status IN ('RESOLVED', 'VERIFIED')
AND updated_at >= CURRENT_TIMESTAMP - INTERVAL '7 days') AS resolved_7d
AND resolved_at >= CURRENT_TIMESTAMP - INTERVAL '7 days') AS resolved_7d
FROM quality_issues
""", (result, row) -> new QualitySummary(
result.getLong("active_issues"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ private boolean isActionable(Map<String, Object> fields) {
Integer status = integer(fields, "http_status");
String outcome = lower(text(fields, "outcome"));
if ((status != null && status == 401) || "unauthenticated".equals(outcome)) return false;
String eventType = lower(text(fields, "event_type"));
if ("api.request".equals(eventType) && status != null
&& status >= 400 && status < 500 && status != 408) return false;
String level = lower(text(fields, "level"));
return "error".equals(level) || "fatal".equals(level)
|| "error".equals(outcome) || "network_error".equals(outcome) || "timeout".equals(outcome);
Expand Down
Loading
Loading