Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit aa7cc2e

Browse files
authored
llm-proxy: annotate spans of sync jobs with whether they were skipped (#52433)
Makes it easier to tell whether a span is _supposed_ to have no child spans, or if GCP is just a bit slow. ## Test plan n/a
1 parent 80a8177 commit aa7cc2e

File tree

1 file changed

+6
-1
lines changed
  • enterprise/cmd/llm-proxy/internal/actor

1 file changed

+6
-1
lines changed

enterprise/cmd/llm-proxy/internal/actor/source.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ func (s *sourcesSyncHandler) Handle(ctx context.Context) (err error) {
159159
if err := s.rmux.LockContext(ctx); errors.HasType(err, &redsync.ErrTaken{}) {
160160
msg := fmt.Sprintf("did not acquire lock, another worker is likely active: %s", err.Error())
161161
handleLogger.Debug(msg)
162-
trace.SpanFromContext(ctx).AddEvent(msg)
162+
trace.SpanFromContext(ctx).SetAttributes(
163+
attribute.Bool("skipped", true),
164+
attribute.String("reason", msg))
163165

164166
return nil // ignore lock contention errors
165167
} else if err != nil {
@@ -171,6 +173,9 @@ func (s *sourcesSyncHandler) Handle(ctx context.Context) (err error) {
171173
_, _ = s.rmux.ExtendContext(ctx)
172174
}
173175

176+
// Annotate span to indicate we're actually doing work today!
177+
trace.SpanFromContext(ctx).SetAttributes(attribute.Bool("skipped", false))
178+
174179
p := pool.New().WithErrors().WithContext(ctx)
175180
for _, src := range s.sources {
176181
if src, ok := src.(SourceSyncer); ok {

0 commit comments

Comments
 (0)