DAB(Data API Builder)는 분산 추적 및 메트릭에 대해 OpenTelemetry를 지원하므로 REST, GraphQL, 데이터베이스 작업 및 내부 미들웨어에서 애플리케이션의 동작을 모니터링하고 진단할 수 있습니다.
데이터 API 작성기 추적
DAB는 다음을 위한 OpenTelemetry "활동"을 만듭니다.
- 들어오는 HTTP 요청 (REST 엔드포인트)
- GraphQL operations
- Database queries (per entity)
- 내부 미들웨어 단계 (예: 요청 처리, 오류 추적)
각 활동에는 다음과 같은 자세한 태그(메타데이터)가 포함됩니다.
-
http.method,http.url,http.querystringstatus.code -
action.type(CRUD, GraphQL 작업) -
user.role,user-agent -
data-source.type,data-source.name -
api.type(REST 또는 GraphQL)
오류 및 예외도 자세한 정보로 추적됩니다.
데이터 API 작성기 메트릭
DAB는 다음과 같은 OpenTelemetry 메트릭을 내보낸다.
- Total Requests: Counter, labeled by HTTP method, status, endpoint, and API type.
- Errors: Counter, labeled by error type, HTTP method, status, endpoint, and API type.
- Request Duration: Histogram (in milliseconds), labeled as above.
- Active Requests: Up/down counter for concurrent requests.
메트릭은 .NET Meter API 및 OpenTelemetry SDK를 사용합니다.
Configuration
open-telemetry
구성 파일 아래에 runtime.telemetry 섹션을 추가합니다.
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "http://otel-collector:4317",
"service-name": "dab",
"exporter-protocol": "grpc"
}
}
}
}
CLI Options
Configure OpenTelemetry via CLI flags:
dab configure --otel-enabled truedab configure --otel-endpoint "http://otel-collector:4317"dab configure --otel-protocol "grpc"dab configure --otel-service-name "dab"dab configure --otel-headers
내보내기 및 시각화
원격 분석은 .NET OpenTelemetry SDK를 통해 Azure Monitor 또는 Jaeger와 같은 구성된 백 엔드로 내보냅니다. 백 엔드가 실행 중이고 지정된 endpoint위치에서 연결할 수 있는지 확인합니다.
Implementation Notes
- 추적 및 메트릭은 모든 REST, GraphQL 및 DB 작업을 다룹니다.
- 미들웨어 및 오류 처리기는 원격 분석도 내보낸다.
- 컨텍스트가 요청을 통해 전파됨