| 700 | } |
| 701 | |
| 702 | func (s *Server) emitInferStepTrace(traceID, requestID, tenantID, stepType, backend, stepStatus string, start time.Time, latencyMs int64) { |
| 703 | if !s.cfg.Telemetry.TracingEnabled { |
| 704 | return |
| 705 | } |
| 706 | end := start.UnixMilli() + latencyMs |
| 707 | result := "success" |
| 708 | if stepStatus != "success" { |
| 709 | result = "failed" |
| 710 | } |
| 711 | s.telemetry.EmitTrace(types.TraceRecord{ |
| 712 | TraceID: traceID, |
| 713 | SpanID: traceutil.NewSpanID(), |
| 714 | Name: "infer_step", |
| 715 | StartUnix: start.UnixMilli(), |
| 716 | EndUnix: end, |
| 717 | Labels: map[string]string{ |
| 718 | "request_id": requestID, |
| 719 | "tenant_id": tenantID, |
| 720 | "step_type": stepType, |
| 721 | "backend": backend, |
| 722 | "result": result, |
| 723 | }, |
| 724 | }) |
| 725 | } |
| 726 | |
| 727 | func (s *Server) emitTelemetryMetric(name string, value float64, labels map[string]string) { |
| 728 | if !s.cfg.Telemetry.MetricsEnabled { |