워크플로우 메트릭 엔드포인트
워크플로우 메트릭 엔드포인트 (Workflows Metrics Endpoints)
Workflows API의 메트릭 관련 엔드포인트입니다. 특정 워크플로우의 실행 횟수, 성공·실패 횟수, 평균 지연시간 등 종합적인 메트릭을 조회할 수 있어요.
출처: 문서
본문
Workflows API - metrics. 실행 중인 워크플로우의 성능을 숫자로 확인하고 싶을 때 사용하는 엔드포인트예요.
GET /v1/workflows/{workflow_name}/metrics
특정 워크플로우의 종합 메트릭을 가져옵니다.
Args:
workflow_name: 메트릭을 가져올 워크플로우 타입의 이름start_time: 선택적 시작 시간 필터 (ISO 8601 형식)end_time: 선택적 종료 시간 필터 (ISO 8601 형식)
Returns — WorkflowMetrics: 메트릭을 담은 딕셔너리
execution_count: 총 실행 횟수success_count: 성공한 실행 횟수error_count: 실패/종료된 실행 횟수average_latency_ms: 평균 실행 시간 (밀리초)retry_rate: deprecated, 항상 -1. 재시도를 측정하지 않으며error_count를 대신 사용latency_over_time: 실행 시간의 시계열 데이터
Example:
GET /v1/workflows/MyWorkflow/metrics
GET /v1/workflows/MyWorkflow/metrics?start_time=2025-01-01T00:00
GET /v1/workflows/MyWorkflow/metrics?start_time=2025-01-01T00:00
&end_time=2025-12-31T23:59
파라미터
workflow_name#*stringstart_time#date-time|null — 이 시간 이후 시작된 워크플로우를 필터 (ISO 8601)end_time#date-time|null — 이 시간 이전 시작된 워크플로우를 필터 (ISO 8601)
응답 (200 — Successful Response)
average_latency_ms#*ScalarMetric — 단일 값을 가진 스칼라 메트릭error_count#*ScalarMetric — 단일 값을 가진 스칼라 메트릭execution_count#*ScalarMetric — 단일 값을 가진 스칼라 메트릭latency_over_time#*TimeSeriesMetric — 타임스탬프-값 쌍의 시계열 메트릭retry_rate#*ScalarMetric — 단일 값을 가진 스칼라 메트릭success_count#*ScalarMetric — 단일 값을 가진 스칼라 메트릭
Playground — 라이브로 엔드포인트 테스트
TypeScript:
import { Mistral } from "@mistralai/mistralai";
const mistral = new Mistral({
apiKey: proces...EY"] ?? "",
});
async function run() {
const result = await mistral.workflows.metrics.getWorkflowMetrics({
workflowName: "<value>",
});
console.log(result);
}
run();
Python:
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.workflows.metrics.get_workflow_metrics(workflow_name="<value>")
# Handle response
print(res)
curl:
curl https://api.mistral.ai/v1/workflows/{workflow_name}/metrics \
-X GET \
-H 'Authorization: Bearer ***'
응답 (200):
{
"average_latency_ms": {
"value": 87
},
"error_count": {
"value": 14
},
"execution_count": {
"value": 56
},
"latency_over_time": {
"value": [
[
91
]
]
},
"retry_rate": {
"value": 32
},
"success_count": {
"value": 78
}
}
더 알아보기 (Learn more)
- Workflows Metrics Endpoints — 공식 문서
- Workflows API — 워크플로우 관련 전체 엔드포인트
- Mistral Python SDK —
mistralai패키지