Skip to content

Commit 8075322

Browse files
committed
add more spans
Signed-off-by: sallyom <[email protected]>
1 parent f00527f commit 8075322

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

internal/proxy/chat_completions.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ var (
3232
)
3333

3434
func (s *Server) chatCompletionsHandler(w http.ResponseWriter, r *http.Request) {
35-
tracer := otel.GetTracerProvider().Tracer("llm-d-routing")
35+
tracer := otel.GetTracerProvider().Tracer("llm-d-routing-sidecar")
3636
ctx, span := tracer.Start(r.Context(), "routing_proxy.request")
3737
defer span.End()
3838

39-
// Add component attribute to distinguish this part of the system
4039
span.SetAttributes(
41-
attribute.String("component", "llm-d-routing-sidecar"),
42-
attribute.String("operation", "route_request"),
40+
attribute.String("llm_d.proxy.connector", s.config.Connector),
4341
)
4442

4543
prefillPodHostPort := r.Header.Get(requestHeaderPrefillHostPort)

internal/proxy/connector_nixlv2.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@ import (
2323
"strings"
2424

2525
"github.com/google/uuid"
26+
"go.opentelemetry.io/otel"
27+
"go.opentelemetry.io/otel/attribute"
2628
)
2729

2830
func (s *Server) runNIXLProtocolV2(w http.ResponseWriter, r *http.Request, prefillPodHostPort string) {
31+
tracer := otel.GetTracerProvider().Tracer("llm-d-routing-sidecar")
32+
ctx, span := tracer.Start(r.Context(), "routing_proxy.nixl_v2_protocol")
33+
defer span.End()
34+
35+
span.SetAttributes(
36+
attribute.String("llm_d.proxy.connector", "nixlv2"),
37+
attribute.String("llm_d.prefill.target_host", prefillPodHostPort),
38+
)
39+
2940
s.logger.V(4).Info("running NIXL protocol V2", "url", prefillPodHostPort)
3041

3142
// Read request body
@@ -57,6 +68,10 @@ func (s *Server) runNIXLProtocolV2(w http.ResponseWriter, r *http.Request, prefi
5768
uuidStr := uuid.String()
5869

5970
// Prefill Stage
71+
_, prefillSpan := tracer.Start(ctx, "routing_proxy.nixl_v2_prefill")
72+
prefillSpan.SetAttributes(
73+
attribute.String("llm_d.nixl.stage", "prefill"),
74+
)
6075

6176
// 1. Prepare prefill request
6277
preq := r.Clone(r.Context())

0 commit comments

Comments
 (0)