Skip to content

Commit 23d2bf9

Browse files
fix: disable sync if not using traceloop (#22)
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1 parent e776972 commit 23d2bf9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

traceloop-sdk/sdk.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"log"
88
"net/http"
99
"os"
10+
"strings"
1011
"sync"
1112
"time"
1213

@@ -68,7 +69,9 @@ func (instance *Traceloop) initialize(ctx context.Context) error {
6869

6970
log.Printf("Traceloop %s SDK initialized. Connecting to %s\n", Version(), instance.config.BaseURL)
7071

71-
instance.pollPrompts()
72+
if strings.HasSuffix(strings.ToLower(instance.config.BaseURL), "traceloop.com") {
73+
instance.pollPrompts()
74+
}
7275
err := instance.initTracer(ctx, instance.config.ServiceName)
7376
if err != nil {
7477
return err
@@ -91,7 +94,6 @@ func setMessagesAttribute(span apitrace.Span, prefix string, messages []Message)
9194
}
9295
}
9396

94-
9597
// Tool calling attribute helpers for new types
9698
func setToolCallsAttribute(span apitrace.Span, messagePrefix string, toolCalls []ToolCall) {
9799
for i, toolCall := range toolCalls {
@@ -105,8 +107,6 @@ func setToolCallsAttribute(span apitrace.Span, messagePrefix string, toolCalls [
105107
}
106108
}
107109

108-
109-
110110
func setToolsAttribute(span apitrace.Span, tools []Tool) {
111111
if len(tools) == 0 {
112112
return
@@ -132,7 +132,6 @@ func setToolsAttribute(span apitrace.Span, tools []Tool) {
132132
}
133133
}
134134

135-
136135
func (instance *Traceloop) tracerName() string {
137136
if instance.config.TracerName != "" {
138137
return instance.config.TracerName
@@ -185,7 +184,6 @@ func (llmSpan *LLMSpan) LogCompletion(ctx context.Context, completion Completion
185184
return nil
186185
}
187186

188-
189187
func (instance *Traceloop) Shutdown(ctx context.Context) {
190188
if instance.tracerProvider != nil {
191189
instance.tracerProvider.Shutdown(ctx)

0 commit comments

Comments
 (0)